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


C++ CTX_data_active_object函数代码示例

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


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

示例1: mask_flood_fill_exec

static int mask_flood_fill_exec(bContext *C, wmOperator *op)
{
	ARegion *ar = CTX_wm_region(C);
	Object *ob = CTX_data_active_object(C);
	PaintMaskFloodMode mode;
	float value;
	DerivedMesh *dm;
	PBVH *pbvh;
	PBVHNode **nodes;
	int totnode, i;

	mode = RNA_enum_get(op->ptr, "mode");
	value = RNA_float_get(op->ptr, "value");

	dm = mesh_get_derived_final(CTX_data_scene(C), ob, CD_MASK_BAREMESH);
	pbvh = dm->getPBVH(ob, dm);
	ob->sculpt->pbvh = pbvh;

	BLI_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);

	sculpt_undo_push_begin("Mask flood fill");

	for (i = 0; i < totnode; i++) {
		PBVHVertexIter vi;

		sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);

		BLI_pbvh_vertex_iter_begin(pbvh, nodes[i], vi, PBVH_ITER_UNIQUE) {
			mask_flood_fill_set_elem(vi.mask, mode, value);
		} BLI_pbvh_vertex_iter_end;
		
		BLI_pbvh_node_mark_update(nodes[i]);
		if (BLI_pbvh_type(pbvh) == PBVH_GRIDS)
			multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
	}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:35,代码来源:paint_mask.c

示例2: action_new_poll

/* Criteria:
 *  1) There must be an dopesheet/action editor, and it must be in a mode which uses actions...
 *        OR
 *     The NLA Editor is active (i.e. Animation Data panel -> new action)
 *  2) The associated AnimData block must not be in tweakmode
 */
static int action_new_poll(bContext *C)
{
	Scene *scene = CTX_data_scene(C);
	
	/* Check tweakmode is off (as you don't want to be tampering with the action in that case) */
	/* NOTE: unlike for pushdown, this operator needs to be run when creating an action from nothing... */	
	if (ED_operator_action_active(C)) {
		SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
		Object *ob = CTX_data_active_object(C);
		
		/* For now, actions are only for the active object, and on object and shapekey levels... */
		if (saction->mode == SACTCONT_ACTION) {
			/* XXX: This assumes that actions are assigned to the active object in this mode */
			if (ob) {
				if ((ob->adt == NULL) || (ob->adt->flag & ADT_NLA_EDIT_ON) == 0)
					return true;
			}
		}
		else if (saction->mode == SACTCONT_SHAPEKEY) {
			Key *key = BKE_key_from_object(ob);
			if (key) {
				if ((key->adt == NULL) || (key->adt->flag & ADT_NLA_EDIT_ON) == 0)
					return true;
			}
		}
	}
	else if (ED_operator_nla_active(C)) {
		if (!(scene->flag & SCE_NLA_EDIT_ON)) {
			return true;
		}
	}
	
	/* something failed... */
	return false;
}
开发者ID:diekev,项目名称:blender,代码行数:41,代码来源:action_data.c

示例3: fluid_bake_exec

static int fluid_bake_exec(bContext *C, wmOperator *op)
{
	if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), false))
		return OPERATOR_CANCELLED;

	return OPERATOR_FINISHED;
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:7,代码来源:physics_fluid.c

示例4: pose_select_parent_exec

