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
path: root/source
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2018-10-02 20:05:30 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-10-02 20:39:10 +0300
commit8b2bcce3d21141c22a5acabfd1f453b627b1d43d (patch)
tree76d6342002ef2570e8c272c53a69e252fd42875e /source
parent9c02f6b1ed6fea5352ee161b146abff033a085e4 (diff)
Multi-Objects: ARMATURE_OT_select_mirror
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/armature/armature_select.c68
1 files changed, 38 insertions, 30 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index 95b9e1dafcf..181b5b9ac63 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -1338,49 +1338,57 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)
*/
static int armature_select_mirror_exec(bContext *C, wmOperator *op)
{
- Object *obedit = CTX_data_edit_object(C);
- bArmature *arm = obedit->data;
- EditBone *ebone, *ebone_mirror_act = NULL;
+ ViewLayer * view_layer = CTX_data_view_layer(C);
const bool active_only = RNA_boolean_get(op->ptr, "only_active");
const bool extend = RNA_boolean_get(op->ptr, "extend");
- for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
- const int flag = ED_armature_ebone_selectflag_get(ebone);
- EBONE_PREV_FLAG_SET(ebone, flag);
- }
+ uint objects_len = 0;
+ Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
+ for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+ Object * ob = objects[ob_index];
+ bArmature * arm = ob->data;
- for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
- if (EBONE_SELECTABLE(arm, ebone)) {
- EditBone *ebone_mirror;
- int flag_new = extend ? EBONE_PREV_FLAG_GET(ebone) : 0;
+ EditBone *ebone, *ebone_mirror_act = NULL;
- if ((ebone_mirror = ED_armature_ebone_get_mirrored(arm->edbo, ebone)) &&
- (EBONE_VISIBLE(arm, ebone_mirror)))
- {
- const int flag_mirror = EBONE_PREV_FLAG_GET(ebone_mirror);
- flag_new |= flag_mirror;
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ const int flag = ED_armature_ebone_selectflag_get(ebone);
+ EBONE_PREV_FLAG_SET(ebone, flag);
+ }
- if (ebone == arm->act_edbone) {
- ebone_mirror_act = ebone_mirror;
- }
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_SELECTABLE(arm, ebone)) {
+ EditBone *ebone_mirror;
+ int flag_new = extend ? EBONE_PREV_FLAG_GET(ebone) : 0;
+
+ if ((ebone_mirror = ED_armature_ebone_get_mirrored(arm->edbo, ebone)) &&
+ (EBONE_VISIBLE(arm, ebone_mirror)))
+ {
+ const int flag_mirror = EBONE_PREV_FLAG_GET(ebone_mirror);
+ flag_new |= flag_mirror;
- /* skip all but the active or its mirror */
- if (active_only && !ELEM(arm->act_edbone, ebone, ebone_mirror)) {
- continue;
+ if (ebone == arm->act_edbone) {
+ ebone_mirror_act = ebone_mirror;
+ }
+
+ /* skip all but the active or its mirror */
+ if (active_only && !ELEM(arm->act_edbone, ebone, ebone_mirror)) {
+ continue;
+ }
}
- }
- ED_armature_ebone_selectflag_set(ebone, flag_new);
+ ED_armature_ebone_selectflag_set(ebone, flag_new);
+ }
}
- }
- if (ebone_mirror_act) {
- arm->act_edbone = ebone_mirror_act;
- }
+ if (ebone_mirror_act) {
+ arm->act_edbone = ebone_mirror_act;
+ }
- ED_armature_edit_sync_selection(arm->edbo);
+ ED_armature_edit_sync_selection(arm->edbo);
- WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+ }
+ MEM_freeN(objects);
return OPERATOR_FINISHED;
}