本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}