diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-06 09:28:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-06 10:03:28 +0300 |
commit | 5ec016169b80cc8205740a5b3beb12f91be3182b (patch) | |
tree | cf3423e34d0a0d51b72b40d8efd3abe2cf5a5370 /source/blender/editors/interface/interface_templates.c | |
parent | 269ed0a770bf3627ba1e21d87d3d748c0765a531 (diff) |
Object Mode: use eval_ctx for context/screen code
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 32758b7935a..871d2df1e85 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -575,6 +575,9 @@ static void template_ID( bContext *C, uiLayout *layout, TemplateID *template_ui, StructRNA *type, int flag, const char *newop, const char *openop, const char *unlinkop) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + uiBut *but; uiBlock *block; PointerRNA idptr; @@ -659,7 +662,7 @@ static void template_ID( (idfrom && idfrom->lib) || (!editable) || /* object in editmode - don't change data */ - (idfrom && GS(idfrom->name) == ID_OB && (((Object *)idfrom)->mode & OB_MODE_EDIT))) + (idfrom && GS(idfrom->name) == ID_OB && (eval_ctx.object_mode & OB_MODE_EDIT))) { UI_but_flag_enable(but, UI_BUT_DISABLED); } @@ -1207,7 +1210,8 @@ static int modifier_is_simulation(ModifierData *md) } static uiLayout *draw_modifier( - uiLayout *layout, Scene *scene, Object *ob, + uiLayout *layout, + const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -1344,7 +1348,7 @@ static uiLayout *draw_modifier( if (md->type == eModifierType_ParticleSystem) { ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; - if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) { + if (!(eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) { if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE, "OBJECT_OT_duplicates_make_real"); @@ -1393,6 +1397,8 @@ static uiLayout *draw_modifier( uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) { + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); Scene *scene = CTX_data_scene(C); Object *ob; ModifierData *md, *vmd; @@ -1423,7 +1429,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) for (i = 0; vmd; i++, vmd = vmd->next) { if (md == vmd) - return draw_modifier(layout, scene, ob, md, i, cageIndex, lastCageIndex); + return draw_modifier(layout, &eval_ctx, scene, ob, md, i, cageIndex, lastCageIndex); else if (vmd->mode & eModifierMode_Virtual) i--; } |