• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CTX_data_edit_object函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CTX_data_edit_object

static Object *make_prim_init(bContext *C, const char *idname,
                              float *dia, float mat[4][4],
                              bool *was_editmode, const float loc[3], const float rot[3], const unsigned int layer)
{
	Object *obedit = CTX_data_edit_object(C);

	*was_editmode = false;
	if (obedit == NULL || obedit->type != OB_MESH) {
		obedit = ED_object_add_type(C, OB_MESH, loc, rot, false, layer);

		rename_id((ID *)obedit, idname);
		rename_id((ID *)obedit->data, idname);

		/* create editmode */
		ED_object_editmode_enter(C, EM_DO_UNDO | EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
		*was_editmode = true;
	}

	*dia = ED_object_new_primitive_matrix(C, obedit, loc, rot, mat, false);

	return obedit;
}
开发者ID:ideasman42,项目名称:blender-wayland,代码行数:22,代码来源:editmesh_add.c


示例2: lattice_select_more_less

static int lattice_select_more_less(bContext *C, const bool select)
{
	Object *obedit = CTX_data_edit_object(C);
	Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt;
	BPoint *bp;
	const int tot = lt->pntsu * lt->pntsv * lt->pntsw;
	int u, v, w;
	BLI_bitmap *selpoints;

	lt->actbp = LT_ACTBP_NONE;

	selpoints = BLI_BITMAP_NEW(tot, __func__);
	BKE_lattice_bitmap_from_flag(lt, selpoints, SELECT, false, false);

	bp = lt->def;
	for (w = 0; w < lt->pntsw; w++) {
		for (v = 0; v < lt->pntsv; v++) {
			for (u = 0; u < lt->pntsu; u++) {
				if ((bp->hide == 0) && (((bp->f1 & SELECT) == 0) == select)) {
					if (lattice_test_bitmap_uvw(lt, selpoints, u + 1, v, w, select) ||
					    lattice_test_bitmap_uvw(lt, selpoints, u - 1, v, w, select) ||
					    lattice_test_bitmap_uvw(lt, selpoints, u, v + 1, w, select) ||
					    lattice_test_bitmap_uvw(lt, selpoints, u, v - 1, w, select) ||
					    lattice_test_bitmap_uvw(lt, selpoints, u, v, w + 1, select) ||
					    lattice_test_bitmap_uvw(lt, selpoints, u, v, w - 1, select))
					{
						BKE_BIT_TEST_SET(bp->f1, select, SELECT);
					}
				}
				bp++;
			}
		}
	}

	MEM_freeN(selpoints);

	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
	return OPERATOR_FINISHED;
}
开发者ID:ruesp83,项目名称:Blender---Layer,代码行数:39,代码来源:object_lattice.c


示例3: select_nth_exec

static int select_nth_exec(bContext *C, wmOperator *op)
{
	Object *obedit = CTX_data_edit_object(C);
	struct CheckerIntervalParams op_params;

	WM_operator_properties_checker_interval_from_op(op, &op_params);

	if (!ed_curve_select_nth(obedit->data, &op_params)) {
		if (obedit->type == OB_SURF) {
			BKE_report(op->reports, RPT_ERROR, "Surface has not got active point");
		}
		else {
			BKE_report(op->reports, RPT_ERROR, "Curve has not got active point");
		}

		return OPERATOR_CANCELLED;
	}

	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);

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


示例4: make_prim_ext

static void make_prim_ext(bContext *C, float *loc, float *rot, int enter_editmode, unsigned int layer, 
		int type, int tot, int seg,
		int subdiv, float dia, float depth, int ext, int fill)
{
	Object *obedit= CTX_data_edit_object(C);
	int newob = 0;
	float mat[4][4];
	float scale;

	if(obedit==NULL || obedit->type!=OB_MESH) {
		obedit= ED_object_add_type(C, OB_MESH, loc, rot, FALSE, layer);
		
		rename_id((ID *)obedit, get_mesh_defname(type));
		rename_id((ID *)obedit->data, get_mesh_defname(type));
		
		/* create editmode */
		ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
		newob = 1;
	}
	else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);

	scale= ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);

	dia *= scale;
	depth *= scale * 0.5f;

	make_prim(obedit, type, mat, tot, seg, subdiv, dia, depth, ext, fill);

	DAG_id_tag_update(obedit->data, 0);
	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);


	/* userdef */
	if (newob && !enter_editmode) {
		ED_object_exit_editmode(C, EM_FREEDATA); /* adding EM_DO_UNDO messes up operator redo */
	}
	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:38,代码来源:editmesh_add.c


