Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / armature / armature_utils.c
index 23a49d282e1ba2e5ebe6cf1217fae744b7d6c10e..eaff0b10a028f18e06441e1d83dc49ed05be5d3d 100644 (file)
@@ -134,7 +134,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;
 
@@ -142,13 +145,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) {