forked from bartvdbraak/blender
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:
parent
7cceaf13ea
commit
50bbc0ff23
@ -565,7 +565,11 @@ int join_armature(void)
|
|||||||
/* Get editbones of active armature to add editbones to */
|
/* Get editbones of active armature to add editbones to */
|
||||||
ebbase.first=ebbase.last= NULL;
|
ebbase.first=ebbase.last= NULL;
|
||||||
make_boneList(&ebbase, &arm->bonebase, NULL);
|
make_boneList(&ebbase, &arm->bonebase, NULL);
|
||||||
|
|
||||||
|
/* get pose of active object and move it out of posemode */
|
||||||
pose= ob->pose;
|
pose= ob->pose;
|
||||||
|
ob->flag &= ~OB_POSEMODE;
|
||||||
|
BASACT->flag &= ~OB_POSEMODE;
|
||||||
|
|
||||||
for (base=FIRSTBASE; base; base=nextbase) {
|
for (base=FIRSTBASE; base; base=nextbase) {
|
||||||
nextbase = base->next;
|
nextbase = base->next;
|
||||||
@ -577,6 +581,8 @@ int join_armature(void)
|
|||||||
|
|
||||||
/* Get Pose of current armature */
|
/* Get Pose of current armature */
|
||||||
opose= base->object->pose;
|
opose= base->object->pose;
|
||||||
|
base->object->flag &= ~OB_POSEMODE;
|
||||||
|
BASACT->flag &= ~OB_POSEMODE;
|
||||||
|
|
||||||
/* Find the difference matrix */
|
/* Find the difference matrix */
|
||||||
Mat4Invert(oimat, ob->obmat);
|
Mat4Invert(oimat, ob->obmat);
|
||||||
@ -837,7 +843,7 @@ void separate_armature (void)
|
|||||||
arm= G.obedit->data;
|
arm= G.obedit->data;
|
||||||
|
|
||||||
/* we are going to do this as follows (unlike every other instance of separate):
|
/* 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
|
* 2. duplicate base - BASACT is the new one now
|
||||||
* 3. for each of the two armatures, enter editmode -> remove appropriate bones -> exit editmode + recalc
|
* 3. for each of the two armatures, enter editmode -> remove appropriate bones -> exit editmode + recalc
|
||||||
* 4. fix constraint links
|
* 4. fix constraint links
|
||||||
@ -856,6 +862,8 @@ void separate_armature (void)
|
|||||||
/* 1) store starting settings and exit editmode */
|
/* 1) store starting settings and exit editmode */
|
||||||
oldob= G.obedit;
|
oldob= G.obedit;
|
||||||
oldbase= BASACT;
|
oldbase= BASACT;
|
||||||
|
oldob->flag &= ~OB_POSEMODE;
|
||||||
|
oldbase->flag &= ~OB_POSEMODE;
|
||||||
|
|
||||||
load_editArmature();
|
load_editArmature();
|
||||||
free_editArmature();
|
free_editArmature();
|
||||||
@ -894,6 +902,8 @@ void separate_armature (void)
|
|||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
allqueue(REDRAWBUTSEDIT, 0);
|
allqueue(REDRAWBUTSEDIT, 0);
|
||||||
allqueue(REDRAWOOPS, 0);
|
allqueue(REDRAWOOPS, 0);
|
||||||
|
|
||||||
|
BIF_undo_push("Separate Armature");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* **************** END tools on Editmode 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, "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, "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, "");
|
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();
|
clear_bone_parent();
|
||||||
else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
|
else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
|
||||||
select_bone_parent();
|
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();
|
separate_armature();
|
||||||
else if((G.qual==0) && G.obedit->type==OB_MESH)
|
else if((G.qual==0) && G.obedit->type==OB_MESH)
|
||||||
separatemenu();
|
separatemenu();
|
||||||
|
Loading…
Reference in New Issue
Block a user