Fix T60689: Flip Active/Selected bone fails in weight paint mode
authorCampbell Barton <ideasman42@gmail.com>
Thu, 24 Oct 2019 13:40:21 +0000 (00:40 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 24 Oct 2019 13:49:39 +0000 (00:49 +1100)
Multiple selection operations failed with weight-paint + pose mode.

Weight-paint + pose mode is a special case that doesn't support
multi-pose mode, so we need to use this instead of the generic
function.

source/blender/editors/armature/pose_select.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/transform/transform_gizmo_3d.c

index c3a7d45f598a3d0aabbce13e69fe84b85ad9409a..a60b9c56dc6f7fe62ce392e29ecec7b058adaa20 100644 (file)
@@ -372,12 +372,8 @@ bool ED_pose_deselect_all_multi(bContext *C, int select_mode, const bool ignore_
   ViewContext vc;
   ED_view3d_viewcontext_init(C, &vc, depsgraph);
   uint bases_len = 0;
-  Base **bases = BKE_view_layer_array_from_bases_in_mode(vc.view_layer,
-                                                         vc.v3d,
-                                                         &bases_len,
-                                                         {
-                                                             .object_mode = OB_MODE_POSE,
-                                                         });
+
+  Base **bases = BKE_object_pose_base_array_get_unique(vc.view_layer, vc.v3d, &bases_len);
   bool changed_multi = ED_pose_deselect_all_multi_ex(
       bases, bases_len, select_mode, ignore_visibility);
   MEM_freeN(bases);
@@ -775,8 +771,8 @@ static bool pose_select_same_group(bContext *C, bool extend)
   uint ob_index;
 
   uint objects_len = 0;
-  Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
-      view_layer, CTX_wm_view3d(C), &objects_len, OB_MODE_POSE);
+  Object **objects = BKE_object_pose_array_get_unique(view_layer, CTX_wm_view3d(C), &objects_len);
+
   for (ob_index = 0; ob_index < objects_len; ob_index++) {
     Object *ob = BKE_object_pose_armature_get(objects[ob_index]);
     bArmature *arm = (ob) ? ob->data : NULL;
@@ -876,8 +872,8 @@ static bool pose_select_same_layer(bContext *C, bool extend)
   bool changed = false;
 
   uint objects_len = 0;
-  Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
-      view_layer, CTX_wm_view3d(C), &objects_len, OB_MODE_POSE);
+  Object **objects = BKE_object_pose_array_get_unique(view_layer, CTX_wm_view3d(C), &objects_len);
+
   for (ob_index = 0; ob_index < objects_len; ob_index++) {
     Object *ob = objects[ob_index];
     ob->id.tag &= ~LIB_TAG_DOIT;
@@ -990,8 +986,8 @@ static bool pose_select_same_keyingset(bContext *C, ReportList *reports, bool ex
   }
 
   uint objects_len = 0;
-  Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
-      view_layer, CTX_wm_view3d(C), &objects_len, OB_MODE_POSE);
+  Object **objects = BKE_object_pose_array_get_unique(view_layer, CTX_wm_view3d(C), &objects_len);
+
   for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
     Object *ob = BKE_object_pose_armature_get(objects[ob_index]);
     bArmature *arm = (ob) ? ob->data : NULL;
@@ -1132,8 +1128,8 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op)
   const bool extend = RNA_boolean_get(op->ptr, "extend");
 
   uint objects_len = 0;
-  Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
-      view_layer, CTX_wm_view3d(C), &objects_len, OB_MODE_POSE);
+  Object **objects = BKE_object_pose_array_get_unique(view_layer, CTX_wm_view3d(C), &objects_len);
+
   for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
     Object *ob = objects[ob_index];
     bArmature *arm = ob->data;
index f1e884adc3dc290080521231550ee9c78c44cc50..19bbb1157886b850ce7327a85ecc459561bf0300 100644 (file)
@@ -610,8 +610,8 @@ static eOLDrawState tree_element_active_posechannel(bContext *C,
       if (set != OL_SETSEL_EXTEND) {
         /* Single select forces all other bones to get unselected. */
         uint objects_len = 0;
-        Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
-            view_layer, NULL, &objects_len, OB_MODE_POSE);
+        Object **objects = BKE_object_pose_array_get_unique(view_layer, NULL, &objects_len);
+
         for (uint object_index = 0; object_index < objects_len; object_index++) {
           Object *ob_iter = BKE_object_pose_armature_get(objects[object_index]);
 
index 157cf96a85ea8084cb3f52a28f85bb8bbad2716f..a2bdeadeaae49ce65a0e348d4c12b683d57d81ca 100644 (file)
@@ -1020,9 +1020,10 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
   }
   else if (ob && (ob->mode & OB_MODE_POSE)) {
     invert_m4_m4(ob->imat, ob->obmat);
+
     uint objects_len = 0;
-    Object **objects = BKE_view_layer_array_from_objects_in_mode(
-        view_layer, v3d, &objects_len, {.object_mode = OB_MODE_POSE});
+    Object **objects = BKE_object_pose_array_get(view_layer, v3d, &objects_len);
+
     for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
       Object *ob_iter = objects[ob_index];
       const bool use_mat_local = (ob_iter != ob);