static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
{
	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
	bArmature *arm = (bArmature *)ob->data;
	bPoseChannel *pchan, *parent;

	/* Determine if there is an active bone */
	pchan = CTX_data_active_pose_bone(C);
	if (pchan) {
		parent = pchan->parent;
		if ((parent) && !(parent->bone->flag & (BONE_HIDDEN_P | BONE_UNSELECTABLE))) {
			parent->bone->flag |= BONE_SELECTED;
			arm->act_bone = parent->bone;
		}
		else {
			return OPERATOR_CANCELLED;
		}
	}
	else {
		return OPERATOR_CANCELLED;
	}
	
	/* updates */
	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
	
	if (arm->flag & ARM_HAS_VIZ_DEPS) {
		/* mask modifier ('armature' mode), etc. */
		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
	}
	
	return OPERATOR_FINISHED;
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:32,代码来源:pose_select.c

示例5: sculpt_undo_restore_hidden

static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm,
                                      SculptUndoNode *unode)
{
	Object *ob = CTX_data_active_object(C);
	SculptSession *ss = ob->sculpt;
	int i;

	if (unode->maxvert) {
		MVert *mvert = ss->mvert;
		
		for (i = 0; i < unode->totvert; i++) {
			MVert *v = &mvert[unode->index[i]];
			int uval = BLI_BITMAP_GET(unode->vert_hidden, i);

			BLI_BITMAP_MODIFY(unode->vert_hidden, i,
			                  v->flag & ME_HIDE);
			if (uval)
				v->flag |= ME_HIDE;
			else
				v->flag &= ~ME_HIDE;
			
			v->flag |= ME_VERT_PBVH_UPDATE;
		}
	}
	else if (unode->maxgrid && dm->getGridData) {
		BLI_bitmap **grid_hidden = dm->getGridHidden(dm);
		
		for (i = 0; i < unode->totgrid; i++) {
			SWAP(BLI_bitmap *,
			     unode->grid_hidden[i],
			     grid_hidden[unode->grids[i]]);
			
		}
	}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:34,代码来源:sculpt_undo.c

示例6: paint_curve_poll

bool paint_curve_poll(bContext *C)
{
  Object *ob = CTX_data_active_object(C);
  Paint *p;
  RegionView3D *rv3d = CTX_wm_region_view3d(C);
  SpaceImage *sima;

  if (rv3d && !(ob && ((ob->mode & OB_MODE_ALL_PAINT) != 0))) {
    return false;
  }

  sima = CTX_wm_space_image(C);

  if (sima && sima->mode != SI_MODE_PAINT) {
    return false;
  }

  p = BKE_paint_get_active_from_context(C);

  if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
    return true;
  }

  return false;
}
开发者ID:dfelinto,项目名称:blender,代码行数:25,代码来源:paint_curve.c

示例7: pose_calculate_paths_exec

/* For the object with pose/action: create path curves for selected bones 
 * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
 */
