diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-05-17 18:19:06 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-05-17 18:19:06 +0300 |
commit | 49aeee5a3dfa9fc0ae29e99f7c5c0cc0124e560e (patch) | |
tree | 49ace019e0509cd188f24d11c8f799ab676f6bbd /source/blender/makesdna | |
parent | 29a17d54da1f4b85a59487e032165bb44dc1b065 (diff) |
Bendy Bones: Advanced B-Bones for Easier + Simple Rigging
This commit/patch/branch brings a bunch of powerful new options for B-Bones and
for working with B-Bones, making it easier for animators to create their own
rigs, using fewer bones (which also means hopefully lighter + faster rigs ;)
This functionality was first demoed by Daniel at BConf15
Some highlights from this patch include:
* You can now directly control the shape of B-Bones using a series of properties
instead of being restricted to trying to indirectly control them through the
neighbouring bones. See the "Bendy Bones" panel...
* B-Bones can be shaped in EditMode to define a "curved rest pose" for the bone.
This is useful for things like eyebrows and mouths/eyelids
* You can now make B-Bones use custom bones as their reference bone handles,
instead of only using the parent/child bones. To do so, enable the
"Use Custom Reference Handles" toggle. If none are specified, then the BBone will
only use the Bendy Bone properties.
* Constraints Head/Tail option can now slide along the B-Bone shape, instead of
just linearly interpolating between the endpoints of the bone.
For more details, see:
* http://aligorith.blogspot.co.nz/2016/05/bendy-bones-dev-update.html
* http://aligorith.blogspot.co.nz/2016/05/an-in-depth-look-at-how-b-bones-work.html
-- Credits --
Original Idea: Daniel M Lara (pepeland)
Original Patch/Research: Jose Molina
Additional Development + Polish: Joshua Leung (aligorith)
Testing/Feedback: Daniel M Lara (pepeland), Juan Pablo Bouza (jpbouza)
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_action_types.h | 46 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_armature_types.h | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_constraint_types.h | 4 |
3 files changed, 47 insertions, 17 deletions
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 96d7ec3128c..4d82e4528d6 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -199,7 +199,8 @@ typedef struct bPoseChannel { char constflag; /* for quick detecting which constraints affect this channel */ char selectflag; /* copy of bone flag, so you can work with library armatures, not for runtime use */ char drawflag; - char pad0[5]; + char bboneflag; + char pad0[4]; struct Bone *bone; /* set on read file or rebuild pose */ struct bPoseChannel *parent; /* set on read file or rebuild pose */ @@ -242,7 +243,16 @@ typedef struct bPoseChannel { float ikstretch; float ikrotweight; /* weight of joint rotation constraint */ float iklinweight; /* weight of joint stretch constraint */ - + + /* curved bones settings - these are for animating, and are applied on top of the copies in pchan->bone */ + float roll1, roll2; + float curveInX, curveInY; + float curveOutX, curveOutY; + float scaleIn, scaleOut; + + struct bPoseChannel *bbone_prev; /* next/prev bones to use as handle references when calculating bbones (optional) */ + struct bPoseChannel *bbone_next; + void *temp; /* use for outliner */ } bPoseChannel; @@ -253,17 +263,17 @@ typedef enum ePchan_Flag { POSE_LOC = (1 << 0), POSE_ROT = (1 << 1), POSE_SIZE = (1 << 2), - /* old IK/cache stuff... */ -#if 0 - POSE_IK_MAT = (1 << 3), - POSE_UNUSED2 = (1 << 4), - POSE_UNUSED3 = (1 << 5), - POSE_UNUSED4 = (1 << 6), - POSE_UNUSED5 = (1 << 7), - /* has Standard IK */ - POSE_HAS_IK = (1 << 8), -#endif - /* IK/Pose solving*/ + + /* old IK/cache stuff + * - used to be here from (1 << 3) to (1 << 8) + * but has been repurposed since 2.77.2 + * as they haven't been used in over 10 years + */ + + /* has BBone deforms */ + POSE_BBONE_SHAPE = (1 << 3), + + /* IK/Pose solving */ POSE_CHAIN = (1 << 9), POSE_DONE = (1 << 10), /* visualization */ @@ -318,6 +328,16 @@ typedef enum ePchan_DrawFlag { #define PCHAN_CUSTOM_DRAW_SIZE(pchan) \ (pchan)->custom_scale * (((pchan)->drawflag & PCHAN_DRAW_NO_CUSTOM_BONE_SIZE) ? 1.0f : (pchan)->bone->length) +/* PoseChannel->bboneflag */ +typedef enum ePchan_BBoneFlag { + /* Use custom reference bones (for roll and handle alignment), instead of immediate neighbours */ + PCHAN_BBONE_CUSTOM_HANDLES = (1 << 1), + /* Evaluate start handle as being "relative" */ + PCHAN_BBONE_CUSTOM_START_REL = (1 << 2), + /* Evaluate end handle as being "relative" */ + PCHAN_BBONE_CUSTOM_END_REL = (1 << 3), +} ePchan_BBoneFlag; + /* PoseChannel->rotmode and Object->rotmode */ typedef enum eRotationModes { /* quaternion rotations (default, and for older Blender versions) */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index b995e6917a9..cda6441f0ae 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -68,11 +68,18 @@ typedef struct Bone { float xwidth, length, zwidth; /* width: for block bones. keep in this order, transform! */ float ease1, ease2; /* length of bezier handles */ float rad_head, rad_tail; /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head */ - + + float roll1, roll2; /* curved bones settings - these define the "restpose" for a curved bone */ + float curveInX, curveInY; + float curveOutX, curveOutY; + float scaleIn, scaleOut; + float size[3]; /* patch for upward compat, UNUSED! */ int layer; /* layers that bone appears on */ short segments; /* for B-bones */ - short pad[1]; + + short pad1; + } Bone; typedef struct bArmature { @@ -204,7 +211,8 @@ typedef enum eBone_Flag { BONE_TRANSFORM_CHILD = (1 << 20), /* Indicates that a parent is also being transformed */ BONE_UNSELECTABLE = (1 << 21), /* bone cannot be selected */ BONE_NO_LOCAL_LOCATION = (1 << 22), /* bone location is in armature space */ - BONE_RELATIVE_PARENTING = (1 << 23) /* object child will use relative transform (like deform) */ + BONE_RELATIVE_PARENTING = (1 << 23), /* object child will use relative transform (like deform) */ + BONE_ADD_PARENT_END_ROLL = (1 << 24) /* it will add the parent end roll to the inroll */ } eBone_Flag; diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 86991245068..5fcd374b21f 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -516,7 +516,9 @@ typedef enum eBConstraint_Flags { /* indicates that constraint was added locally (i.e. didn't come from the proxy-lib) */ CONSTRAINT_PROXY_LOCAL = (1<<8), /* indicates that constraint is temporarily disabled (only used in GE) */ - CONSTRAINT_OFF = (1<<9) + CONSTRAINT_OFF = (1<<9), + /* use bbone curve shape when calculating headtail values */ + CONSTRAINT_BBONE_SHAPE = (1<<10), } eBConstraint_Flags; /* bConstraint->ownspace/tarspace */ |