ED_armature_edit_bone_remove wasnt clearing references from other bones, only affects...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 25 Nov 2009 11:47:53 +0000 (11:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 25 Nov 2009 11:47:53 +0000 (11:47 +0000)
source/blender/editors/armature/editarmature.c
source/blender/editors/include/ED_armature.h

index ebb9848baf458d2904e1b751150c5d2d590be637..323d76da6d99cfcd7283a9ad0f697091d7281511 100644 (file)
@@ -141,7 +141,7 @@ void ED_armature_validate_active(struct bArmature *arm)
        }
 }
 
-void ED_armature_edit_bone_remove(bArmature *arm, EditBone *bone)
+static void bone_free(bArmature *arm, EditBone *bone)
 {
        if(arm->act_edbone==bone)
                arm->act_edbone= NULL;
@@ -154,6 +154,22 @@ void ED_armature_edit_bone_remove(bArmature *arm, EditBone *bone)
        BLI_freelinkN(arm->edbo, bone);
 }
 
+void ED_armature_edit_bone_remove(bArmature *arm, EditBone* exBone)
+{
+       EditBone *curBone;
+
+       /* Find any bones that refer to this bone */
+       for (curBone=arm->edbo->first; curBone; curBone=curBone->next) {
+               if (curBone->parent==exBone) {
+                       curBone->parent=exBone->parent;
+                       curBone->flag &= ~BONE_CONNECTED;
+               }
+       }
+
+       bone_free(arm, exBone);
+}
+
+
 /* converts Bones to EditBone list, used for tools as well */
 EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone *actBone)
 {
@@ -305,7 +321,7 @@ void ED_armature_from_edit(Object *obedit)
                                        fBone->parent= eBone->parent;
                        }
                        printf("Warning: removed zero sized bone: %s\n", eBone->name);
-                       ED_armature_edit_bone_remove(arm, eBone);
+                       bone_free(arm, eBone);
                }
        }
        
@@ -1035,7 +1051,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel)
                        free_pose_channel(pchan);
                        
                        /* get rid of unneeded bone */
-                       ED_armature_edit_bone_remove(arm, curbone);
+                       bone_free(arm, curbone);
                        BLI_freelinkN(&ob->pose->chanbase, pchan);
                }
        }
@@ -1671,22 +1687,6 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, short mval[2], List
        return NULL;
 }
 
-/* warning, wont clear the active bone */
-static void delete_bone(bArmature *arm, EditBone* exBone)
-{
-       EditBone *curBone;
-       
-       /* Find any bones that refer to this bone */
-       for (curBone=arm->edbo->first; curBone; curBone=curBone->next) {
-               if (curBone->parent==exBone) {
-                       curBone->parent=exBone->parent;
-                       curBone->flag &= ~BONE_CONNECTED;
-               }
-       }
-
-       ED_armature_edit_bone_remove(arm, exBone);
-}
-
 /* context: editmode armature */
 EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
 {
@@ -1783,7 +1783,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *op)
                if (arm->layer & curBone->layer) {
                        if (curBone->flag & BONE_SELECTED) {
                                if(curBone==arm->act_edbone) arm->act_edbone= NULL;
-                               delete_bone(arm, curBone);
+                               ED_armature_edit_bone_remove(arm, curBone);
                        }
                }
        }
@@ -3102,7 +3102,7 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
        /* step 3: delete all bones between and including start and end */
        for (ebo= end; ebo; ebo= ebone) {
                ebone= (ebo == start) ? (NULL) : (ebo->parent);
-               ED_armature_edit_bone_remove(arm, ebo);
+               bone_free(arm, ebo);
        }
 }
 
@@ -5660,7 +5660,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
                if (parent == root)
                {
                        if(parent==arm->act_edbone) arm->act_edbone= NULL;
-                       delete_bone(arm, parent);
+                       ED_armature_edit_bone_remove(arm, parent);
                        parent = NULL;
                }
                
index cbc86e58233dac10e8884132db709ad0dbaf7b4c..f054e229147094bd880bcdaf2e0050638ba517ee 100644 (file)
@@ -117,7 +117,7 @@ void ED_armature_validate_active(struct bArmature *arm);
 
 void add_primitive_bone(struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d);
 struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, char *name);
-void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *bone);
+void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *exBone);
 
 void transform_armature_mirror_update(struct Object *obedit);
 void clear_armature(struct Scene *scene, struct Object *ob, char mode);