当前位置: 首页>>代码示例>>C++>>正文


C++ CTX_wm_space_clip函数代码示例

本文整理汇总了C++中CTX_wm_space_clip函数的典型用法代码示例。如果您正苦于以下问题:C++ CTX_wm_space_clip函数的具体用法?C++ CTX_wm_space_clip怎么用?C++ CTX_wm_space_clip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CTX_wm_space_clip函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: open_invoke

static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	char path[FILE_MAX];
	MovieClip *clip = NULL;

	if (sc)
		clip = ED_space_clip_get_clip(sc);

	if (clip) {
		BLI_strncpy(path, clip->name, sizeof(path));

		BLI_path_abs(path, G.main->name);
		BLI_parent_dir(path);
	}
	else {
		BLI_strncpy(path, U.textudir, sizeof(path));
	}

	if (RNA_struct_property_is_set(op->ptr, "files"))
		return open_exec(C, op);

	if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
		RNA_boolean_set(op->ptr, "relative_path", (U.flag & USER_RELPATHS) != 0);

	open_init(C, op);

	clip_filesel(C, op, path);

	return OPERATOR_RUNNING_MODAL;
}
开发者ID:kujira70,项目名称:Blender,代码行数:31,代码来源:clip_ops.c

示例2: prefetch_check_early_out

/* returns true if early out is possible */
static bool prefetch_check_early_out(const bContext *C)
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	MovieClip *clip = ED_space_clip_get_clip(sc);
	int first_uncached_frame, end_frame;
	int clip_len;

	clip_len = BKE_movieclip_get_duration(clip);

	/* check whether all the frames from prefetch range are cached */
	end_frame = prefetch_get_final_frame(C);

	first_uncached_frame =
		prefetch_find_uncached_frame(clip, sc->user.framenr, end_frame,
		                             sc->user.render_size, sc->user.render_flag, 1);

	if (first_uncached_frame > end_frame || first_uncached_frame == clip_len) {
		int start_frame = prefetch_get_start_frame(C);

		first_uncached_frame =
			prefetch_find_uncached_frame(clip, sc->user.framenr, start_frame,
			                             sc->user.render_size, sc->user.render_flag, -1);

		if (first_uncached_frame < start_frame)
			return true;
	}

	return false;
}
开发者ID:zedd4x,项目名称:bepuik,代码行数:30,代码来源:clip_editor.c

示例3: select_invoke

static int select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	ARegion *ar = CTX_wm_region(C);

	float co[2];
	const bool extend = RNA_boolean_get(op->ptr, "extend");

	if (!extend) {
		MovieTrackingTrack *track = tracking_marker_check_slide(C, event, NULL, NULL, NULL);

		if (track) {
			MovieClip *clip = ED_space_clip_get_clip(sc);

			clip->tracking.act_track = track;

			WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);

			return OPERATOR_PASS_THROUGH;
		}
	}

	ED_clip_mouse_pos(sc, ar, event->mval, co);
	RNA_float_set_array(op->ptr, "location", co);

	return select_exec(C, op);
}
开发者ID:zedd4x,项目名称:bepuik,代码行数:27,代码来源:tracking_select.c

示例4: view_pan_modal

static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	ViewPanData *vpd = op->customdata;
	float offset[2];

	switch (event->type) {
		case MOUSEMOVE:
			copy_v2_v2(vpd->vec, &vpd->xorig);
			offset[0] = (vpd->x - event->x) / sc->zoom;
			offset[1] = (vpd->y - event->y) / sc->zoom;
			RNA_float_set_array(op->ptr, "offset", offset);
			view_pan_exec(C, op);
			break;
		case ESCKEY:
			view_pan_exit(C, op, 1);

			return OPERATOR_CANCELLED;
		case SPACEKEY:
			view_pan_exit(C, op, 0);

			return OPERATOR_FINISHED;
		default:
			if (event->type == vpd->event_type && event->val == KM_RELEASE) {
				view_pan_exit(C, op, 0);

				return OPERATOR_FINISHED;
			}
			break;
	}

	return OPERATOR_RUNNING_MODAL;
}
开发者ID:kujira70,项目名称:Blender,代码行数:33,代码来源:clip_ops.c

示例5: clip_view_ndof_invoke

static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
	if (event->type != NDOF_MOTION)
		return OPERATOR_CANCELLED;
	else {
		SpaceClip *sc = CTX_wm_space_clip(C);
		ARegion *ar = CTX_wm_region(C);
		float pan_vec[3];

		const wmNDOFMotionData *ndof = event->customdata;
		const float speed = NDOF_PIXELS_PER_SECOND;

		WM_event_ndof_pan_get(ndof, pan_vec, true);

		mul_v2_fl(pan_vec, (speed * ndof->dt) / sc->zoom);
		pan_vec[2] *= -ndof->dt;

		sclip_zoom_set_factor(C, 1.0f + pan_vec[2], NULL);
		sc->xof += pan_vec[0];
		sc->yof += pan_vec[1];

		ED_region_tag_redraw(ar);

		return OPERATOR_FINISHED;
	}
}
开发者ID:kujira70,项目名称:Blender,代码行数:26,代码来源:clip_ops.c

