diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-25 14:47:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-25 14:47:53 +0300 |
commit | 4c5b43052035a5aa3b34b77acb558f06147f0292 (patch) | |
tree | 6dc7ea1bb20d15febd570933cdfbf8e4b0076177 /source/blender/editors/armature | |
parent | b40307df1630e7bd51a181878bd61693b32dd817 (diff) |
ED_armature_edit_bone_remove wasnt clearing references from other bones, only affects rna api access
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index ebb9848baf4..323d76da6d9 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -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; } |