示例5: get_undo_system

static int get_undo_system(bContext *C)
{
	Object *obact = CTX_data_active_object(C);
	Object *obedit = CTX_data_edit_object(C);
	ScrArea *sa = CTX_wm_area(C);

	/* first check for editor undo */
	if (sa && (sa->spacetype == SPACE_IMAGE)) {
		SpaceImage *sima = (SpaceImage *)sa->spacedata.first;

		if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) {
			if (!ED_undo_paint_empty(UNDO_PAINT_IMAGE))
				return UNDOSYSTEM_IMAPAINT;
		}
	}
	/* find out which undo system */
	if (obedit) {
		if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
			return UNDOSYSTEM_EDITMODE;
		}
	}
	else {
		Object *obact = CTX_data_active_object(C);
		
		if (obact) {
			if (obact->mode & OB_MODE_PARTICLE_EDIT)
				return UNDOSYSTEM_PARTICLE;
			else if (obact->mode & OB_MODE_TEXTURE_PAINT) {
				if (!ED_undo_paint_empty(UNDO_PAINT_IMAGE))
					return UNDOSYSTEM_IMAPAINT;
			}
		}
		if (U.uiflag & USER_GLOBALUNDO)
			return UNDOSYSTEM_GLOBAL;
	}
	
	return 0;
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:38,代码来源:undo.c


示例6: select_row_exec

static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
{
	Object *obedit = CTX_data_edit_object(C);
	Curve *cu = obedit->data;
	ListBase *editnurb = object_editcurve_get(obedit);
	static BPoint *last = NULL;
	static int direction = 0;
	Nurb *nu = NULL;
	BPoint *bp = NULL;
	int u = 0, v = 0, a, b;

	if (!BKE_curve_nurb_vert_active_get(cu, &nu, (void *)&bp))
		return OPERATOR_CANCELLED;

	if (last == bp) {
		direction = 1 - direction;
		BKE_nurbList_flag_set(editnurb, 0);
	}
	last = bp;

	u = cu->actvert % nu->pntsu;
	v = cu->actvert / nu->pntsu;
	bp = nu->bp;
	for (a = 0; a < nu->pntsv; a++) {
		for (b = 0; b < nu->pntsu; b++, bp++) {
			if (direction) {
				if (a == v) select_bpoint(bp, SELECT, SELECT, VISIBLE);
			}
			else {
				if (b == u) select_bpoint(bp, SELECT, SELECT, VISIBLE);
			}
		}
	}

	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);

	return OPERATOR_FINISHED;
}
开发者ID:shyamalschandra,项目名称:blender_2.75a,代码行数:38,代码来源:editcurve_select.c


示例7: armature_select_similar_exec

static int armature_select_similar_exec(bContext *C, wmOperator *op)
{
	Object *obedit = CTX_data_edit_object(C);
	bArmature *arm = obedit->data;
	EditBone *ebone_act = CTX_data_active_bone(C);

	/* Get props */
	int type = RNA_enum_get(op->ptr, "type");
	float thresh = RNA_float_get(op->ptr, "threshold");

	/* Check for active bone */
	if (ebone_act == NULL) {
		BKE_report(op->reports, RPT_ERROR, "Operation requires an active bone");
		return OPERATOR_CANCELLED;
	}

	switch (type) {
		case SIMEDBONE_LENGTH:
			select_similar_length(arm, ebone_act, thresh);
			break;
		case SIMEDBONE_DIRECTION:
			select_similar_direction(arm, ebone_act, thresh);
			break;
		case SIMEDBONE_PREFIX:
			select_similar_prefix(arm, ebone_act);
			break;
		case SIMEDBONE_SUFFIX:
			select_similar_suffix(arm, ebone_act);
			break;
		case SIMEDBONE_LAYER:
			select_similar_layer(arm, ebone_act);
			break;
	}

	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);

	return OPERATOR_FINISHED;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:38,代码来源:armature_select.c


