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

C++ CTX_data_pointer_get_type函数代码示例

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

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



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

示例1: connect_hair_exec

static int connect_hair_exec(bContext *C, wmOperator *op)
{
	Scene *scene= CTX_data_scene(C);
	Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= NULL;
	int all = RNA_boolean_get(op->ptr, "all");

	if(!ob)
		return OPERATOR_CANCELLED;

	if(all) {
		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
			connect_hair(scene, ob, psys);
		}
	}
	else {
		psys = ptr.data;
		connect_hair(scene, ob, psys);
	}

	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);

	return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:26,代码来源:particle_object.c


示例2: remove_particle_dupliob_exec

static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
{
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= ptr.data;
	ParticleSettings *part;
	ParticleDupliWeight *dw;

	if (!psys)
		return OPERATOR_CANCELLED;

	part = psys->part;
	for (dw=part->dupliweights.first; dw; dw=dw->next) {
		if (dw->flag & PART_DUPLIW_CURRENT) {
			BLI_remlink(&part->dupliweights, dw);
			MEM_freeN(dw);
			break;
		}

	}
	dw = part->dupliweights.last;

	if (dw)
		dw->flag |= PART_DUPLIW_CURRENT;

	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
	
	return OPERATOR_FINISHED;
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:28,代码来源:particle_object.c


示例3: remove_particle_target_exec

static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
	Main *bmain = CTX_data_main(C);
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= ptr.data;
	Object *ob = ptr.id.data;

	ParticleTarget *pt;

	if (!psys)
		return OPERATOR_CANCELLED;

	pt = psys->targets.first;
	for (; pt; pt=pt->next) {
		if (pt->flag & PTARGET_CURRENT) {
			BLI_remlink(&psys->targets, pt);
			MEM_freeN(pt);
			break;
		}

	}
	pt = psys->targets.last;

	if (pt)
		pt->flag |= PTARGET_CURRENT;

	DAG_relations_tag_update(bmain);
	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);

	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
	
	return OPERATOR_FINISHED;
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:33,代码来源:particle_object.c


示例4: new_particle_target_exec

static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
	Main *bmain = CTX_data_main(C);
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= ptr.data;
	Object *ob = ptr.id.data;

	ParticleTarget *pt;

	if (!psys)
		return OPERATOR_CANCELLED;

	pt = psys->targets.first;
	for (; pt; pt=pt->next)
		pt->flag &= ~PTARGET_CURRENT;

	pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");

	pt->flag |= PTARGET_CURRENT;
	pt->psys = 1;

	BLI_addtail(&psys->targets, pt);

	DAG_relations_tag_update(bmain);
	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);

	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
	
	return OPERATOR_FINISHED;
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:30,代码来源:particle_object.c


示例5: new_particle_settings_exec

static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
{
	Main *bmain= CTX_data_main(C);
	ParticleSystem *psys;
	ParticleSettings *part = NULL;
	Object *ob;
	PointerRNA ptr;

	ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);

	psys = ptr.data;

	/* add or copy particle setting */
	if (psys->part)
		part= BKE_particlesettings_copy(psys->part);
	else
		part= psys_new_settings("ParticleSettings", bmain);

	ob= ptr.id.data;

	if (psys->part)
		psys->part->id.us--;

	psys->part = part;

	psys_check_boid_data(psys);

	DAG_relations_tag_update(bmain);
	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);

	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
	
	return OPERATOR_FINISHED;
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:34,代码来源:particle_object.c


示例6: MEM_callocN

static PTCacheBaker *ptcache_baker_create(bContext *C, wmOperator *op, bool all)
{
	PTCacheBaker *baker = MEM_callocN(sizeof(PTCacheBaker), "PTCacheBaker");

	baker->main = CTX_data_main(C);
	baker->scene = CTX_data_scene(C);
	baker->bake = RNA_boolean_get(op->ptr, "bake");
	baker->render = 0;
	baker->anim_init = 0;
	baker->quick_step = 1;

	if (!all) {
		PointerRNA ptr = CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
		Object *ob = ptr.id.data;
		PointCache *cache = ptr.data;

		ListBase pidlist;
		BKE_ptcache_ids_from_object(&pidlist, ob, baker->scene, MAX_DUPLI_RECUR);

		for (PTCacheID *pid = pidlist.first; pid; pid = pid->next) {
			if (pid->cache == cache) {
				baker->pid = *pid;
				break;
			}
		}

		BLI_freelistN(&pidlist);
	}

	return baker;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:31,代码来源:physics_pointcache.c


示例7: connect_hair_exec

static int connect_hair_exec(bContext *C, wmOperator *op)
{
	Scene *scene= CTX_data_scene(C);
	Object *ob= ED_object_context(C);
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= NULL;
	const bool all = RNA_boolean_get(op->ptr, "all");
	bool any_connected = false;

	if (!ob)
		return OPERATOR_CANCELLED;

	if (all) {
		for (psys=ob->particlesystem.first; psys; psys=psys->next) {
			any_connected |= connect_hair(scene, ob, psys);
		}
	}
	else {
		psys = ptr.data;
		any_connected |= connect_hair(scene, ob, psys);
	}

	if (!any_connected) {
		BKE_report(op->reports, RPT_ERROR, "Can't disconnect hair if particle system modifier is disabled");
		return OPERATOR_CANCELLED;
	}

	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);

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


示例8: ptcache_remove_exec

static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
	PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
	Scene *scene= CTX_data_scene(C);
	Object *ob= ptr.id.data;
	PointCache *cache= ptr.data;
	PTCacheID *pid;
	ListBase pidlist;

	BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
	
	for(pid=pidlist.first; pid; pid=pid->next) {
		if(pid->cache == cache) {
			if(pid->ptcaches->first == pid->ptcaches->last)
				continue; /* don't delete last cache */

			BLI_remlink(pid->ptcaches, pid->cache);
			BKE_ptcache_free(pid->cache);
			*(pid->cache_ptr) = pid->ptcaches->first;

			break;
		}
	}

	BLI_freelistN(&pidlist);
	
	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);

	return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:30,代码来源:physics_pointcache.c


