Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_layer.h5
-rw-r--r--source/blender/editors/armature/pose_select.c32
2 files changed, 22 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index db0e5f21284..80d8d237e53 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -381,6 +381,11 @@ bool BKE_view_layer_filter_edit_mesh_has_edges(struct Object *ob, void *user_dat
.no_dup_data = true, \
.filter_fn = BKE_view_layer_filter_edit_mesh_has_uvs});
+#define BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, r_len, mode) \
+ BKE_view_layer_array_from_objects_in_mode( \
+ view_layer, r_len, { \
+ .object_mode = mode, \
+ .no_dup_data = true});
#ifdef __cplusplus
}
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 0784f7030a1..b99fc8eb204 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -920,17 +920,19 @@ void POSE_OT_select_grouped(wmOperatorType *ot)
*/
static int pose_select_mirror_exec(bContext *C, wmOperator *op)
{
- Object *ob_act = CTX_data_active_object(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob_active = CTX_data_active_object(C);
- FOREACH_OBJECT_IN_MODE_BEGIN(view_layer, OB_MODE_POSE, ob)
- {
- bArmature *arm;
- bPoseChannel *pchan, *pchan_mirror_act = NULL;
- const bool active_only = RNA_boolean_get(op->ptr, "only_active");
- const bool extend = RNA_boolean_get(op->ptr, "extend");
+ const bool is_weight_paint = (ob_active->mode & OB_MODE_WEIGHT_PAINT) != 0;
+ const bool active_only = RNA_boolean_get(op->ptr, "only_active");
+ const bool extend = RNA_boolean_get(op->ptr, "extend");
- arm = ob->data;
+ uint objects_len = 0;
+ Object **objects = BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, &objects_len, OB_MODE_POSE);
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object * ob = objects[ob_index];
+ bArmature * arm = ob->data;
+ bPoseChannel *pchan, *pchan_mirror_act = NULL;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
const int flag = (pchan->bone->flag & BONE_SELECTED);
@@ -952,7 +954,7 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op)
pchan_mirror_act = pchan_mirror;
}
- /* skip all but the active or its mirror */
+ /* Skip all but the active or its mirror. */
if (active_only && !ELEM(arm->act_bone, pchan->bone, pchan_mirror->bone)) {
continue;
}
@@ -965,19 +967,19 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op)
if (pchan_mirror_act) {
arm->act_bone = pchan_mirror_act->bone;
- /* in weightpaint we select the associated vertex group too */
- if (ob_act->mode & OB_MODE_WEIGHT_PAINT) {
- ED_vgroup_select_by_name(ob_act, pchan_mirror_act->name);
- DEG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
+ /* In weightpaint we select the associated vertex group too. */
+ if (is_weight_paint) {
+ ED_vgroup_select_by_name(ob, pchan_mirror_act->name);
+ DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
}
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
- /* need to tag armature for cow updates, or else selection doesn't update */
+ /* Need to tag armature for cow updates, or else selection doesn't update. */
DEG_id_tag_update(&arm->id, DEG_TAG_COPY_ON_WRITE);
}
- FOREACH_OBJECT_IN_MODE_END;
+ MEM_freeN(objects);
return OPERATOR_FINISHED;
}