示例6: CTX_wm_space_clip

static MovieTrackingPlaneTrack *tracking_plane_marker_check_slide(
        bContext *C,
        const wmEvent *event,
        int *corner_r)
{
	const float distance_clip_squared = 12.0f * 12.0f;
	SpaceClip *sc = CTX_wm_space_clip(C);
	ARegion *ar = CTX_wm_region(C);
	MovieClip *clip = ED_space_clip_get_clip(sc);
	MovieTracking *tracking = &clip->tracking;
	int width, height;
	float co[2];
	ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
	int framenr = ED_space_clip_get_clip_frame_number(sc);

	ED_space_clip_get_size(sc, &width, &height);
	if (width == 0 || height == 0) {
		return NULL;
	}

	ED_clip_mouse_pos(sc, ar, event->mval, co);

	float min_distance_squared = FLT_MAX;
	int min_corner = -1;
	MovieTrackingPlaneTrack *min_plane_track = NULL;
	for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first;
	     plane_track != NULL;
	     plane_track = plane_track->next)
	{
		if (PLANE_TRACK_VIEW_SELECTED(plane_track)) {
			MovieTrackingPlaneMarker *plane_marker =
			        BKE_tracking_plane_marker_get(plane_track, framenr);
			for (int i = 0; i < 4; i++) {
				float distance_squared =
				        mouse_to_plane_slide_zone_distance_squared(
				                co,
				                plane_marker->corners[i],
				                width,
				                height);

				if (distance_squared < min_distance_squared) {
					min_distance_squared = distance_squared;
					min_corner = i;
					min_plane_track = plane_track;
				}
			}
		}
	}

	if (min_distance_squared < distance_clip_squared / sc->zoom) {
		if (corner_r != NULL) {
			*corner_r = min_corner;
		}
		return min_plane_track;
	}

	return NULL;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:58,代码来源:tracking_ops_plane.c

示例7: circle_select_exec

static int circle_select_exec(bContext *C, wmOperator *op)
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	ARegion *ar = CTX_wm_region(C);

	MovieClip *clip = ED_space_clip_get_clip(sc);
	MovieTracking *tracking = &clip->tracking;
	MovieTrackingTrack *track;
	ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
	int x, y, radius, width, height, mode, change = FALSE;
	float zoomx, zoomy, offset[2], ellipse[2];
	int framenr = ED_space_clip_get_clip_frame_number(sc);

	/* get operator properties */
	x = RNA_int_get(op->ptr, "x");
	y = RNA_int_get(op->ptr, "y");
	radius = RNA_int_get(op->ptr, "radius");

	mode = RNA_int_get(op->ptr, "gesture_mode");

	/* compute ellipse and position in unified coordinates */
	ED_space_clip_get_size(sc, &width, &height);
	ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);

	ellipse[0] = width * zoomx / radius;
	ellipse[1] = height * zoomy / radius;

	ED_clip_point_stable_pos(sc, ar, x, y, &offset[0], &offset[1]);

	/* do selection */
	track = tracksbase->first;
	while (track) {
		if ((track->flag & TRACK_HIDDEN) == 0) {
			MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);

			if (MARKER_VISIBLE(sc, track, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
				if (mode == GESTURE_MODAL_SELECT)
					BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT);
				else
					BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT);

				change = TRUE;
			}
		}

		track = track->next;
	}

	if (change) {
		BKE_tracking_dopesheet_tag_update(tracking);

		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);

		return OPERATOR_FINISHED;
	}

	return OPERATOR_CANCELLED;
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:58,代码来源:tracking_select.c

示例8: apply_solution_scale_invoke

static int apply_solution_scale_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
  SpaceClip *sc = CTX_wm_space_clip(C);
  MovieClip *clip = ED_space_clip_get_clip(sc);
  if (!RNA_struct_property_is_set(op->ptr, "distance")) {
    RNA_float_set(op->ptr, "distance", clip->tracking.settings.dist);
  }
  return apply_solution_scale_exec(C, op);
}
开发者ID:dfelinto,项目名称:blender,代码行数:9,代码来源:tracking_ops_orient.c

示例9: set_origin_exec

