More bugfixes for Armature Separation/Joining:

* Move armatures out of posemode before joining/separating, so that bones don't mysteriously disappear after the operation
* Added an undo push and fixed up hotkey access for armature separation
This commit is contained in:
Joshua Leung 2008-05-11 12:34:56 +00:00
parent 7cceaf13ea
commit 50bbc0ff23
3 changed files with 13 additions and 3 deletions

@ -565,7 +565,11 @@ int join_armature(void)
/* Get editbones of active armature to add editbones to */
ebbase.first=ebbase.last= NULL;
make_boneList(&ebbase, &arm->bonebase, NULL);
/* get pose of active object and move it out of posemode */
pose= ob->pose;
ob->flag &= ~OB_POSEMODE;
BASACT->flag &= ~OB_POSEMODE;
for (base=FIRSTBASE; base; base=nextbase) {
nextbase = base->next;
@ -577,6 +581,8 @@ int join_armature(void)
/* Get Pose of current armature */
opose= base->object->pose;
base->object->flag &= ~OB_POSEMODE;
BASACT->flag &= ~OB_POSEMODE;
/* Find the difference matrix */
Mat4Invert(oimat, ob->obmat);
@ -837,7 +843,7 @@ void separate_armature (void)
arm= G.obedit->data;
/* we are going to do this as follows (unlike every other instance of separate):
* 1. exit editmode for active armature/base. Take note of what this is.
* 1. exit editmode +posemode for active armature/base. Take note of what this is.
* 2. duplicate base - BASACT is the new one now
* 3. for each of the two armatures, enter editmode -> remove appropriate bones -> exit editmode + recalc
* 4. fix constraint links
@ -856,6 +862,8 @@ void separate_armature (void)
/* 1) store starting settings and exit editmode */
oldob= G.obedit;
oldbase= BASACT;
oldob->flag &= ~OB_POSEMODE;
oldbase->flag &= ~OB_POSEMODE;
load_editArmature();
free_editArmature();
@ -894,6 +902,8 @@ void separate_armature (void)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWOOPS, 0);
BIF_undo_push("Separate Armature");
}
/* **************** END tools on Editmode Armature **************** */

@ -3964,7 +3964,7 @@ static uiBlock *view3d_edit_armaturemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Fill Between Joints|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate|Ctrl Shift P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate|Ctrl Alt P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");

@ -2411,7 +2411,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
clear_bone_parent();
else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
select_bone_parent();
else if((G.qual==(LR_CTRLKEY|LR_SHIFTKEY)) && (G.obedit->type==OB_ARMATURE))
else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
separate_armature();
else if((G.qual==0) && G.obedit->type==OB_MESH)
separatemenu();