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


C++ CTX_data_edit_mask函数代码示例

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


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

示例1: mask_hide_view_clear_exec

/* ********* clear/set restrict view *********/
static int mask_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;
	bool changed = false;

	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {

		if (masklay->restrictflag & OB_RESTRICT_VIEW) {
			ED_mask_layer_select_set(masklay, TRUE);
			masklay->restrictflag &= ~OB_RESTRICT_VIEW;
			changed = true;
		}
	}

	if (changed) {
		WM_event_add_notifier(C, NC_MASK | ND_DRAW, mask);
		DAG_id_tag_update(&mask->id, 0);

		return OPERATOR_FINISHED;
	}
	else {
		return OPERATOR_CANCELLED;
	}
}
开发者ID:castlelore,项目名称:blender-git,代码行数:26,代码来源:mask_ops.c

示例2: mask_layer_move_exec

static int mask_layer_move_exec(bContext *C, wmOperator *op)
{
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *mask_layer = BLI_findlink(&mask->masklayers, mask->masklay_act);
	MaskLayer *mask_layer_other;
	int direction = RNA_enum_get(op->ptr, "direction");

	if (!mask_layer)
		return OPERATOR_CANCELLED;

	if (direction == -1) {
		mask_layer_other = mask_layer->prev;

		if (!mask_layer_other)
			return OPERATOR_CANCELLED;

		BLI_remlink(&mask->masklayers, mask_layer);
		BLI_insertlinkbefore(&mask->masklayers, mask_layer_other, mask_layer);
		mask->masklay_act--;
	}
	else if (direction == 1) {
		mask_layer_other = mask_layer->next;

		if (!mask_layer_other)
			return OPERATOR_CANCELLED;

		BLI_remlink(&mask->masklayers, mask_layer);
		BLI_insertlinkafter(&mask->masklayers, mask_layer_other, mask_layer);
		mask->masklay_act++;
	}

	return OPERATOR_FINISHED;
}
开发者ID:castlelore,项目名称:blender-git,代码行数:33,代码来源:mask_ops.c

示例3: mask_select_linked_exec

static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;

	bool changed = false;

	/* do actual selection */
	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
		MaskSpline *spline;

		if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
			continue;
		}

		for (spline = masklay->splines.first; spline; spline = spline->next) {
			if (ED_mask_spline_select_check(spline)) {
				ED_mask_spline_select_set(spline, true);
				changed = true;
			}
		}
	}

	if (changed) {
		ED_mask_select_flush_all(mask);

		WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);

		return OPERATOR_FINISHED;
	}

	return OPERATOR_CANCELLED;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:33,代码来源:mask_select.c

示例4: mask_shape_key_insert_exec

static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
{
	Scene *scene = CTX_data_scene(C);
	const int frame = CFRA;
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;
	bool changed = false;

	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
		MaskLayerShape *masklay_shape;

		if (!ED_mask_layer_select_check(masklay)) {
			continue;
		}

		masklay_shape = BKE_mask_layer_shape_verify_frame(masklay, frame);
		BKE_mask_layer_shape_from_mask(masklay, masklay_shape);
		changed = true;
	}

	if (changed) {
		WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
		DAG_id_tag_update(&mask->id, 0);

		return OPERATOR_FINISHED;
	}
	else {
		return OPERATOR_CANCELLED;
	}
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:30,代码来源:mask_shapekey.c

示例5: set_handle_type_exec

static int set_handle_type_exec(bContext *C, wmOperator *op)
{
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;
	int handle_type = RNA_enum_get(op->ptr, "type");

	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
		MaskSpline *spline;
		int i;

		if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
			continue;
		}

		for (spline = masklay->splines.first; spline; spline = spline->next) {
			for (i = 0; i < spline->tot_point; i++) {
				MaskSplinePoint *point = &spline->points[i];

				if (MASKPOINT_ISSEL_ANY(point)) {
					BezTriple *bezt = &point->bezt;

					bezt->h1 = bezt->h2 = handle_type;
				}
			}
		}
	}

	WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
	DAG_id_tag_update(&mask->id, 0);

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

