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.
This commit is contained in:
Campbell Barton 2019-10-25 00:40:21 +11:00
parent 88a346420b
commit ce6e7a0941
Notes: blender-bot 2023-02-14 19:45:25 +01:00
Referenced by issue #60689, Flip Active/Selected Bone does not work in weight paint mode.
3 changed files with 15 additions and 18 deletions

View 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;

View 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]);

View 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);