From 2068eaf1b7f7729198ad865f69fa3bd11d7a9edc Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 1 Nov 2009 11:29:40 +0000 Subject: Rigging Goodies: Spline IK Constraint At last, this commit introduces the Spline IK Constraint to Blender. Spline IK is a constraint that makes n bones follow the shape of a specified curve. Simply add a chain of bones, add a curve, add a Spline IK Constraint to the tip bone and set the number of bones in the chain to make it work. Or, try the following test file: http://download.blender.org/ftp/incoming/250_splineik_spine01.blend Screenshots of this in action (as proof): http://download.blender.org/ftp/incoming/b250_splineik_001_before.png http://download.blender.org/ftp/incoming/b250_splineik_001_after.png I've implemented this in a similar way to how standard IK solvers are done. However, this code is currently not an IK plugin, since I imagine that it would be useful to be able to combine the 2 types of IK. This can be easily changed though :) Finally, a few notes on what to expect still: * Constraint blending currently doesn't affect this. Getting that to work correctly will take a bit more work still. * Options for not affecting the root joint (to make it easier to attach the chain to a stump or whatever), and non-uniform scaling options have yet to be added. I've marked the places where they can be added though * Control over the twisting of the chain still needs investigation. Have fun! --- source/blender/blenkernel/BKE_armature.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/BKE_armature.h') diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 19c2662054b..03f23f07c8c 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -55,11 +55,14 @@ typedef struct PoseTarget typedef struct PoseTree { struct PoseTree *next, *prev; - + + int type; /* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */ + int totchannel; /* number of pose channels */ + struct ListBase targets; /* list of targets of the tree */ struct bPoseChannel **pchan; /* array of pose channels */ int *parent; /* and their parents */ - int totchannel; /* number of pose channels */ + float (*basis_change)[3][3]; /* basis change result from solver */ int iterations; /* iterations from the constraint */ int stretch; /* disable stretching */ -- cgit v1.2.3