示例6: do_lasso_select_mask

static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, short select)
{
	ScrArea *sa = CTX_wm_area(C);
	ARegion *ar = CTX_wm_region(C);

	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;
	int i;

	rcti rect;
	bool changed = false;

	/* get rectangle from operator */
	BLI_lasso_boundbox(&rect, mcords, moves);

	/* do actual selection */
	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
		MaskSpline *spline;

		if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
			continue;
		}

		for (spline = masklay->splines.first; spline; spline = spline->next) {
			MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);

			for (i = 0; i < spline->tot_point; i++) {
				MaskSplinePoint *point = &spline->points[i];
				MaskSplinePoint *point_deform = &points_array[i];

				/* TODO: handles? */
				/* TODO: uw? */

				float screen_co[2];

				/* point in screen coords */
				ED_mask_point_pos__reverse(sa, ar,
				                           point_deform->bezt.vec[1][0], point_deform->bezt.vec[1][1],
				                           &screen_co[0], &screen_co[1]);

				if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
				    BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], INT_MAX))
				{
					BKE_mask_point_select_set(point, select);
					BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, select);
				}

				changed = true;
			}
		}
	}

	if (changed) {
		ED_mask_select_flush_all(mask);

		WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
	}

	return changed;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:60,代码来源:mask_select.c

示例7: mask_parent_clear_exec

static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;

	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
		MaskSpline *spline;
		int i;

		if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
			continue;
		}

		for (spline = masklay->splines.first; spline; spline = spline->next) {
			for (i = 0; i < spline->tot_point; i++) {
				MaskSplinePoint *point = &spline->points[i];

				if (MASKPOINT_ISSEL_ANY(point)) {
					point->parent.id = NULL;
				}
			}
		}
	}

	WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
	DAG_id_tag_update(&mask->id, 0);

	return OPERATOR_FINISHED;
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:29,代码来源:mask_relationships.c

示例8: mask_shape_key_clear_exec

static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
	Scene *scene = CTX_data_scene(C);
	const int frame = CFRA;
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;
	int change = FALSE;

	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
		MaskLayerShape *masklay_shape;

		if (!ED_mask_layer_select_check(masklay)) {
			continue;
		}

		masklay_shape = BKE_mask_layer_shape_find_frame(masklay, frame);

		if (masklay_shape) {
			BKE_mask_layer_shape_unlink(masklay, masklay_shape);
			change = TRUE;
		}
	}

	if (change) {
		WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
		DAG_id_tag_update(&mask->id, OB_RECALC_DATA);

		return OPERATOR_FINISHED;
	}
	else {
		return OPERATOR_CANCELLED;
	}
}
开发者ID:diosney,项目名称:blender,代码行数:33,代码来源:mask_shapekey.c

示例9: create_primitive_from_points

static int create_primitive_from_points(bContext *C, wmOperator *op, const float (*points)[2],
                                        int num_points, char handle_type)
{
	ScrArea *sa = CTX_wm_area(C);
	Scene *scene = CTX_data_scene(C);
	Mask *mask;
	MaskLayer *mask_layer;
	MaskSpline *new_spline;
	float scale, location[2], frame_size[2];
	int i, width, height;
	int size = RNA_float_get(op->ptr, "size");

	ED_mask_get_size(sa, &width, &height);
	scale = (float)size / max_ii(width, height);

	/* Get location in mask space. */
	frame_size[0] = width;
	frame_size[1] = height;
	RNA_float_get_array(op->ptr, "location", location);
	location[0] /= width;
	location[1] /= height;
	BKE_mask_coord_from_frame(location, location, frame_size);

	/* Make it so new primitive is centered to mouse location. */
	location[0] -= 0.5f * scale;
	location[1] -= 0.5f * scale;

	mask_layer = ED_mask_layer_ensure(C);
	mask = CTX_data_edit_mask(C);

	ED_mask_select_toggle_all(mask, SEL_DESELECT);

	new_spline = BKE_mask_spline_add(mask_layer);
	new_spline->flag = MASK_SPLINE_CYCLIC | SELECT;
	new_spline->tot_point = num_points;
	new_spline->points = MEM_recallocN(new_spline->points,
	                                   sizeof(MaskSplinePoint) * new_spline->tot_point);

	mask_layer->act_spline = new_spline;
	mask_layer->act_point = NULL;

	for (i = 0; i < num_points; i++) {
		MaskSplinePoint *new_point = &new_spline->points[i];

		copy_v2_v2(new_point->bezt.vec[1], points[i]);
		mul_v2_fl(new_point->bezt.vec[1], scale);
		add_v2_v2(new_point->bezt.vec[1], location);

		new_point->bezt.h1 = handle_type;
		new_point->bezt.h2 = handle_type;
		BKE_mask_point_select_set(new_point, true);
	}

	WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);

	/* TODO: only update this spline */
	BKE_mask_update_display(mask, CFRA);

	return OPERATOR_FINISHED;
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:60,代码来源:mask_add.c

