diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-10-05 23:55:54 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-10-05 23:55:54 +0300 |
commit | 74e01d2235f5a71ef55d97ccd80a2eebded8a62e (patch) | |
tree | 779d3a26ca926bdba9ae42467d1dc1f9125b32fb /source/blender/editors/armature/armature_edit.c | |
parent | 7d1bf5876047ec67adabf8f85e6433d3e5767dc7 (diff) |
Multi-Objects: ARMATURE_OT_split
Diffstat (limited to 'source/blender/editors/armature/armature_edit.c')
-rw-r--r-- | source/blender/editors/armature/armature_edit.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 7d469342b8c..2e0d49b9683 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1323,22 +1323,28 @@ void ARMATURE_OT_align(wmOperatorType *ot) static int armature_split_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob = CTX_data_edit_object(C); - bArmature *arm = (bArmature *)ob->data; - EditBone *bone; + ViewLayer *view_layer = CTX_data_view_layer(C); + + 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 (bone = arm->edbo->first; bone; bone = bone->next) { - if (bone->parent && (bone->flag & BONE_SELECTED) != (bone->parent->flag & BONE_SELECTED)) { - bone->parent = NULL; - bone->flag &= ~BONE_CONNECTED; + for (EditBone *bone = arm->edbo->first; bone; bone = bone->next) { + if (bone->parent && (bone->flag & BONE_SELECTED) != (bone->parent->flag & BONE_SELECTED)) { + bone->parent = NULL; + bone->flag &= ~BONE_CONNECTED; + } + } + for (EditBone *bone = arm->edbo->first; bone; bone = bone->next) { + ED_armature_ebone_select_set(bone, (bone->flag & BONE_SELECTED) != 0); } - } - for (bone = arm->edbo->first; bone; bone = bone->next) { - ED_armature_ebone_select_set(bone, (bone->flag & BONE_SELECTED) != 0); - } - WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); + WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); + } + MEM_freeN(objects); return OPERATOR_FINISHED; } |