[Bf-blender-cvs] [bf8393c1c9d] master: Fix weight-paint & pose-select & lock-mode combination

Campbell Barton noreply at git.blender.org
Thu Jul 18 07:48:21 CEST 2019


Commit: bf8393c1c9d7af85b8efd0697b9d52747fcc8123
Author: Campbell Barton
Date:   Thu Jul 18 15:31:04 2019 +1000
Branches: master
https://developer.blender.org/rBbf8393c1c9d7af85b8efd0697b9d52747fcc8123

Fix weight-paint & pose-select & lock-mode combination

Extend pose object checks to all pose-mode objects
used by the mesh.

===================================================================

M	source/blender/editors/space_view3d/view3d_view.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 5865efa0ffa..c0902cd1cd5 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -30,6 +30,7 @@
 #include "BLI_math.h"
 #include "BLI_rect.h"
 #include "BLI_utildefines.h"
+#include "BLI_linklist.h"
 
 #include "BKE_action.h"
 #include "BKE_camera.h"
@@ -38,6 +39,7 @@
 #include "BKE_global.h"
 #include "BKE_layer.h"
 #include "BKE_main.h"
+#include "BKE_modifier.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
 
@@ -962,8 +964,8 @@ static bool drw_select_filter_object_mode_lock(Object *ob, void *user_data)
  * we want to select pose bones (this doesn't switch modes). */
 static bool drw_select_filter_object_mode_lock_for_weight_paint(Object *ob, void *user_data)
 {
-  const Object *ob_pose = user_data;
-  return (DEG_get_original_object(ob) == ob_pose);
+  LinkNode *ob_pose_list = user_data;
+  return ob_pose_list && (BLI_linklist_index(ob_pose_list, DEG_get_original_object(ob)) != -1);
 }
 
 /**
@@ -1044,10 +1046,22 @@ int view3d_opengl_select(ViewContext *vc,
     case VIEW3D_SELECT_FILTER_WPAINT_POSE_MODE_LOCK: {
       Object *obact = vc->obact;
       BLI_assert(obact && (obact->mode & OB_MODE_WEIGHT_PAINT));
-      Object *ob_pose = BKE_object_pose_armature_get(obact);
 
+      /* While this uses 'alloca' in a loop (which we typically avoid),
+       * the number of items is nearly always 1, maybe 2..3 in rare cases. */
+      LinkNode *ob_pose_list = NULL;
+      VirtualModifierData virtualModifierData;
+      const ModifierData *md = modifiers_getVirtualModifierList(obact, &virtualModifierData);
+      for (; md; md = md->next) {
+        if (md->type == eModifierType_Armature) {
+          ArmatureModifierData *amd = (ArmatureModifierData *)md;
+          if (amd->object && (amd->object->mode & OB_MODE_POSE)) {
+            BLI_linklist_prepend_alloca(&ob_pose_list, amd->object);
+          }
+        }
+      }
       object_filter.fn = drw_select_filter_object_mode_lock_for_weight_paint;
-      object_filter.user_data = ob_pose;
+      object_filter.user_data = ob_pose_list;
       break;
     }
     case VIEW3D_SELECT_FILTER_NOP:



More information about the Bf-blender-cvs mailing list