forked from bartvdbraak/blender
Following on from the commits yesterday for "Action Channel Settings" quick-toggle tools, bones now have this functionality too.
Use Shift-W to toggle, Ctrl-Shift-W to enable, and Alt-W to disable one of the bone's settings.
This commit is contained in:
parent
b6fc21d84f
commit
75d2729fce
@ -111,6 +111,7 @@ void remake_editArmature(void);
|
||||
void selectconnected_armature(void);
|
||||
void selectconnected_posearmature(void);
|
||||
void select_bone_parent(void);
|
||||
void setflag_armature(short mode);
|
||||
void unique_editbone_name (struct ListBase *ebones, char *name);
|
||||
|
||||
void auto_align_armature(short mode);
|
||||
|
@ -836,6 +836,98 @@ void select_bone_parent (void)
|
||||
BIF_undo_push("Select Parent");
|
||||
}
|
||||
|
||||
/* helper for setflag_sel_bone() */
|
||||
static void bone_setflag (int *bone, int flag, short mode)
|
||||
{
|
||||
if (bone && flag) {
|
||||
/* exception for inverse flags */
|
||||
if (flag == BONE_NO_DEFORM) {
|
||||
if (mode == 2)
|
||||
*bone |= flag;
|
||||
else if (mode == 1)
|
||||
*bone &= ~flag;
|
||||
else
|
||||
*bone ^= flag;
|
||||
|
||||
}
|
||||
else {
|
||||
if (mode == 2)
|
||||
*bone &= ~flag;
|
||||
else if (mode == 1)
|
||||
*bone |= flag;
|
||||
else
|
||||
*bone ^= flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* used by posemode and editmode */
|
||||
void setflag_armature (short mode)
|
||||
{
|
||||
Object *ob;
|
||||
bArmature *arm;
|
||||
int flag;
|
||||
|
||||
/* get data */
|
||||
if (G.obedit)
|
||||
ob= G.obedit;
|
||||
else if (OBACT)
|
||||
ob= OBACT;
|
||||
else
|
||||
return;
|
||||
arm= (bArmature *)ob->data;
|
||||
|
||||
/* get flag to set (sync these with the ones used in eBone_Flag */
|
||||
if (mode == 2)
|
||||
flag= pupmenu("Disable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
|
||||
else if (mode == 1)
|
||||
flag= pupmenu("Enable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
|
||||
else
|
||||
flag= pupmenu("Toggle Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5");
|
||||
switch (flag) {
|
||||
case 1: flag = BONE_DRAWWIRE; break;
|
||||
case 2: flag = BONE_NO_DEFORM; break;
|
||||
case 3: flag = BONE_MULT_VG_ENV; break;
|
||||
case 4: flag = BONE_HINGE; break;
|
||||
case 5: flag = BONE_NO_SCALE; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
/* determine which mode armature is in */
|
||||
if ((!G.obedit) && (ob->flag & OB_POSEMODE)) {
|
||||
/* deal with pose channels */
|
||||
bPoseChannel *pchan;
|
||||
|
||||
/* set setting */
|
||||
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
||||
if ((pchan->bone) && (arm->layer & pchan->bone->layer)) {
|
||||
if (pchan->bone->flag & BONE_SELECTED) {
|
||||
bone_setflag(&pchan->bone->flag, flag, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (G.obedit) {
|
||||
/* deal with editbones */
|
||||
EditBone *curbone;
|
||||
|
||||
/* set setting */
|
||||
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
|
||||
if (arm->layer & curbone->layer) {
|
||||
if (curbone->flag & BONE_SELECTED) {
|
||||
bone_setflag(&curbone->flag, flag, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWBUTSOBJECT, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
|
||||
BIF_undo_push("Change Bone Setting");
|
||||
}
|
||||
|
||||
/* **************** END PoseMode & EditMode *************************** */
|
||||
/* **************** Posemode stuff ********************** */
|
||||
|
@ -150,7 +150,8 @@ enum {
|
||||
ACTMENU_KEY_DUPLICATE = 0,
|
||||
ACTMENU_KEY_DELETE,
|
||||
ACTMENU_KEY_CLEAN,
|
||||
ACTMENU_KEY_SAMPLEKEYS
|
||||
ACTMENU_KEY_SAMPLEKEYS,
|
||||
ACTMENU_KEY_INSERTKEY
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -1244,6 +1245,9 @@ static void do_action_keymenu(void *arg, int event)
|
||||
case ACTMENU_KEY_SAMPLEKEYS:
|
||||
sample_action_keys();
|
||||
break;
|
||||
case ACTMENU_KEY_INSERTKEY:
|
||||
insertkey_action();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1267,7 +1271,15 @@ static uiBlock *action_keymenu(void *arg_unused)
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6,
|
||||
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
|
||||
"Insert Key|I", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 0,
|
||||
ACTMENU_KEY_INSERTKEY, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6,
|
||||
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
|
||||
"Duplicate|Shift D", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 0,
|
||||
|
@ -3884,6 +3884,29 @@ static uiBlock *view3d_scripts_armaturemenu(void *args_unused)
|
||||
return block;
|
||||
}
|
||||
|
||||
static void do_view3d_armature_settingsmenu(void *arg, int event)
|
||||
{
|
||||
setflag_armature(event);
|
||||
}
|
||||
|
||||
static uiBlock *view3d_armature_settingsmenu(void *arg_unused)
|
||||
{
|
||||
uiBlock *block;
|
||||
short yco= 0, menuwidth=120;
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "view3d_armature_settingsmenu",
|
||||
UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
|
||||
uiBlockSetButmFunc(block, do_view3d_armature_settingsmenu, NULL);
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Toggle a Setting|Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Enable a Setting|Ctrl Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Disable a Setting|Alt W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
uiTextBoundsBlock(block, 60);
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
static uiBlock *view3d_edit_armaturemenu(void *arg_unused)
|
||||
{
|
||||
@ -3937,6 +3960,7 @@ static uiBlock *view3d_edit_armaturemenu(void *arg_unused)
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBlockBut(block, view3d_edit_armature_parentmenu, NULL, ICON_RIGHTARROW_THIN, "Parent", 0, yco-=20, 120, 19, "");
|
||||
uiDefIconTextBlockBut(block, view3d_armature_settingsmenu, NULL, ICON_RIGHTARROW_THIN, "Bone Settings", 0, yco-=20, 120, 19, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
@ -4319,6 +4343,8 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
|
||||
|
||||
uiDefIconTextBlockBut(block, view3d_pose_armature_showhidemenu,
|
||||
NULL, ICON_RIGHTARROW_THIN, "Show/Hide Bones", 0, yco-=20, 120, 19, "");
|
||||
uiDefIconTextBlockBut(block, view3d_armature_settingsmenu,
|
||||
NULL, ICON_RIGHTARROW_THIN, "Bone Settings", 0, yco-=20, 120, 19, "");
|
||||
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
|
@ -2547,7 +2547,23 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
}
|
||||
break;
|
||||
case WKEY:
|
||||
if((G.qual==LR_SHIFTKEY)) {
|
||||
if ( ((ob) && (ob->flag & OB_POSEMODE)) ||
|
||||
((G.obedit) && (G.obedit->type==OB_ARMATURE)) )
|
||||
{
|
||||
if (G.qual) {
|
||||
if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY))
|
||||
val= 1;
|
||||
else if (G.qual == LR_ALTKEY)
|
||||
val= 2;
|
||||
else
|
||||
val= 0;
|
||||
|
||||
setflag_armature(val);
|
||||
}
|
||||
else if (G.qual == 0)
|
||||
special_editmenu();
|
||||
}
|
||||
else if((G.qual==LR_SHIFTKEY)) {
|
||||
initTransform(TFM_WARP, CTX_NONE);
|
||||
Transform();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user