示例9: vertex_group_menu_exec

static int vertex_group_menu_exec(bContext *C, wmOperator *op)
{
	Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
	uiPopupMenu *pup;
	uiLayout *layout;

	pup= uiPupMenuBegin(C, "Vertex Groups", 0);
	layout= uiPupMenuLayout(pup);
	uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);

	if(vgroup_object_in_edit_mode(ob)) {
		uiItemBooleanO(layout, "Assign to New Group", 0, "OBJECT_OT_vertex_group_assign", "new", 1);

		if(BLI_countlist(&ob->defbase) && ob->actdef) {
			uiItemO(layout, "Assign to Group", 0, "OBJECT_OT_vertex_group_assign");
			uiItemO(layout, "Remove from Group", 0, "OBJECT_OT_vertex_group_remove_from");
			uiItemBooleanO(layout, "Remove from All", 0, "OBJECT_OT_vertex_group_remove_from", "all", 1);
		}
	}

	if(BLI_countlist(&ob->defbase) && ob->actdef) {
		if(vgroup_object_in_edit_mode(ob))
			uiItemS(layout);

		uiItemO(layout, "Set Active Group", 0, "OBJECT_OT_vertex_group_set_active");
		uiItemO(layout, "Remove Group", 0, "OBJECT_OT_vertex_group_remove");
		uiItemBooleanO(layout, "Remove All Groups", 0, "OBJECT_OT_vertex_group_remove", "all", 1);
	}

	uiPupMenuEnd(C, pup);

	return OPERATOR_FINISHED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:33,代码来源:object_vgroup.c


示例10: rule_del_exec

static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
{
	Main *bmain = CTX_data_main(C);
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
	ParticleSettings *part = ptr.data;
	BoidRule *rule;
	BoidState *state;

	if (!part || part->phystype != PART_PHYS_BOIDS)
		return OPERATOR_CANCELLED;

	state = boid_get_current_state(part->boids);

	for (rule=state->rules.first; rule; rule=rule->next) {
		if (rule->flag & BOIDRULE_CURRENT) {
			BLI_remlink(&state->rules, rule);
			MEM_freeN(rule);
			break;
		}
	}
	rule = state->rules.first;

	if (rule)
		rule->flag |= BOIDRULE_CURRENT;

	DAG_relations_tag_update(bmain);
	DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);

	return OPERATOR_FINISHED;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:30,代码来源:particle_boids.c


示例11: rule_move_down_exec

static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= ptr.data;
	Object *ob = ptr.id.data;
	BoidRule *rule;
	BoidState *state;

	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
		return OPERATOR_CANCELLED;
	
	state = boid_get_current_state(psys->part->boids);
	for(rule = state->rules.first; rule; rule=rule->next) {
		if(rule->flag & BOIDRULE_CURRENT && rule->next) {
			BLI_remlink(&state->rules, rule);
			BLI_insertlink(&state->rules, rule->next, rule);

			DAG_id_tag_update(&psys->part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
			break;
		}
	}
	
	return OPERATOR_FINISHED;
}
开发者ID:mik0001,项目名称:Blender,代码行数:25,代码来源:particle_boids.c


示例12: edit_controller_poll

static int edit_controller_poll(bContext *C)
{
    PointerRNA ptr = CTX_data_pointer_get_type(C, "controller", &RNA_Controller);

    if (ptr.data && ((ID *)ptr.id.data)->lib) return 0;
    return 1;
}
开发者ID:244xiao,项目名称:blender,代码行数:7,代码来源:logic_ops.c


