fix for active bone not saving in editmode.

This commit is contained in:
Campbell Barton 2013-11-22 10:36:35 +11:00
parent bd5da19d86
commit f801f8057d
3 changed files with 10 additions and 6 deletions

@ -501,6 +501,7 @@ void ED_armature_from_edit(Object *obedit)
/* armature bones */ /* armature bones */
BKE_armature_bonelist_free(&arm->bonebase); BKE_armature_bonelist_free(&arm->bonebase);
arm->act_bone = NULL;
/* remove zero sized bones, this gives unstable restposes */ /* remove zero sized bones, this gives unstable restposes */
for (eBone = arm->edbo->first; eBone; eBone = neBone) { for (eBone = arm->edbo->first; eBone; eBone = neBone) {
@ -634,7 +635,6 @@ void ED_armature_to_edit(Object *ob)
ED_armature_edit_free(ob); ED_armature_edit_free(ob);
arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature"); arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature");
arm->act_edbone = make_boneList(arm->edbo, &arm->bonebase, NULL, arm->act_bone); arm->act_edbone = make_boneList(arm->edbo, &arm->bonebase, NULL, arm->act_bone);
arm->act_bone = NULL;
// BIF_freeTemplates(); /* force template update when entering editmode */ // BIF_freeTemplates(); /* force template update when entering editmode */
} }

@ -390,11 +390,15 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
layer_used = arm->layer_used; layer_used = arm->layer_used;
if (arm->edbo && arm->act_edbone) { if (arm->edbo) {
layer_active |= arm->act_edbone->layer; if (arm->act_edbone) {
layer_active |= arm->act_edbone->layer;
}
} }
else if (arm->act_bone) { else {
layer_active |= arm->act_bone->layer; if (arm->act_bone) {
layer_active |= arm->act_bone->layer;
}
} }
} }

@ -88,7 +88,7 @@ typedef struct bArmature {
* - from the user perspective active == last selected * - from the user perspective active == last selected
* - active should be ignored when not visible (hidden layer) */ * - active should be ignored when not visible (hidden layer) */
Bone *act_bone; /* active bone (when not in editmode) */ Bone *act_bone; /* active bone */
struct EditBone *act_edbone; /* active editbone (in editmode) */ struct EditBone *act_edbone; /* active editbone (in editmode) */
void *sketch; /* sketch struct for etch-a-ton */ void *sketch; /* sketch struct for etch-a-ton */