[Bf-blender-cvs] [73547952a92] blender2.8: Pose: support wpaint+pose w/ object-lock enabled
Campbell Barton
noreply at git.blender.org
Fri Nov 23 00:20:41 CET 2018
Commit: 73547952a9279fbd7932b244edd863bdd78373be
Author: Campbell Barton
Date: Fri Nov 23 10:16:08 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB73547952a9279fbd7932b244edd863bdd78373be
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.
===================================================================
M source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
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
More information about the Bf-blender-cvs
mailing list