这篇教程C++ ED_object_context函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ED_object_context函数的典型用法代码示例。如果您正苦于以下问题:C++ ED_object_context函数的具体用法?C++ ED_object_context怎么用?C++ ED_object_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ED_object_context函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: disconnect_hair_execstatic int disconnect_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; int all = RNA_boolean_get(op->ptr, "all"); if (!ob) return OPERATOR_CANCELLED; if (all) { for (psys=ob->particlesystem.first; psys; psys=psys->next) { disconnect_hair(scene, ob, psys); } } else { psys = ptr.data; disconnect_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:244xiao,项目名称:blender,代码行数:26,
示例2: surface_slot_add_execstatic int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op)){ DynamicPaintModifierData *pmd = NULL; Object *cObject = ED_object_context(C); DynamicPaintCanvasSettings *canvas; DynamicPaintSurface *surface; /* Make sure we're dealing with a canvas */ pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint); if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED; canvas = pmd->canvas; surface = dynamicPaint_createNewSurface(canvas, CTX_data_scene(C)); if (!surface) return OPERATOR_CANCELLED; /* set preview for this surface only and set active */ canvas->active_sur = 0; for (surface = surface->prev; surface; surface = surface->prev) { surface->flags &= ~MOD_DPAINT_PREVIEW; canvas->active_sur++; } return OPERATOR_FINISHED;}
开发者ID:mgschwan,项目名称:blensor,代码行数:27,
示例3: dynamicPaint_initBake/* * Bake Dynamic Paint image sequence surface */static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op){ DynamicPaintModifierData *pmd = NULL; DynamicPaintCanvasSettings *canvas; Object *ob = ED_object_context(C); int status = 0; double timer = PIL_check_seconds_timer(); DynamicPaintSurface *surface; /* * Get modifier data */ pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint); if (!pmd) { BKE_report(op->reports, RPT_ERROR, "Bake failed: no Dynamic Paint modifier found"); return 0; } /* Make sure we're dealing with a canvas */ canvas = pmd->canvas; if (!canvas) { BKE_report(op->reports, RPT_ERROR, "Bake failed: invalid canvas"); return 0; } surface = get_activeSurface(canvas); /* Set state to baking and init surface */ canvas->error[0] = '/0'; canvas->flags |= MOD_DPAINT_BAKING; G.is_break = FALSE; /* reset blender_test_break*/ /* Bake Dynamic Paint */ status = dynamicPaint_bakeImageSequence(C, surface, ob); /* Clear bake */ canvas->flags &= ~MOD_DPAINT_BAKING; WM_cursor_restore(CTX_wm_window(C)); dynamicPaint_freeSurfaceData(surface); /* Bake was successful: * Report for ended bake and how long it took */ if (status) { /* Format time string */ char time_str[30]; double time = PIL_check_seconds_timer() - timer; BLI_timestr(time, time_str); /* Show bake info */ BKE_reportf(op->reports, RPT_INFO, "Bake complete! (%s)", time_str); } else { if (strlen(canvas->error)) { /* If an error occurred */ BKE_reportf(op->reports, RPT_ERROR, "Bake failed: %s", canvas->error); } else { /* User canceled the bake */ BKE_report(op->reports, RPT_WARNING, "Baking canceled!"); } } return status;}
开发者ID:danielmarg,项目名称:blender-main,代码行数:63,
示例4: connect_hair_execstatic 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,
示例5: surface_slot_remove_execstatic int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op)){ DynamicPaintModifierData *pmd = NULL; Object *obj_ctx = ED_object_context(C); DynamicPaintCanvasSettings *canvas; DynamicPaintSurface *surface; int id = 0; /* Make sure we're dealing with a canvas */ pmd = (DynamicPaintModifierData *)modifiers_findByType(obj_ctx, eModifierType_DynamicPaint); if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED; canvas = pmd->canvas; surface = canvas->surfaces.first; /* find active surface and remove it */ for (; surface; surface = surface->next) { if (id == canvas->active_sur) { canvas->active_sur -= 1; dynamicPaint_freeSurface(surface); break; } id++; } dynamicPaint_resetPreview(canvas); DAG_id_tag_update(&obj_ctx->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obj_ctx); return OPERATOR_FINISHED;}
开发者ID:mgschwan,项目名称:blensor,代码行数:31,
示例6: ED_object_context/* can be called with C == NULL */static EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free){ Object *ob; EnumPropertyItem *item = NULL, item_tmp = {0}; int totitem = 0; if (C == NULL) { return DummyRNA_NULL_items; } ob = ED_object_context(C); /* check that the action exists */ if (ob) { Group *group = NULL; int i = 0; while ((group = BKE_group_object_find(group, ob))) { item_tmp.identifier = item_tmp.name = group->id.name + 2; /* item_tmp.icon = ICON_ARMATURE_DATA; */ item_tmp.value = i; RNA_enum_item_add(&item, &totitem, &item_tmp); i++; } } RNA_enum_item_end(&item, &totitem); *free = 1; return item;}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:32,
示例7: particle_system_remove_execstatic int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)){ Object *ob = ED_object_context(C); Scene *scene = CTX_data_scene(C); int mode_orig; if (!scene || !ob) return OPERATOR_CANCELLED; mode_orig = ob->mode; object_remove_particle_system(scene, ob); /* possible this isn't the active object * object_remove_particle_system() clears the mode on the last psys */ if (mode_orig & OB_MODE_PARTICLE_EDIT) { if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) { if (scene->basact && scene->basact->object == ob) { WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); } } } WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob); return OPERATOR_FINISHED;}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:28,
示例8: shape_key_move_execstatic int shape_key_move_exec(bContext *C, wmOperator *op){ Object *ob = ED_object_context(C); Key *key = BKE_key_from_object(ob); const int type = RNA_enum_get(op->ptr, "type"); const int totkey = key->totkey; const int act_index = ob->shapenr - 1; int new_index; switch (type) { case KB_MOVE_TOP: /* Replace the ref key only if we're at the top already (only for relative keys) */ new_index = (ELEM(act_index, 0, 1) || key->type == KEY_NORMAL) ? 0 : 1; break; case KB_MOVE_BOTTOM: new_index = totkey - 1; break; case KB_MOVE_UP: case KB_MOVE_DOWN: default: new_index = (totkey + act_index + type) % totkey; break; } if (!BKE_keyblock_move(ob, act_index, new_index)) { return OPERATOR_CANCELLED; } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED;}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:34,
示例9: type_toggle_execstatic int type_toggle_exec(bContext *C, wmOperator *op){ Object *cObject = ED_object_context(C); Scene *scene = CTX_data_scene(C); DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint); int type = RNA_enum_get(op->ptr, "type"); if (!pmd) return OPERATOR_CANCELLED; /* if type is already enabled, toggle it off */ if (type == MOD_DYNAMICPAINT_TYPE_CANVAS && pmd->canvas) { dynamicPaint_freeCanvas(pmd); } else if (type == MOD_DYNAMICPAINT_TYPE_BRUSH && pmd->brush) { dynamicPaint_freeBrush(pmd); } /* else create a new type */ else { if (!dynamicPaint_createType(pmd, type, scene)) return OPERATOR_CANCELLED; } /* update dependency */ DAG_id_tag_update(&cObject->id, OB_RECALC_DATA); DAG_relations_tag_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, cObject); return OPERATOR_FINISHED;}
开发者ID:mgschwan,项目名称:blensor,代码行数:30,
示例10: shape_key_move_pollstatic int shape_key_move_poll(bContext *C){ /* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */ Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; Key *key = BKE_key_from_object(ob); return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT && key && key->totkey > 1);}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:9,
示例11: shape_key_add_execstatic int shape_key_add_exec(bContext *C, wmOperator *op){ Scene *scene = CTX_data_scene(C); Object *ob = ED_object_context(C); const bool from_mix = RNA_boolean_get(op->ptr, "from_mix"); ED_object_shape_key_add(C, scene, ob, from_mix); return OPERATOR_FINISHED;}
开发者ID:caomw,项目名称:blender-ui,代码行数:10,
示例12: shape_key_mode_exists_pollstatic int shape_key_mode_exists_poll(bContext *C){ Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; /* same as shape_key_mode_poll */ return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT) && /* check a keyblock exists */ (BKE_keyblock_from_object(ob) != NULL);}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:10,
示例13: object_lod_remove_execstatic int object_lod_remove_exec(bContext *C, wmOperator *op){ Object *ob = ED_object_context(C); int index = RNA_int_get(op->ptr, "index"); if (!BKE_object_lod_remove(ob, index)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_OBJECT | ND_LOD, CTX_wm_view3d(C)); return OPERATOR_FINISHED;}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:11,
示例14: shape_key_add_execstatic int shape_key_add_exec(bContext *C, wmOperator *op){ Object *ob = ED_object_context(C); const bool from_mix = RNA_boolean_get(op->ptr, "from_mix"); ED_object_shape_key_add(C, ob, from_mix); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); DAG_relations_tag_update(CTX_data_main(C)); return OPERATOR_FINISHED;}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:12,
示例15: object_lod_add_execstatic int object_lod_add_exec(bContext *C, wmOperator *UNUSED(op)){ Object *ob = ED_object_context(C);#ifdef WITH_GAMEENGINE BKE_object_lod_add(ob);#else (void)ob;#endif return OPERATOR_FINISHED;}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:12,
示例16: dynamicpaint_bake_exec/* * Bake Dynamic Paint image sequence surface */static int dynamicpaint_bake_exec(struct bContext *C, struct wmOperator *op){ DynamicPaintModifierData *pmd = NULL; DynamicPaintCanvasSettings *canvas; Object *ob = ED_object_context(C); Scene *scene = CTX_data_scene(C); DynamicPaintSurface *surface; /* * Get modifier data */ pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint); if (!pmd) { BKE_report(op->reports, RPT_ERROR, "Bake failed: no Dynamic Paint modifier found"); return OPERATOR_CANCELLED; } /* Make sure we're dealing with a canvas */ canvas = pmd->canvas; if (!canvas) { BKE_report(op->reports, RPT_ERROR, "Bake failed: invalid canvas"); return OPERATOR_CANCELLED; } surface = get_activeSurface(canvas); /* Set state to baking and init surface */ canvas->error[0] = '/0'; canvas->flags |= MOD_DPAINT_BAKING; DynamicPaintBakeJob *job = MEM_mallocN(sizeof(DynamicPaintBakeJob), "DynamicPaintBakeJob"); job->bmain = CTX_data_main(C); job->scene = scene; job->ob = ob; job->canvas = canvas; job->surface = surface; wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Dynamic Paint Bake", WM_JOB_PROGRESS, WM_JOB_TYPE_DPAINT_BAKE); WM_jobs_customdata_set(wm_job, job, dpaint_bake_free); WM_jobs_timer(wm_job, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER); WM_jobs_callbacks(wm_job, dpaint_bake_startjob, NULL, NULL, dpaint_bake_endjob); WM_set_locked_interface(CTX_wm_manager(C), true); /* Bake Dynamic Paint */ WM_jobs_start(CTX_wm_manager(C), wm_job); return OPERATOR_FINISHED;}
开发者ID:mgschwan,项目名称:blensor,代码行数:55,
示例17: shape_key_mirror_execstatic int shape_key_mirror_exec(bContext *C, wmOperator *op){ Object *ob = ED_object_context(C); int totmirr = 0, totfail = 0; bool use_topology = RNA_boolean_get(op->ptr, "use_topology"); if (!object_shape_key_mirror(C, ob, &totmirr, &totfail, use_topology)) return OPERATOR_CANCELLED; ED_mesh_report_mirror(op, totmirr, totfail); return OPERATOR_FINISHED;}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:13,
示例18: objects_add_active_execstatic int objects_add_active_exec(bContext *C, wmOperator *op){ Object *ob = ED_object_context(C); Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); int single_group_index = RNA_enum_get(op->ptr, "group"); Group *single_group = group_object_active_find_index(ob, single_group_index); Group *group; bool is_cycle = false; bool updated = false; if (ob == NULL) return OPERATOR_CANCELLED; /* now add all selected objects to the group(s) */ for (group = bmain->group.first; group; group = group->id.next) { if (single_group && group != single_group) continue; if (!BKE_group_object_exists(group, ob)) continue; /* for recursive check */ BKE_main_id_tag_listbase(&bmain->group, true); CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (group_link_early_exit_check(group, base->object)) continue; if (base->object->dup_group != group && !check_group_contains_object_recursive(group, base->object)) { BKE_group_object_add(group, base->object, scene, base); updated = true; } else { is_cycle = true; } } CTX_DATA_END; } if (is_cycle) BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected"); if (!updated) return OPERATOR_CANCELLED; DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); return OPERATOR_FINISHED;}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:51,
示例19: particle_system_add_execstatic int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op)){ Object *ob= ED_object_context(C); Scene *scene = CTX_data_scene(C); if (!scene || !ob) return OPERATOR_CANCELLED; object_add_particle_system(scene, ob, NULL); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob); return OPERATOR_FINISHED;}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:15,
示例20: CTX_wm_area/* matches logic with ED_operator_posemode_context() */Object *ED_pose_object_from_context(bContext *C){ ScrArea *sa = CTX_wm_area(C); Object *ob; /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa && sa->spacetype == SPACE_BUTS) { ob = ED_object_context(C); } else { ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); } return ob;}
开发者ID:Moguri,项目名称:blender,代码行数:16,
示例21: shape_key_clear_execstatic int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op)){ Object *ob = ED_object_context(C); Key *key = BKE_key_from_object(ob); KeyBlock *kb = BKE_keyblock_from_object(ob); if (!key || !kb) return OPERATOR_CANCELLED; for (kb = key->block.first; kb; kb = kb->next) kb->curval = 0.0f; DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED;}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:17,
示例22: pose_de_select_all_execstatic int pose_de_select_all_exec(bContext *C, wmOperator *op){ int action = RNA_enum_get(op->ptr, "action"); Scene *scene = CTX_data_scene(C); Object *ob = ED_object_context(C); bArmature *arm = ob->data; int multipaint = scene->toolsettings->multipaint; if (action == SEL_TOGGLE) { action = CTX_DATA_COUNT(C, selected_pose_bones) ? SEL_DESELECT : SEL_SELECT; } /* Set the flags */ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) { /* select pchan only if selectable, but deselect works always */ switch (action) { case SEL_SELECT: if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) pchan->bone->flag |= BONE_SELECTED; break; case SEL_DESELECT: pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); break; case SEL_INVERT: if (pchan->bone->flag & BONE_SELECTED) { pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } else if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) { pchan->bone->flag |= BONE_SELECTED; } break; } } CTX_DATA_END; WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, NULL); /* weightpaint or mask modifiers need depsgraph updates */ if (multipaint || (arm->flag & ARM_HAS_VIZ_DEPS)) { DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } return OPERATOR_FINISHED;}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:46,
示例23: ED_object_context/* can be called with C == NULL */static EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free){ Object *ob; EnumPropertyItem *item = NULL, item_tmp = {0}; int totitem = 0; if (C == NULL) { return DummyRNA_NULL_items; } ob = ED_object_context(C); /* check that the object exists */ if (ob) { Group *group; int i = 0, count = 0; /* if 2 or more groups, add option to add to all groups */ group = NULL; while ((group = BKE_group_object_find(group, ob))) count++; if (count >= 2) { item_tmp.identifier = item_tmp.name = "All Groups"; item_tmp.value = INT_MAX; /* this will give NULL on lookup */ RNA_enum_item_add(&item, &totitem, &item_tmp); RNA_enum_item_add_separator(&item, &totitem); } /* add groups */ group = NULL; while ((group = BKE_group_object_find(group, ob))) { item_tmp.identifier = item_tmp.name = group->id.name + 2; /* item_tmp.icon = ICON_ARMATURE_DATA; */ item_tmp.value = i; RNA_enum_item_add(&item, &totitem, &item_tmp); i++; } } RNA_enum_item_end(&item, &totitem); *r_free = true; return item;}
开发者ID:LucaRood,项目名称:Blender,代码行数:46,
示例24: pose_de_select_all_execstatic int pose_de_select_all_exec(bContext *C, wmOperator *op){ int action = RNA_enum_get(op->ptr, "action"); Scene *scene = CTX_data_scene(C); Object *ob = ED_object_context(C); bArmature *arm = ob->data; int multipaint = scene->toolsettings->multipaint; if (action == SEL_TOGGLE) { action = CTX_DATA_COUNT(C, selected_pose_bones) ? SEL_DESELECT : SEL_SELECT; } /* Set the flags */ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) { pose_do_bone_select(pchan, action); }
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:18,
示例25: objects_add_active_execstatic int objects_add_active_exec(bContext *C, wmOperator *op){ Object *ob = ED_object_context(C); Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); int group_object_index = RNA_enum_get(op->ptr, "group"); int is_cycle = FALSE; if (ob) { Group *group = group_object_active_find_index(ob, group_object_index); /* now add all selected objects from the group */ if (group) { /* for recursive check */ tag_main_lb(&bmain->group, TRUE); CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (group_link_early_exit_check(group, base->object)) continue; if (base->object->dup_group != group && !check_group_contains_object_recursive(group, base->object)) { BKE_group_object_add(group, base->object, scene, base); } else { is_cycle = TRUE; } } CTX_DATA_END; if (is_cycle) { BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected"); } DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL); return OPERATOR_FINISHED; } } return OPERATOR_CANCELLED;}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:44,
示例26: shape_key_retime_exec/* starting point and step size could be optional */static int shape_key_retime_exec(bContext *C, wmOperator *UNUSED(op)){ Object *ob = ED_object_context(C); Key *key = BKE_key_from_object(ob); KeyBlock *kb = BKE_keyblock_from_object(ob); float cfra = 0.0f; if (!key || !kb) { return OPERATOR_CANCELLED; } for (kb = key->block.first; kb; kb = kb->next) { kb->pos = cfra; cfra += 0.1f; } DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED;}
开发者ID:dfelinto,项目名称:blender,代码行数:22,
示例27: shape_key_remove_execstatic int shape_key_remove_exec(bContext *C, wmOperator *op){ Main *bmain = CTX_data_main(C); Object *ob = ED_object_context(C); bool changed = false; if (RNA_boolean_get(op->ptr, "all")) { changed = ED_object_shape_key_remove_all(bmain, ob); } else { changed = ED_object_shape_key_remove(bmain, ob); } if (changed) { DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); return OPERATOR_FINISHED; } else { return OPERATOR_CANCELLED; }}
开发者ID:caomw,项目名称:blender-ui,代码行数:23,
注:本文中的ED_object_context函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ED_region_tag_redraw函数代码示例 C++ ED_context_get_markers函数代码示例 |