diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-11-12 07:17:03 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-11-12 07:17:03 +0300 |
commit | 89317afbdfe19da951aeb2fa7764cc2f60b39f4d (patch) | |
tree | 4b8b0410ba9ab4c724d24be43a6882725ed972fb /source/blender/blenloader | |
parent | 7f2e43968a917e4512117164a8645756893c93da (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/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 615d1759f66..2e4c56dbc9c 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6827,11 +6827,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) bConstraint *con; bConstraintTarget *ct; - for(ob = main->object.first; ob; ob= ob->id.next) { - if(ob->pose) { - for(pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { - for(con=pchan->constraints.first; con; con=con->next) { - if(con->type==CONSTRAINT_TYPE_PYTHON) { + for (ob = main->object.first; ob; ob= ob->id.next) { + if (ob->pose) { + for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { + for (con=pchan->constraints.first; con; con=con->next) { + if (con->type == CONSTRAINT_TYPE_PYTHON) { bPythonConstraint *data= (bPythonConstraint *)con->data; if (data->tar) { /* version patching needs to be done */ @@ -6849,12 +6849,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main) strcpy(data->subtarget, ""); } } + else if (con->type == CONSTRAINT_TYPE_LOCLIKE) { + bLocateLikeConstraint *data= (bLocateLikeConstraint *)con->data; + + /* new headtail functionality makes Bone-Tip function obsolete */ + if (data->flag & LOCLIKE_TIP) + con->headtail = 1.0f; + } } } } - for(con=ob->constraints.first; con; con=con->next) { - if(con->type==CONSTRAINT_TYPE_PYTHON) { + for (con=ob->constraints.first; con; con=con->next) { + if (con->type==CONSTRAINT_TYPE_PYTHON) { bPythonConstraint *data= (bPythonConstraint *)con->data; if (data->tar) { /* version patching needs to be done */ @@ -6872,6 +6879,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) strcpy(data->subtarget, ""); } } + else if (con->type == CONSTRAINT_TYPE_LOCLIKE) { + bLocateLikeConstraint *data= (bLocateLikeConstraint *)con->data; + + /* new headtail functionality makes Bone-Tip function obsolete */ + if (data->flag & LOCLIKE_TIP) + con->headtail = 1.0f; + } } } } |