diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-03-22 09:50:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-03-22 09:50:58 +0300 |
commit | 865fbe343a9067f342c45fb2a1a63eca0f7cf2d7 (patch) | |
tree | 033f1552d92497da98e38d1fa95cd8d4cd162acb /source/blender/editors/armature | |
parent | ce51066e47175a38fd205987b6e6acc1a805dbe0 (diff) |
Fix T54348: Bone dissolve gives invalid hierarchy
Disconnected bones weren't handled correctly.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_edit.c | 5 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_utils.c | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 17d60d2b4a0..9a4a0eecfcd 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1460,7 +1460,7 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op)) ebone->parent->rad_tail = ebone->rad_tail; SET_FLAG_FROM_TEST(ebone->parent->flag, ebone->flag & BONE_TIPSEL, BONE_TIPSEL); - ED_armature_edit_bone_remove(arm, ebone); + ED_armature_edit_bone_remove_ex(arm, ebone, false); changed = true; } } @@ -1469,9 +1469,8 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op)) for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (ebone->parent && ebone->parent->temp.ebone && - (ebone->flag & BONE_CONNECTED) == 0) + (ebone->flag & BONE_CONNECTED)) { - ebone->flag |= BONE_CONNECTED; ebone->rad_head = ebone->parent->rad_tail; } } diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 0efd9cec959..3928cb2d85d 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -133,7 +133,10 @@ void bone_free(bArmature *arm, EditBone *bone) BLI_freelinkN(arm->edbo, bone); } -void ED_armature_edit_bone_remove(bArmature *arm, EditBone *exBone) +/** + * \param clear_connected: When false caller is responsible for keeping the flag in a valid state. + */ +void ED_armature_edit_bone_remove_ex(bArmature *arm, EditBone *exBone, bool clear_connected) { EditBone *curBone; @@ -141,13 +144,20 @@ void ED_armature_edit_bone_remove(bArmature *arm, EditBone *exBone) for (curBone = arm->edbo->first; curBone; curBone = curBone->next) { if (curBone->parent == exBone) { curBone->parent = exBone->parent; - curBone->flag &= ~BONE_CONNECTED; + if (clear_connected) { + curBone->flag &= ~BONE_CONNECTED; + } } } bone_free(arm, exBone); } +void ED_armature_edit_bone_remove(bArmature *arm, EditBone *exBone) +{ + ED_armature_edit_bone_remove_ex(arm, exBone, true); +} + bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child) { for (ebone_child = ebone_child->parent; ebone_child; ebone_child = ebone_child->parent) { |