示例8: ED_undo_push

void ED_undo_push(bContext *C, const char *str)
{
	Object *obedit = CTX_data_edit_object(C);
	Object *obact = CTX_data_active_object(C);

	if (G.debug & G_DEBUG)
		printf("%s: %s\n", __func__, str);

	if (obedit) {
		if (U.undosteps == 0) return;
		
		if (obedit->type == OB_MESH)
			undo_push_mesh(C, str);
		else if (ELEM(obedit->type, OB_CURVE, OB_SURF))
			undo_push_curve(C, str);
		else if (obedit->type == OB_FONT)
			undo_push_font(C, str);
		else if (obedit->type == OB_MBALL)
			undo_push_mball(C, str);
		else if (obedit->type == OB_LATTICE)
			undo_push_lattice(C, str);
		else if (obedit->type == OB_ARMATURE)
			undo_push_armature(C, str);
	}
	else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
		if (U.undosteps == 0) return;

		PE_undo_push(CTX_data_scene(C), str);
	}
	else if (obact && obact->mode & OB_MODE_SCULPT) {
		/* do nothing for now */
	}
	else {
		BKE_undo_write(C, str);
	}

	WM_file_tag_modified(C);
}
开发者ID:wisaac407,项目名称:blender,代码行数:38,代码来源:undo.c


示例9: duplicate_metaelems_exec

