From ce6e7a094173c288e497e982c55b33f2135d83be Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 25 Oct 2019 00:40:21 +1100 Subject: Fix T60689: Flip Active/Selected bone fails in weight paint mode 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 | 24 +++++++++------------- .../editors/space_outliner/outliner_select.c | 4 ++-- .../blender/editors/transform/transform_gizmo_3d.c | 5 +++-- 3 files changed, 15 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index c3a7d45f598..a60b9c56dc6 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -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; diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index f1e884adc3d..19bbb115788 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -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]); diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 157cf96a85e..a2bdeadeaae 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -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); -- cgit v1.2.3