示例10: copy_splines_exec

static int copy_splines_exec(bContext *C, wmOperator *UNUSED(op))
{
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *mask_layer = BKE_mask_layer_active(mask);

	BKE_mask_clipboard_copy_from_layer(mask_layer);

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

示例11: mask_layer_move_poll

static int mask_layer_move_poll(bContext *C)
{
	if (ED_maskedit_mask_poll(C)) {
		Mask *mask = CTX_data_edit_mask(C);

		return mask->masklay_tot > 0;
	}

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

示例12: select_all_exec

static int select_all_exec(bContext *C, wmOperator *op)
{
	Mask *mask = CTX_data_edit_mask(C);
	int action = RNA_enum_get(op->ptr, "action");

	ED_mask_select_toggle_all(mask, action);
	ED_mask_select_flush_all(mask);

	WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);

	return OPERATOR_FINISHED;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:12,代码来源:mask_select.c

示例13: masklay_remove_exec

static int masklay_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay = BKE_mask_layer_active(mask);

	if (masklay) {
		BKE_mask_layer_remove(mask, masklay);

		WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
	}

	return OPERATOR_FINISHED;
}
开发者ID:castlelore,项目名称:blender-git,代码行数:13,代码来源:mask_ops.c

示例14: masklay_new_exec

static int masklay_new_exec(bContext *C, wmOperator *op)
{
	Mask *mask = CTX_data_edit_mask(C);
	char name[MAX_ID_NAME - 2];

	RNA_string_get(op->ptr, "name", name);

	BKE_mask_layer_new(mask, name);
	mask->masklay_act = mask->masklay_tot - 1;

	WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);

	return OPERATOR_FINISHED;
}
开发者ID:castlelore,项目名称:blender-git,代码行数:14,代码来源:mask_ops.c

示例15: mask_normals_make_consistent_exec

/* *** recalc normals *** */
static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op))
{
	Scene *scene = CTX_data_scene(C);
	Mask *mask = CTX_data_edit_mask(C);
	MaskLayer *masklay;
	int i;

	bool changed = false;

	/* do actual selection */
	for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
		MaskSpline *spline;
		bool changed_layer = false;

		if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
			continue;
		}

		for (spline = masklay->splines.first; spline; spline = spline->next) {
			for (i = 0; i < spline->tot_point; i++) {
				MaskSplinePoint *point = &spline->points[i];

				if (MASKPOINT_ISSEL_ANY(point)) {
					BKE_mask_calc_handle_point_auto(spline, point, FALSE);
					changed = true;
					changed_layer = true;
				}
			}
		}

		if (changed_layer) {
			if (IS_AUTOKEY_ON(scene)) {
				ED_mask_layer_shape_auto_key(masklay, CFRA);
			}
		}
	}

	if (changed) {
		/* TODO: only update this spline */
		BKE_mask_update_display(mask, CFRA);

		WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
		WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);

		return OPERATOR_FINISHED;
	}

	return OPERATOR_CANCELLED;
}
开发者ID:castlelore,项目名称:blender-git,代码行数:50,代码来源:mask_ops.c


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