=Armature Undo Fix=

Armature undo was incomplete; no less then 6 places needed undo pushes.
Added undo pushes, and made sure deselectall_armature/posearmature played nice
and only did undo pushes when they're called with AKEY.

This seems like a fairly old issue.  I guess people just didn't notice it enough
to file a bug report. :)
This commit is contained in:
2007-02-10 19:07:47 +00:00
parent 8e837d6f86
commit fd05f23dce
5 changed files with 32 additions and 18 deletions

View File

@@ -81,8 +81,8 @@ void docentre_armature (struct Object *ob, int centremode);
void clear_armature(struct Object *ob, char mode);
void delete_armature(void);
void deselectall_armature(int toggle);
void deselectall_posearmature (struct Object *ob, int test);
void deselectall_armature(int toggle, int doundo);
void deselectall_posearmature (struct Object *ob, int test, int doundo);
int draw_armature(struct Base *base, int dt);
void extrude_armature(int forked);
void subdivide_armature(void);

View File

@@ -1093,7 +1093,7 @@ void mouse_armature(void)
if (nearBone) {
if (!(G.qual & LR_SHIFTKEY)) {
deselectall_armature(0);
deselectall_armature(0, 0);
}
/* by definition the non-root connected bones have no root point drawn,
@@ -1214,7 +1214,7 @@ void load_editArmature(void)
toggle==1: swap
toggle==2: only active tag
*/
void deselectall_armature(int toggle)
void deselectall_armature(int toggle, int doundo)
{
bArmature *arm= G.obedit->data;
EditBone *eBone;
@@ -1255,6 +1255,10 @@ void deselectall_armature(int toggle)
allqueue(REDRAWOOPS, 0);
countall(); // flushes selection!
if (doundo) {
if (sel==1) BIF_undo_push("Select All");
else BIF_undo_push("Deselect All");
}
}
void auto_align_armature(void)
@@ -1403,7 +1407,7 @@ static void add_primitive_bone(Object *ob)
Mat3MulMat3(totmat, obmat, viewmat);
Mat3Inv(imat, totmat);
deselectall_armature(0);
deselectall_armature(0, 0);
/* Create a bone */
bone= add_editbone("Bone");
@@ -1472,7 +1476,7 @@ void addvert_armature(void)
to_root= 1;
}
deselectall_armature(0);
deselectall_armature(0, 0);
/* we re-use code for mirror editing... */
flipbone= NULL;
@@ -1637,6 +1641,7 @@ void hide_selected_armature_bones(void)
countall();
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
BIF_undo_push("Hide Bones");
}
void hide_unselected_armature_bones(void)
@@ -1656,6 +1661,7 @@ void hide_unselected_armature_bones(void)
countall();
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
BIF_undo_push("Reveal Bones");
}
void show_all_armature_bones(void)
@@ -2020,6 +2026,7 @@ void subdivide_armature(void)
}
}
}
BIF_undo_push("Subdivide");
}
/* ***************** Pose tools ********************* */
@@ -2081,7 +2088,7 @@ int do_pose_selectbuffer(Base *base, unsigned int *buffer, short hits)
if (nearBone) {
/* since we do unified select, we don't shift+select a bone if the armature object was not active yet */
if (!(G.qual & LR_SHIFTKEY) || base!=BASACT){
deselectall_posearmature(ob, 0);
deselectall_posearmature(ob, 0, 0);
nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
select_actionchannel_by_name(ob->action, nearBone->name, 1);
}
@@ -2132,7 +2139,7 @@ int do_pose_selectbuffer(Base *base, unsigned int *buffer, short hits)
test==1: swap select
test==2: only clear active tag
*/
void deselectall_posearmature (Object *ob, int test)
void deselectall_posearmature (Object *ob, int test, int doundo)
{
bArmature *arm;
bPoseChannel *pchan;
@@ -2176,6 +2183,11 @@ void deselectall_posearmature (Object *ob, int test)
allqueue(REDRAWACTION, 0);
countall();
if (doundo) {
if (selectmode==1) BIF_undo_push("Select All");
else BIF_undo_push("Deselect All");
}
}
@@ -2540,6 +2552,7 @@ void hide_unselected_pose_bones(void)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
BIF_undo_push("Hide Bone");
}
static int show_pose_bone(Object *ob, Bone *bone, void *ptr)
@@ -2571,6 +2584,7 @@ void show_all_pose_bones(void)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
BIF_undo_push("Show Bone");
}

View File

@@ -1246,7 +1246,7 @@ static void do_view3d_select_armaturemenu(void *arg, int event)
borderselect();
break;
case 2: /* Select/Deselect all */
deselectall_armature(1);
deselectall_armature(1, 1);
break;
case 3: /* Select Parent(s) */
select_bone_parent();
@@ -1292,7 +1292,7 @@ static void do_view3d_select_pose_armaturemenu(void *arg, int event)
borderselect();
break;
case 2: /* Select/Deselect all */
deselectall_posearmature(OBACT, 1);
deselectall_posearmature(OBACT, 1, 1);
break;
case 3:
pose_select_constraint_target();

View File

@@ -1600,8 +1600,8 @@ static int tree_element_active_posechannel(TreeElement *te, TreeStoreElem *tsele
if(set) {
if(!(pchan->bone->flag & BONE_HIDDEN_P)) {
if(G.qual & LR_SHIFTKEY) deselectall_posearmature(ob, 2); // 2 = clear active tag
else deselectall_posearmature(ob, 0); // 0 = deselect
if(G.qual & LR_SHIFTKEY) deselectall_posearmature(ob, 2, 0); // 2 = clear active tag
else deselectall_posearmature(ob, 0, 0); // 0 = deselect
pchan->bone->flag |= BONE_SELECTED|BONE_ACTIVE;
allqueue(REDRAWVIEW3D, 0);
@@ -1624,8 +1624,8 @@ static int tree_element_active_bone(TreeElement *te, TreeStoreElem *tselem, int
if(set) {
if(!(bone->flag & BONE_HIDDEN_P)) {
if(G.qual & LR_SHIFTKEY) deselectall_posearmature(OBACT, 2); // 2 is clear active tag
else deselectall_posearmature(OBACT, 0);
if(G.qual & LR_SHIFTKEY) deselectall_posearmature(OBACT, 2, 0); // 2 is clear active tag
else deselectall_posearmature(OBACT, 0, 0);
bone->flag |= BONE_SELECTED|BONE_ACTIVE;
allqueue(REDRAWVIEW3D, 0);
@@ -1652,8 +1652,8 @@ static int tree_element_active_ebone(TreeElement *te, TreeStoreElem *tselem, int
if(set) {
if(!(ebone->flag & BONE_HIDDEN_A)) {
if(G.qual & LR_SHIFTKEY) deselectall_armature(2); // only clear active tag
else deselectall_armature(0); // deselect
if(G.qual & LR_SHIFTKEY) deselectall_armature(2, 0); // only clear active tag
else deselectall_armature(0, 0); // deselect
ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL|BONE_ACTIVE;
// flush to parent?

View File

@@ -1556,10 +1556,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
else if(G.obedit->type==OB_LATTICE)
deselectall_Latt();
else if(G.obedit->type==OB_ARMATURE)
deselectall_armature(1); /* 1 == toggle */
deselectall_armature(1, 1); /* 1 == toggle */
}
else if (ob && (ob->flag & OB_POSEMODE)){
deselectall_posearmature(ob, 1);
deselectall_posearmature(ob, 1, 1);
}
else {
if(G.f & G_FACESELECT) deselectall_tface();