示例13: edit_actuator_poll

static int edit_actuator_poll(bContext *C)
{
    PointerRNA ptr = CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator);

    if (ptr.data && ((ID *)ptr.id.data)->lib) return 0;
    return 1;
}
开发者ID:244xiao,项目名称:blender,代码行数:7,代码来源:logic_ops.c


示例14: rule_add_exec

/************************ add/del boid rule operators *********************/
static int rule_add_exec(bContext *C, wmOperator *op)
{
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
	ParticleSettings *part = ptr.data;
	int type= RNA_enum_get(op->ptr, "type");

	BoidRule *rule;
	BoidState *state;

	if (!part || part->phystype != PART_PHYS_BOIDS)
		return OPERATOR_CANCELLED;

	state = boid_get_current_state(part->boids);

	for (rule=state->rules.first; rule; rule=rule->next)
		rule->flag &= ~BOIDRULE_CURRENT;

	rule = boid_new_rule(type);
	rule->flag |= BOIDRULE_CURRENT;

	BLI_addtail(&state->rules, rule);

	DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
	
	return OPERATOR_FINISHED;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:27,代码来源:particle_boids.c


示例15: edit_actuator_poll

static int edit_actuator_poll(bContext *C)
{
	PointerRNA ptr = CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator);

	if (ptr.data && ID_IS_LINKED_DATABLOCK(ptr.id.data)) return 0;
	return 1;
}
开发者ID:diekev,项目名称:blender,代码行数:7,代码来源:logic_ops.c


示例16: state_del_exec

static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
{
	Main *bmain = CTX_data_main(C);
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
	ParticleSettings *part = ptr.data;
	BoidState *state;

	if (!part || part->phystype != PART_PHYS_BOIDS)
		return OPERATOR_CANCELLED;

	for (state=part->boids->states.first; state; state=state->next) {
		if (state->flag & BOIDSTATE_CURRENT) {
			BLI_remlink(&part->boids->states, state);
			MEM_freeN(state);
			break;
		}
	}

	/* there must be at least one state */
	if (!part->boids->states.first) {
		state = boid_new_state(part->boids);
		BLI_addtail(&part->boids->states, state);
	}
	else
		state = part->boids->states.first;

	state->flag |= BOIDSTATE_CURRENT;

	DAG_relations_tag_update(bmain);
	DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
	
	return OPERATOR_FINISHED;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:33,代码来源:particle_boids.c


示例17: state_add_exec

/************************ add/del boid state operators *********************/
static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
{
	PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
	ParticleSystem *psys= ptr.data;
	Object *ob= ptr.id.data;
	ParticleSettings *part;
	BoidState *state;

	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
		return OPERATOR_CANCELLED;

	part = psys->part;

	for(state=part->boids->states.first; state; state=state->next)
		state->flag &= ~BOIDSTATE_CURRENT;

	state = boid_new_state(part->boids);
	state->flag |= BOIDSTATE_CURRENT;

	BLI_addtail(&part->boids->states, state);

	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
	
	return OPERATOR_FINISHED;
}
开发者ID:mik0001,项目名称:Blender,代码行数:26,代码来源:particle_boids.c


示例18: ptcache_add_new_exec

static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
{
	Scene *scene = CTX_data_scene(C);
	PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
	Object *ob= ptr.id.data;
	PointCache *cache= ptr.data;
	PTCacheID *pid;
	ListBase pidlist;

	BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
	
	for(pid=pidlist.first; pid; pid=pid->next) {
		if(pid->cache == cache) {
			*(pid->cache_ptr) = BKE_ptcache_add(pid->ptcaches);
			break;
		}
	}

	BLI_freelistN(&pidlist);

	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
	WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);

	return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:25,代码来源:physics_pointcache.c


示例19: vertex_group_copy_to_linked_exec

static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *op)
{
	Scene *scene= CTX_data_scene(C);
	Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
	Base *base;
	int retval= OPERATOR_CANCELLED;

	for(base=scene->base.first; base; base= base->next) {
		if(base->object->type==ob->type) {
			if(base->object!=ob && base->object->data==ob->data) {
				BLI_freelistN(&base->object->defbase);
				BLI_duplicatelist(&base->object->defbase, &ob->defbase);
				base->object->actdef= ob->actdef;

				DAG_id_flush_update(&base->object->id, OB_RECALC_DATA);
				WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, base->object);
				WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data);

				retval = OPERATOR_FINISHED;
			}
		}
	}

	return retval;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:25,代码来源:object_vgroup.c


示例20: shape_key_mirror_exec

static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
{
	Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;

	if(!object_shape_key_mirror(C, ob))
		return OPERATOR_CANCELLED;

	return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:9,代码来源:object_shapekey.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CTX_wm_area函数代码示例发布时间:2022-05-30
下一篇:
C++ CTX_data_main函数代码示例发布时间: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