static int set_origin_exec(bContext *C, wmOperator *op)
{
  SpaceClip *sc = CTX_wm_space_clip(C);
  MovieClip *clip = ED_space_clip_get_clip(sc);
  MovieTracking *tracking = &clip->tracking;
  Scene *scene = CTX_data_scene(C);
  Object *camera = get_camera_with_movieclip(scene, clip);
  int selected_count = count_selected_bundles(C);

  if (selected_count == 0) {
    BKE_report(op->reports,
               RPT_ERROR,
               "At least one track with bundle should be selected to "
               "define origin position");

    return OPERATOR_CANCELLED;
  }

  Object *object = get_orientation_object(C);
  if (object == NULL) {
    BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
    return OPERATOR_CANCELLED;
  }

  MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(tracking);
  ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);

  float median[3] = {0.0f, 0.0f, 0.0f};
  zero_v3(median);
  for (MovieTrackingTrack *track = tracksbase->first; track != NULL; track = track->next) {
    if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_HAS_BUNDLE)) {
      add_v3_v3(median, track->bundle_pos);
    }
  }
  mul_v3_fl(median, 1.0f / selected_count);

  float mat[4][4], vec[3];
  BKE_tracking_get_camera_object_matrix(scene, camera, mat);
  mul_v3_m4v3(vec, mat, median);

  if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
    sub_v3_v3(object->loc, vec);
  }
  else {
    object_solver_inverted_matrix(scene, object, mat);
    mul_v3_m4v3(vec, mat, vec);
    copy_v3_v3(object->loc, vec);
  }

  DEG_id_tag_update(&clip->id, 0);
  DEG_id_tag_update(&object->id, ID_RECALC_TRANSFORM);

  WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
  WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);

  return OPERATOR_FINISHED;
}
开发者ID:dfelinto,项目名称:blender,代码行数:57,代码来源:tracking_ops_orient.c

示例10: ED_space_clip_poll

int ED_space_clip_poll(bContext *C)
{
	SpaceClip *sc = CTX_wm_space_clip(C);

	if (sc && sc->clip)
		return true;

	return false;
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:9,代码来源:clip_editor.c

示例11: clip_graph_knots_poll

static int clip_graph_knots_poll(bContext *C)
{
	if (ED_space_clip_graph_poll(C)) {
		SpaceClip *sc = CTX_wm_space_clip(C);

		return (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) != 0;
	}
	return false;
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:9,代码来源:clip_graph_ops.c

示例12: ED_space_clip_graph_poll

static int ED_space_clip_graph_poll(bContext *C)
{
	if (ED_space_clip_tracking_poll(C)) {
		SpaceClip *sc = CTX_wm_space_clip(C);

		return sc->view == SC_VIEW_GRAPH;
	}

	return false;
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:10,代码来源:clip_graph_ops.c

示例13: select_poll

static int select_poll(bContext *C)
{
	SpaceClip *sc = CTX_wm_space_clip(C);

	if (sc) {
		return sc->clip && sc->view == SC_VIEW_CLIP;
	}

	return false;
}
开发者ID:manwapastorelli,项目名称:blender-git,代码行数:10,代码来源:tracking_select.c

示例14: clip_set_2d_cursor_invoke

static int clip_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	ARegion *ar = CTX_wm_region(C);
	SpaceClip *sclip = CTX_wm_space_clip(C);
	float location[2];

	ED_clip_mouse_pos(sclip, ar, event->mval, location);
	RNA_float_set_array(op->ptr, "location", location);

	return clip_set_2d_cursor_exec(C, op);
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:11,代码来源:clip_ops.c

示例15: mouse_select_knot

static bool mouse_select_knot(bContext *C, float co[2], bool extend)
{
	SpaceClip *sc = CTX_wm_space_clip(C);
	MovieClip *clip = ED_space_clip_get_clip(sc);
	ARegion *ar = CTX_wm_region(C);
	View2D *v2d = &ar->v2d;
	MovieTracking *tracking = &clip->tracking;
	MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
	static const int delta = 6;

	if (act_track) {
		MouseSelectUserData userdata;

		mouse_select_init_data(&userdata, co);
		clip_graph_tracking_values_iterate_track(sc, act_track, &userdata,
		                                         find_nearest_tracking_knot_cb, NULL, NULL);

		if (userdata.marker) {
			int x1, y1, x2, y2;

			if (UI_view2d_view_to_region_clip(v2d, co[0], co[1], &x1, &y1) &&
			    UI_view2d_view_to_region_clip(v2d, userdata.min_co[0], userdata.min_co[1], &x2, &y2) &&
			    (abs(x2 - x1) <= delta && abs(y2 - y1) <= delta))
			{
				if (!extend) {
					SelectUserData selectdata = {SEL_DESELECT};

					clip_graph_tracking_iterate(sc,
					                            (sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0,
					                            (sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,
					                            &selectdata,
					                            toggle_selection_cb);
				}

				if (userdata.coord == 0) {
					if (extend && (userdata.marker->flag & MARKER_GRAPH_SEL_X) != 0)
						userdata.marker->flag &= ~MARKER_GRAPH_SEL_X;
					else
						userdata.marker->flag |= MARKER_GRAPH_SEL_X;
				}
				else {
					if (extend && (userdata.marker->flag & MARKER_GRAPH_SEL_Y) != 0)
						userdata.marker->flag &= ~MARKER_GRAPH_SEL_Y;
					else
						userdata.marker->flag |= MARKER_GRAPH_SEL_Y;
				}

				return true;
			}
		}
	}

	return false;
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:54,代码来源:clip_graph_ops.c


注:本文中的CTX_wm_space_clip函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。