diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-06 08:16:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-06 10:03:28 +0300 |
commit | 91db372b486807cec87a7ae3ccfc7bae0af62264 (patch) | |
tree | 7ce53de484c17123e37af3bd7ccce4ef7a481bf1 /source | |
parent | 28dfc47cf0b068d0103986424f79eeea59f2039b (diff) |
Object Mode: pass object mode to CTX_data_mode_enum_ex
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_context.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 16 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 |
3 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 121c276d5f2..7cffc16e13e 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -260,7 +260,9 @@ struct RenderEngineType *CTX_data_engine_type(const bContext *C); struct ToolSettings *CTX_data_tool_settings(const bContext *C); const char *CTX_data_mode_string(const bContext *C); -int CTX_data_mode_enum_ex(const struct Object *obedit, const struct Object *ob); +int CTX_data_mode_enum_ex( + const struct Object *obedit, const struct Object *ob, + const short object_mode); int CTX_data_mode_enum(const bContext *C); void CTX_data_main_set(bContext *C, struct Main *bmain); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index ba69ecfb7f1..86c0b420f34 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -997,7 +997,7 @@ SceneCollection *CTX_data_scene_collection(const bContext *C) return BKE_collection_master(&scene->id); } -int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob) +int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, const short object_mode) { // Object *obedit = CTX_data_edit_object(C); if (obedit) { @@ -1021,12 +1021,12 @@ int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob) else { // Object *ob = CTX_data_active_object(C); if (ob) { - if (ob->mode & OB_MODE_POSE) return CTX_MODE_POSE; - else if (ob->mode & OB_MODE_SCULPT) return CTX_MODE_SCULPT; - else if (ob->mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT; - else if (ob->mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX; - else if (ob->mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE; - else if (ob->mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE; + if (object_mode & OB_MODE_POSE) return CTX_MODE_POSE; + else if (object_mode & OB_MODE_SCULPT) return CTX_MODE_SCULPT; + else if (object_mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT; + else if (object_mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX; + else if (object_mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE; + else if (object_mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE; } } @@ -1037,7 +1037,7 @@ int CTX_data_mode_enum(const bContext *C) { Object *obedit = CTX_data_edit_object(C); Object *obact = obedit ? NULL : CTX_data_active_object(C); - return CTX_data_mode_enum_ex(obedit, obact); + return CTX_data_mode_enum_ex(obedit, obact, obact ? obact->mode : OB_MODE_OBJECT); } /* would prefer if we can use the enum version below over this one - Campbell */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index af42aacbc50..52f47609a23 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -3155,7 +3155,7 @@ static void drw_engines_enable_external(void) static void drw_engines_enable(const Scene *scene, ViewLayer *view_layer, RenderEngineType *engine_type) { Object *obact = OBACT(view_layer); - const int mode = CTX_data_mode_enum_ex(scene->obedit, obact); + const int mode = CTX_data_mode_enum_ex(scene->obedit, obact, DST.draw_ctx.object_mode); drw_engines_enable_from_engine(engine_type); |