Patch #7767: Constraint Subtargets can now target anywhere on a bone, not just the head or tail
Patch by: Roland Hess (harkyman) For example, a constraint can be sub-targeted at the 50% (or 31.2% or 85% etc.) point of its target bone, giving you enormous rigging flexibility and removing the need for complex contraptions to do such things as: - A bone whose base slides only between to points on a rig (CopyLoc with a variable, animated subtarget point) - Bones that attach to multiple points along another bone (CopyLocs, each with a different head/tail percentage) - Bones that need to stretch to a point midway between specific spots on two other bones (old way: too crazy to mention; new way: stretch bone between points on end bones, then another stretch to the midpoint of the first stretch) It is only used for the constraint types for which it is relevant: CopyLoc, TrackTo, StretchTo and MinMax, TrackTo, and Floor. Notes: - This is accessed by the Head/Tail number-slider. - This value can be animated per constraint - The old "Copy Bone Tail" option for the CopyLoc constraint has been automatically converted to 1.0 Head/Bone values for the affected constraints - In the code, this value is in the bConstraint struct, so it is available for all constraints, even though only a few implement it.
This commit is contained in:
@@ -494,7 +494,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
|
||||
Object *ob= OBACT;
|
||||
bConstraintTypeInfo *cti;
|
||||
uiBut *but;
|
||||
char typestr[64];
|
||||
char typestr[32];
|
||||
short height, width = 265;
|
||||
int rb_col;
|
||||
|
||||
@@ -807,7 +807,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
|
||||
/* Draw options */
|
||||
uiDefButBitI(block, TOG, LOCLIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-89, (width/2), 18, &data->flag, 0, 24, 0, 0, "Add original location onto copied location");
|
||||
if (is_armature_target(data->tar)) {
|
||||
uiDefButBitI(block, TOG, LOCLIKE_TIP, B_CONSTRAINT_TEST, "Target Bone Tail", *xco+(width/2), *yco-89, (width/2), 18, &data->flag, 0, 24, 0, 0, "Copy Location of Target Bone's Tail");
|
||||
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco+(width/2), *yco-89, (width/2), 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
|
||||
}
|
||||
|
||||
/* constraint space settings */
|
||||
@@ -978,7 +978,11 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
|
||||
{
|
||||
bTrackToConstraint *data = con->data;
|
||||
|
||||
height = 96;
|
||||
if (is_armature_target(data->tar))
|
||||
height = 118;
|
||||
else
|
||||
height = 96;
|
||||
|
||||
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
|
||||
|
||||
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
|
||||
@@ -1025,15 +1029,27 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
|
||||
uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z", *xco+238, *yco-64,17,18, &data->reserved2, 13.0, 2.0, 0, 0, "Z axis points upward");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* constraint space settings */
|
||||
draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
|
||||
if (is_armature_target(data->tar)) {
|
||||
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco, *yco-94, 241, 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
|
||||
|
||||
/* constraint space settings */
|
||||
draw_constraint_spaceselect(block, con, *xco, *yco-116, is_armature_owner(ob), is_armature_target(data->tar));
|
||||
}
|
||||
else {
|
||||
/* constraint space settings */
|
||||
draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONSTRAINT_TYPE_MINMAX:
|
||||
{
|
||||
bMinMaxConstraint *data = con->data;
|
||||
|
||||
height = 66;
|
||||
if (is_armature_target(data->tar))
|
||||
height = 88;
|
||||
else
|
||||
height = 66;
|
||||
|
||||
uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, "");
|
||||
|
||||
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", *xco+65, *yco-24, 50, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
|
||||
@@ -1070,6 +1086,11 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
|
||||
uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Y", *xco+126, *yco-64,24,18, &data->minmaxflag, 12.0, 4.0, 0, 0, "Will not pass above Y of target");
|
||||
uiDefButI(block, ROW, B_CONSTRAINT_TEST,"-Z", *xco+150, *yco-64,24,18, &data->minmaxflag, 12.0, 5.0, 0, 0, "Will not pass above Z of target");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
if (is_armature_target(data->tar)) {
|
||||
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco, *yco-86, 241, 18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case CONSTRAINT_TYPE_LOCKTRACK:
|
||||
@@ -1181,13 +1202,19 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block,BUTM,B_CONSTRAINT_TEST,"R",*xco, *yco-60,20,18,&(data->orglength),0.0,0,0,0,"Recalculate RLength");
|
||||
uiDefButF(block,NUM,B_CONSTRAINT_TEST,"Rest Length:",*xco+18, *yco-60,237,18,&(data->orglength),0.0,100,0.5,0.5,"Length at Rest Position");
|
||||
if (is_armature_target(data->tar)) {
|
||||
uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", *xco, *yco-60, 20, 18, &data->orglength, 0.0, 0, 0, 0, "Recalculate RLength");
|
||||
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Rest Length:", *xco+18, *yco-60,139,18, &data->orglength, 0.0, 100, 0.5, 0.5, "Length at Rest Position");
|
||||
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Head/Tail:", *xco+155, *yco-60,97,18, &con->headtail, 0.0, 1, 0.1, 0.1, "Target along length of bone: Head=0, Tail=1");
|
||||
}
|
||||
else {
|
||||
uiDefButF(block, BUTM, B_CONSTRAINT_TEST, "R", *xco, *yco-60, 20, 18, &data->orglength, 0.0, 0, 0, 0, "Recalculate RLength");
|
||||
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Rest Length:", *xco+18, *yco-60, 237, 18, &data->orglength, 0.0, 100, 0.5, 0.5, "Length at Rest Position");
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiDefButF(block,NUM,B_CONSTRAINT_TEST,"Volume Variation:",*xco+18, *yco-82,237,18,&(data->bulge),0.0,100,0.5,0.5,"Factor between volume variation and stretching");
|
||||
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Volume Variation:", *xco+18, *yco-82, 237, 18, &data->bulge, 0.0, 100, 0.5, 0.5, "Factor between volume variation and stretching");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Vol:",*xco+14, *yco-104,30,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
|
||||
|
||||
Reference in New Issue
Block a user