== Armature Layer/Move Bone to Layer Popups ==

This commit adds a few quick tools for riggers. In Editmode for Armatures, I've added the popups that show up in PoseMode when Shift-MKEY and MKEY are used. This should speed up the workflow a bit, by requiring less trips between the 3d-view and the buttons panel, as well as providing a 'batch' move-bones-to-layer functionality.

Usage Notes:
* MKEY - move selected bones to layer(s)
* SHIFT-MKEY - change the currently visible armature layers
* CTRL-MKEY - mirror selected bones
This commit is contained in:
2007-10-03 00:05:34 +00:00
parent df46549325
commit f18c673943
2 changed files with 52 additions and 20 deletions

View File

@@ -872,7 +872,9 @@ void pose_activate_flipped_bone(void)
}
}
/* This function pops up the move-to-layer popup widgets when the user
* presses either SHIFT-MKEY or MKEY in PoseMode OR EditMode (for Armatures)
*/
void pose_movetolayer(void)
{
Object *ob= OBACT;
@@ -882,10 +884,11 @@ void pose_movetolayer(void)
if(ob==NULL) return;
arm= ob->data;
if(G.qual & LR_SHIFTKEY) {
if (G.qual & LR_SHIFTKEY) {
/* armature layers */
lay= arm->layer;
if( movetolayer_short_buts(&lay, "Armature Layers")==0 ) return;
if(lay==0) return;
if ( movetolayer_short_buts(&lay, "Armature Layers")==0 ) return;
if (lay==0) return;
arm->layer= lay;
if(ob->pose)
ob->pose->proxy_layer= lay;
@@ -893,28 +896,28 @@ void pose_movetolayer(void)
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWBUTSEDIT, 0);
}
else if(ob->flag & OB_POSEMODE) {
else if (ob->flag & OB_POSEMODE) {
/* pose-channel layers */
bPoseChannel *pchan;
if(pose_has_protected_selected(ob, 0))
if (pose_has_protected_selected(ob, 0))
return;
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(arm->layer & pchan->bone->layer) {
if(pchan->bone->flag & BONE_SELECTED)
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if (arm->layer & pchan->bone->layer) {
if (pchan->bone->flag & BONE_SELECTED)
lay |= pchan->bone->layer;
}
}
if(lay==0) return;
if (lay==0) return;
if( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
if(lay==0) return;
if ( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
if (lay==0) return;
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if(arm->layer & pchan->bone->layer) {
if(pchan->bone->flag & BONE_SELECTED)
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if (arm->layer & pchan->bone->layer) {
if (pchan->bone->flag & BONE_SELECTED)
pchan->bone->layer= lay;
}
}
@@ -924,4 +927,30 @@ void pose_movetolayer(void)
allqueue(REDRAWACTION, 0);
allqueue(REDRAWBUTSEDIT, 0);
}
else if (G.obedit) {
/* must be editbone layers then */
EditBone *ebo;
for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
if (arm->layer & ebo->layer) {
if (ebo->flag & BONE_SELECTED)
lay |= ebo->layer;
}
}
if (lay==0) return;
if ( movetolayer_short_buts(&lay, "Bone Layers")==0 ) return;
if (lay==0) return;
for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
if (arm->layer & ebo->layer) {
if (ebo->flag & BONE_SELECTED)
ebo->layer= lay;
}
}
BIF_undo_push("Move Bone layer");
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
}
}

View File

@@ -2086,16 +2086,19 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case MKEY:
if(G.obedit){
if(G.qual==LR_ALTKEY) {
if (ELEM(G.qual, 0, LR_SHIFTKEY) && (G.obedit->type==OB_ARMATURE)) {
pose_movetolayer();
}
else if (G.qual==LR_ALTKEY) {
if(G.obedit->type==OB_MESH) {
mergemenu();
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);
}
}
else if((G.qual==0) || (G.qual==LR_CTRLKEY)) {
else if ((G.qual==0) || (G.qual==LR_CTRLKEY)) {
mirrormenu();
}
if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
if(G.obedit->type==OB_MESH) select_non_manifold();
}
}