/* Duplicate selected MetaElements */
static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
{
	Object *obedit = CTX_data_edit_object(C);
	MetaBall *mb = (MetaBall *)obedit->data;
	MetaElem *ml, *newml;
	
	ml = mb->editelems->last;
	if (ml) {
		while (ml) {
			if (ml->flag & SELECT) {
				newml = MEM_dupallocN(ml);
				BLI_addtail(mb->editelems, newml);
				mb->lastelem = newml;
				ml->flag &= ~SELECT;
			}
			ml = ml->prev;
		}
		WM_event_add_notifier(C, NC_GEOM | ND_DATA, mb);
		DAG_id_tag_update(obedit->data, 0);
	}

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


示例10: delete_metaelems_exec

/* Delete all selected MetaElems (not MetaBall) */
static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
{
	Object *obedit = CTX_data_edit_object(C);
	MetaBall *mb = (MetaBall *)obedit->data;
	MetaElem *ml, *next;
	
	ml = mb->editelems->first;
	if (ml) {
		while (ml) {
			next = ml->next;
			if (ml->flag & SELECT) {
				if (mb->lastelem == ml) mb->lastelem = NULL;
				BLI_remlink(mb->editelems, ml);
				MEM_freeN(ml);
			}
			ml = next;
		}
		WM_event_add_notifier(C, NC_GEOM | ND_DATA, mb);
		DAG_id_tag_update(obedit->data, 0);
	}

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


示例11: armature_delete_selected_exec

/* only editmode! */
static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
	bArmature *arm;
	EditBone *curBone, *ebone_next;
	Object *obedit = CTX_data_edit_object(C);
	bool changed = false;
	arm = obedit->data;

	/* cancel if nothing selected */
	if (CTX_DATA_COUNT(C, selected_bones) == 0)
		return OPERATOR_CANCELLED;

	armature_select_mirrored(arm);

	BKE_pose_channels_remove(obedit, armature_delete_ebone_cb, arm);

	for (curBone = arm->edbo->first; curBone; curBone = ebone_next) {
		ebone_next = curBone->next;
		if (arm->layer & curBone->layer) {
			if (curBone->flag & BONE_SELECTED) {
				if (curBone == arm->act_edbone) arm->act_edbone = NULL;
				ED_armature_ebone_remove(arm, curBone);
				changed = true;
			}
		}
	}

	if (!changed)
		return OPERATOR_CANCELLED;

	ED_armature_edit_sync_selection(arm->edbo);
	BKE_pose_tag_recalc(CTX_data_main(C), obedit->pose);

	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);

	return OPERATOR_FINISHED;
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:38,代码来源:armature_edit.c


示例12: CTX_data_mode_enum

int CTX_data_mode_enum(const bContext *C)
{
	Object *obedit= CTX_data_edit_object(C);

	if(obedit) {
		switch(obedit->type) {
			case OB_MESH:
				return CTX_MODE_EDIT_MESH;
			case OB_CURVE:
				return CTX_MODE_EDIT_CURVE;
			case OB_SURF:
				return CTX_MODE_EDIT_SURFACE;
			case OB_FONT:
				return CTX_MODE_EDIT_TEXT;
			case OB_ARMATURE:
				return CTX_MODE_EDIT_ARMATURE;
			case OB_MBALL:
				return CTX_MODE_EDIT_METABALL;
			case OB_LATTICE:
				return CTX_MODE_EDIT_LATTICE;
		}
	}
	else {
		Object *ob = CTX_data_active_object(C);

		if(ob) {
			if(ob->mode & OB_MODE_POSE) return CTX_MODE_POSE;
			else if(ob->mode & OB_MODE_SCULPT)  return CTX_MODE_SCULPT;
			else if(ob->mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT;
			else if(ob->mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX;
			else if(ob->mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE;
			else if(ob->mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE;
		}
	}

	return CTX_MODE_OBJECT;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:37,代码来源:context.c


示例13: edbm_bevel_init

static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
{
	Object *obedit = CTX_data_edit_object(C);
	Scene *scene = CTX_data_scene(C);
	BMEditMesh *em = BKE_editmesh_from_object(obedit);
	BevelData *opdata;

	if (em->bm->totvertsel == 0) {
		return false;
	}

	op->customdata = opdata = MEM_mallocN(sizeof(BevelData), "beveldata_mesh_operator");

	opdata->em = em;
	opdata->is_modal = is_modal;
	opdata->shift_factor = -1.0f;

	initNumInput(&opdata->num_input);
	opdata->num_input.idx_max = 0;
	opdata->num_input.val_flag[0] |= NUM_NO_NEGATIVE;
	opdata->num_input.unit_sys = scene->unit.system;
	opdata->num_input.unit_type[0] = B_UNIT_NONE;  /* Not sure this is a factor or a unit? */

	/* avoid the cost of allocating a bm copy */
	if (is_modal) {
		View3D *v3d = CTX_wm_view3d(C);
		ARegion *ar = CTX_wm_region(C);

		opdata->mesh_backup = EDBM_redo_state_store(em);
		opdata->draw_handle_pixel = ED_region_draw_cb_activate(ar->type, ED_region_draw_mouse_line_cb, opdata->mcenter, REGION_DRAW_POST_PIXEL);
		G.moving = G_TRANSFORM_EDIT;
		opdata->twtype = v3d->twtype;
		v3d->twtype = 0;
	}

	return true;
}
开发者ID:jonntd,项目名称:blender,代码行数:37,代码来源:editmesh_bevel.c


示例14: armature_dissolve_selected_exec

static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
	bArmature *arm;
	EditBone *ebone, *ebone_next;
	Object *obedit = CTX_data_edit_object(C);
	bool changed = false;

	/* store for mirror */
	GHash *ebone_flag_orig = NULL;
	int ebone_num = 0;

	arm = obedit->data;

	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
		ebone->temp.p = NULL;
		ebone->flag &= ~BONE_DONE;
		ebone_num++;
	}

	if (arm->flag & ARM_MIRROR_EDIT) {
		GHashIterator gh_iter;

		ebone_flag_orig = BLI_ghash_ptr_new_ex(__func__, ebone_num);
		for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
			union { int flag; void *p; } val = {0};
			val.flag = ebone->flag;
			BLI_ghash_insert(ebone_flag_orig, ebone, val.p);
		}

		armature_select_mirrored_ex(arm, BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);

		GHASH_ITER (gh_iter, ebone_flag_orig) {
			union { int flag; void *p; } *val_p = (void *)BLI_ghashIterator_getValue_p(&gh_iter);
			ebone = BLI_ghashIterator_getKey(&gh_iter);
			val_p->flag = ebone->flag & ~val_p->flag;
		}
	}
开发者ID:Ichthyostega,项目名称:blender,代码行数:37,代码来源:armature_edit.c


示例15: uiTemplateEditModeSelection

void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
{
	Object *obedit = CTX_data_edit_object(C);
	uiBlock *block = uiLayoutGetBlock(layout);

	uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);

	if (obedit && (obedit->type == OB_MESH)) {
		BMEditMesh *em = BKE_editmesh_from_object(obedit);
		uiLayout *row;

		row = uiLayoutRow(layout, true);
		block = uiLayoutGetBlock(row);
		uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL,
		                 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
		                 TIP_("Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
		uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL,
		                 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
		                 TIP_("Edge select - Shift-Click for multiple modes, Ctrl-Click expands/contracts selection"));
		uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL,
		                 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
		                 TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
	}
}
开发者ID:manwapastorelli,项目名称:blender-git,代码行数:24,代码来源:view3d_header.c


示例16: navmesh_face_copy_exec

static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
{
	Object *obedit= CTX_data_edit_object(C);
	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);

	/* do work here */
	EditFace *efa_act= EM_get_actFace(em, 0);

	if(efa_act) {
		if(CustomData_has_layer(&em->fdata, CD_RECAST)) {
			EditFace *efa;
			int targetPolyIdx= *(int*)CustomData_em_get(&em->fdata, efa_act->data, CD_RECAST);
			targetPolyIdx= targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx;

			if(targetPolyIdx > 0) {
				/* set target poly idx to other selected faces */
				for (efa= (EditFace *)em->faces.first; efa; efa= efa->next) {
					if((efa->f & SELECT) && efa != efa_act)  {
						int* recastDataBlock= (int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST);
						*recastDataBlock= targetPolyIdx;
					}
				}
			}
			else {
				BKE_report(op->reports, RPT_ERROR, "Active face has no index set");
			}
		}
	}

	DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);

	BKE_mesh_end_editmesh((Mesh*)obedit->data, em);

	return OPERATOR_FINISHED;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:36,代码来源:mesh_navmesh.c


示例17: mball_select_all_exec

/* Select or deselect all MetaElements */
static int mball_select_all_exec(bContext *C, wmOperator *op)
{
	Object *obedit = CTX_data_edit_object(C);
	MetaBall *mb = (MetaBall *)obedit->data;
	MetaElem *ml;
	int action = RNA_enum_get(op->ptr, "action");

	if (mb->editelems->first == NULL)
		return OPERATOR_CANCELLED;

	if (action == SEL_TOGGLE) {
		action = SEL_SELECT;
		for (ml = mb->editelems->first; ml; ml = ml->next) {
			if (ml->flag & SELECT) {
				action = SEL_DESELECT;
				break;
			}
		}
	}

	switch (action) {
		case SEL_SELECT:
			BKE_mball_select_all(mb);
			break;
		case SEL_DESELECT:
			BKE_mball_deselect_all(mb);
			break;
		case SEL_INVERT:
			BKE_mball_select_swap(mb);
			break;
	}

	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);

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


示例18: screen_render_invoke

/* using context, starts job */
static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	/* new render clears all callbacks */
	Main *mainp;
	Scene *scene = CTX_data_scene(C);
	SceneRenderLayer *srl = NULL;
	View3D *v3d = CTX_wm_view3d(C);
	Render *re;
	wmJob *wm_job;
	RenderJob *rj;
	Image *ima;
	int jobflag;
	const short is_animation = RNA_boolean_get(op->ptr, "animation");
	const short is_write_still = RNA_boolean_get(op->ptr, "write_still");
	struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
	const char *name;
	Object *active_object = CTX_data_active_object(C);
	
	/* only one render job at a time */
	if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
		return OPERATOR_CANCELLED;

	if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
		return OPERATOR_CANCELLED;
	}

	if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
		BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
		return OPERATOR_CANCELLED;
	}
	
	/* stop all running jobs, except screen one. currently previews frustrate Render */
	WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C));

	/* get main */
	if (G.debug_value == 101) {
		/* thread-safety experiment, copy main from the undo buffer */
		mainp = BKE_undo_get_main(&scene);
	}
	else
		mainp = CTX_data_main(C);

	/* cancel animation playback */
	if (ED_screen_animation_playing(CTX_wm_manager(C)))
		ED_screen_animation_play(C, 0, 0);
	
	/* handle UI stuff */
	WM_cursor_wait(1);

	/* flush multires changes (for sculpt) */
	multires_force_render_update(active_object);

	/* flush changes from dynamic topology sculpt */
	sculptsession_bm_to_me_for_render(active_object);

	/* cleanup sequencer caches before starting user triggered render.
	 * otherwise, invalidated cache entries can make their way into
	 * the output rendering. We can't put that into RE_BlenderFrame,
	 * since sequence rendering can call that recursively... (peter) */
	BKE_sequencer_cache_cleanup();

	/* get editmode results */
	ED_object_editmode_load(CTX_data_edit_object(C));

	// store spare
	// get view3d layer, local layer, make this nice api call to render
	// store spare

	/* ensure at least 1 area shows result */
	render_view_open(C, event->x, event->y);

	jobflag = WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS;
	
	/* custom scene and single layer re-render */
	screen_render_scene_layer_set(op, mainp, &scene, &srl);

	if (RNA_struct_property_is_set(op->ptr, "layer"))
		jobflag |= WM_JOB_SUSPEND;

	/* job custom data */
	rj = MEM_callocN(sizeof(RenderJob), "render job");
	rj->main = mainp;
	rj->scene = scene;
	rj->win = CTX_wm_window(C);
	rj->srl = srl;
	rj->camera_override = camera_override;
	rj->lay = scene->lay;
	rj->anim = is_animation;
	rj->write_still = is_write_still && !is_animation;
	rj->iuser.scene = scene;
	rj->iuser.ok = 1;
	rj->reports = op->reports;

	if (v3d) {
		rj->lay = v3d->lay;

		if (v3d->localvd)
			rj->lay |= v3d->localvd->lay;
	}
