Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-11-12 07:17:03 +0300
committerJoshua Leung <aligorith@gmail.com>2007-11-12 07:17:03 +0300
commit89317afbdfe19da951aeb2fa7764cc2f60b39f4d (patch)
tree4b8b0410ba9ab4c724d24be43a6882725ed972fb /source/blender/src
parent7f2e43968a917e4512117164a8645756893c93da (diff)
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.
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/buttons_object.c47
-rw-r--r--source/blender/src/editipo_lib.c5
2 files changed, 41 insertions, 11 deletions
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 98c2914cee4..3a2c7bda497 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -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, "");
diff --git a/source/blender/src/editipo_lib.c b/source/blender/src/editipo_lib.c
index f10e100df7d..6ef45f32620 100644
--- a/source/blender/src/editipo_lib.c
+++ b/source/blender/src/editipo_lib.c
@@ -61,7 +61,7 @@ char *ob_ic_names[OB_TOTNAM] = { "LocX", "LocY", "LocZ", "dLocX", "dLocY", "dLoc
"Layer", "Time", "ColR", "ColG", "ColB", "ColA",
"FStreng", "FFall", "RDamp", "Damping", "Perm" };
-char *co_ic_names[CO_TOTNAM] = { "Inf" };
+char *co_ic_names[CO_TOTNAM] = { "Inf", "HeadTail" };
char *mtex_ic_names[TEX_TOTNAM] = { "OfsX", "OfsY", "OfsZ", "SizeX", "SizeY", "SizeZ",
"texR", "texG", "texB", "DefVar", "Col", "Nor", "Var",
"Disp" };
@@ -191,6 +191,7 @@ char *getname_co_ei(int nr)
{
switch(nr){
case CO_ENFORCE:
+ case CO_HEADTAIL:
return co_ic_names[nr-1];
}
return ic_name_empty[0];
@@ -388,3 +389,5 @@ int texchannel_to_adrcode(int channel)
}
+
+