diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 02:16:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 02:19:12 +0300 |
commit | 73547952a9279fbd7932b244edd863bdd78373be (patch) | |
tree | 5aae139ed024a12efa65f2e65e3de7df57c3ae75 /source/blender | |
parent | 7b4f545e282fcd0b2402c45faf13642bc047d1a5 (diff) |
Pose: support wpaint+pose w/ object-lock enabled
Mode locking made it nearly impossible to enter wpaint + object mode.
Now enter pose mode when entering wpaint mode
when the pose object is selected.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index d6aaaf31c21..a604bd5feb6 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -58,6 +58,7 @@ #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" +#include "BKE_modifier.h" #include "BKE_object.h" #include "BKE_object_deform.h" #include "BKE_paint.h" @@ -71,6 +72,7 @@ #include "WM_message.h" #include "WM_toolsystem.h" +#include "ED_armature.h" #include "ED_object.h" #include "ED_mesh.h" #include "ED_screen.h" @@ -1261,6 +1263,21 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) BKE_paint_toolslots_brush_validate(bmain, &ts->wpaint->paint); } + /* When locked, it's almost impossible to select the pose then the object to enter weight paint mode. + * In this case move our pose object in/out of pose mode. + * This is in fits with the convention of selecting multiple objects and entering a mode. */ + if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { + Object *ob_arm = modifiers_isDeformedByArmature(ob); + if (ob_arm && (ob_arm->base_flag & BASE_SELECTED)) { + if (ob_arm->mode & OB_MODE_POSE) { + ED_object_posemode_exit_ex(bmain, ob_arm); + } + else { + ED_object_posemode_enter_ex(bmain, ob_arm); + } + } + } + /* Weightpaint works by overriding colors in mesh, * so need to make sure we recalc on enter and * exit (exit needs doing regardless because we |