static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
{
	Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
	Scene *scene = CTX_data_scene(C);
	
	if (ELEM(NULL, ob, ob->pose))
		return OPERATOR_CANCELLED;
	
	/* grab baking settings from operator settings */
	{
		bAnimVizSettings *avs = &ob->pose->avs;
		PointerRNA avs_ptr;
		
		avs->path_sf = RNA_int_get(op->ptr, "start_frame");
		avs->path_ef = RNA_int_get(op->ptr, "end_frame");
		
		RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
		RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
	}
	
	/* set up path data for bones being calculated */
	CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
	{
		/* verify makes sure that the selected bone has a bone with the appropriate settings */
		animviz_verify_motionpaths(op->reports, scene, ob, pchan);
	}
开发者ID:Moguri,项目名称:blender,代码行数:29,代码来源:pose_edit.c

示例8: face_select_reveal_exec

static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
	Object *ob = CTX_data_active_object(C);
	paintface_reveal(ob);
	ED_region_tag_redraw(CTX_wm_region(C));
	return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:7,代码来源:paint_utils.c

示例9: paint_select_linked_pick_invoke

static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
	int mode= RNA_boolean_get(op->ptr, "extend") ? 1:0;
	select_linked_tfaces(C, CTX_data_active_object(C), event->mval, mode);
	ED_region_tag_redraw(CTX_wm_region(C));
	return OPERATOR_FINISHED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:7,代码来源:paint_utils.c

示例10: ED_preview_shader_job

void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, int method)
{
	Object *ob= CTX_data_active_object(C);
	wmJob *steve;
	ShaderPreview *sp;

	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER);
	sp= MEM_callocN(sizeof(ShaderPreview), "shader preview");

	/* customdata for preview thread */
	sp->scene= CTX_data_scene(C);
	sp->owner= owner;
	sp->sizex= sizex;
	sp->sizey= sizey;
	sp->pr_method= method;
	sp->id = id;
	sp->parent= parent;
	sp->slot= slot;
	if(ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
	else sp->col[0]= sp->col[1]= sp->col[2]= sp->col[3]= 1.0f;
	
	/* setup job */
	WM_jobs_customdata(steve, sp, shader_preview_free);
	WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
	WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
	
	WM_jobs_start(CTX_wm_manager(C), steve);
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:28,代码来源:render_preview.c

示例11: vert_select_all_exec

static int vert_select_all_exec(bContext *C, wmOperator *op)
{
	Object *ob = CTX_data_active_object(C);
	paintvert_deselect_all_visible(ob, RNA_enum_get(op->ptr, "action"), true);
	ED_region_tag_redraw(CTX_wm_region(C));
	return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:7,代码来源:paint_utils.c

示例12: keyingset_context_ok_poll

/* Check if context data is suitable for the given absolute Keying Set */
short keyingset_context_ok_poll (bContext *C, KeyingSet *ks)
{
	ScrArea *sa= CTX_wm_area(C);
	
	/* data retrieved from context depends on active editor */
	if (sa == NULL) return 0;
		
	switch (sa->spacetype) {
		case SPACE_VIEW3D:
		{
			Object *obact= CTX_data_active_object(C);
			
			/* if in posemode, check if 'pose-channels' requested for in KeyingSet */
			if ((obact && obact->pose) && (obact->mode & OB_MODE_POSE)) {
				/* check for posechannels */
				
			}
			else {
				/* check for selected object */
				
			}
		}
			break;
	}
	
	
	return 1;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:29,代码来源:keyingsets.c

示例13: time_draw_keyframes

/* draw keyframe lines for timeline */
static void time_draw_keyframes(const bContext *C, ARegion *ar)
{
	Scene *scene = CTX_data_scene(C);
	Object *ob = CTX_data_active_object(C);
	View2D *v2d = &ar->v2d;
	bool onlysel = ((scene->flag & SCE_KEYS_NO_SELONLY) == 0);
	
	/* set this for all keyframe lines once and for all */
	glLineWidth(1.0);
	
	/* draw grease pencil keyframes (if available) */	
	UI_ThemeColor(TH_TIME_GP_KEYFRAME);
	if (scene->gpd) {
		time_draw_idblock_keyframes(v2d, (ID *)scene->gpd, onlysel);
	}
	if (ob && ob->gpd) {
		time_draw_idblock_keyframes(v2d, (ID *)ob->gpd, onlysel);
	}
	
	/* draw scene keyframes first 
	 *	- don't try to do this when only drawing active/selected data keyframes,
	 *	  since this can become quite slow
	 */
	if (onlysel == 0) {
		/* set draw color */
		UI_ThemeColorShade(TH_TIME_KEYFRAME, -50);
		time_draw_idblock_keyframes(v2d, (ID *)scene, onlysel);
	}
	
	/* draw keyframes from selected objects 
	 *  - only do the active object if in posemode (i.e. showing only keyframes for the bones)
	 *    OR the onlysel flag was set, which means that only active object's keyframes should
	 *    be considered
	 */
	UI_ThemeColor(TH_TIME_KEYFRAME);
	
	if (ob && ((ob->mode == OB_MODE_POSE) || onlysel)) {
		/* draw keyframes for active object only */
		time_draw_idblock_keyframes(v2d, (ID *)ob, onlysel);
	}
	else {
		bool active_done = false;
		
		/* draw keyframes from all selected objects */
		CTX_DATA_BEGIN (C, Object *, obsel, selected_objects)
		{
			/* last arg is 0, since onlysel doesn't apply here... */
			time_draw_idblock_keyframes(v2d, (ID *)obsel, 0);
			
			/* if this object is the active one, set flag so that we don't draw again */
			if (obsel == ob)
				active_done = true;
		}
		CTX_DATA_END;
		
		/* if active object hasn't been done yet, draw it... */
		if (ob && (active_done == 0))
			time_draw_idblock_keyframes(v2d, (ID *)ob, 0);
	}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:60,代码来源:space_time.c

示例14: face_select_hide_exec

static int face_select_hide_exec(bContext *C, wmOperator *op)
{
	const bool unselected = RNA_boolean_get(op->ptr, "unselected");
	Object *ob = CTX_data_active_object(C);
	paintface_hide(ob, unselected);
	ED_region_tag_redraw(CTX_wm_region(C));
	return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:8,代码来源:paint_utils.c

示例15: paint_select_linked_pick_invoke

static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
	const bool select = !RNA_boolean_get(op->ptr, "deselect");
	view3d_operator_needs_opengl(C);
	paintface_select_linked(C, CTX_data_active_object(C), event->mval, select);
	ED_region_tag_redraw(CTX_wm_region(C));
	return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:8,代码来源:paint_utils.c


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