//.........这里部分代码省略.........
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:101,代码来源:render_internal.c


示例19: CTX_data_edit_object

static void *get_data(bContext *C)
{
	Object *obedit = CTX_data_edit_object(C);
	return metaball_get_editelems(obedit);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:5,代码来源:mball_edit.c


示例20: mouse_mball

/* Select MetaElement with mouse click (user can select radius circle or
 * stiffness circle) */
int mouse_mball(bContext *C, const int mval[2], int extend, int deselect, int toggle)
{
	static MetaElem *startelem = NULL;
	Object *obedit = CTX_data_edit_object(C);
	ViewContext vc;
	MetaBall *mb = (MetaBall *)obedit->data;
	MetaElem *ml, *ml_act = NULL;
	int a, hits;
	unsigned int buffer[4 * MAXPICKBUF];
	rcti rect;

	view3d_set_viewcontext(C, &vc);

	rect.xmin = mval[0] - 12;
	rect.xmax = mval[0] + 12;
	rect.ymin = mval[1] - 12;
	rect.ymax = mval[1] + 12;

	hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);

	/* does startelem exist? */
	ml = mb->editelems->first;
	while (ml) {
		if (ml == startelem) break;
		ml = ml->next;
	}

	if (ml == NULL) startelem = mb->editelems->first;
	
	if (hits > 0) {
		ml = startelem;
		while (ml) {
			for (a = 0; a < hits; a++) {
				/* index converted for gl stuff */
				if (ml->selcol1 == buffer[4 * a + 3]) {
					ml->flag |= MB_SCALE_RAD;
					ml_act = ml;
				}
				if (ml->selcol2 == buffer[4 * a + 3]) {
					ml->flag &= ~MB_SCALE_RAD;
					ml_act = ml;
				}
			}
			if (ml_act) break;
			ml = ml->next;
			if (ml == NULL) ml = mb->editelems->first;
			if (ml == startelem) break;
		}
		
		/* When some metaelem was found, then it is necessary to select or
		 * deselect it. */
		if (ml_act) {
			if (extend) {
				ml_act->flag |= SELECT;
			}
			else if (deselect) {
				ml_act->flag &= ~SELECT;
			}
			else if (toggle) {
				if (ml_act->flag & SELECT)
					ml_act->flag &= ~SELECT;
				else
					ml_act->flag |= SELECT;
			}
			else {
				/* Deselect all existing metaelems */
				BKE_mball_deselect_all(mb);

				/* Select only metaelem clicked on */
				ml_act->flag |= SELECT;
			}
			
			mb->lastelem = ml_act;
			
			WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);

			return 1;
		}
	}

	return 0;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:84,代码来源:mball_edit.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CTX_data_main函数代码示例发布时间:2022-05-30
下一篇:
C++ CTX_data_edit_mask函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap