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/makesrna/intern/rna_armature.c | |
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/makesrna/intern/rna_armature.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index a8ef4664fd7..842e220e8b5 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -482,6 +482,82 @@ static void rna_Armature_transform(struct bArmature *arm, float *mat) #else +/* Settings for curved bbone settings - The posemode values get applied over the top of the editmode ones */ +void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone) +{ +#define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone) \ + { \ + if (is_posebone) \ + RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); \ + else \ + RNA_def_property_update(prop, 0, "rna_Armature_update_data"); \ + } (void)0; + + PropertyRNA *prop; + + /* Roll In/Out */ + prop = RNA_def_property(srna, "bbone_rollin", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "roll1"); + RNA_def_property_range(prop, -M_PI * 2.0f, M_PI * 2.0f); + RNA_def_property_ui_text(prop, "Roll In", "Roll offset for the start of the B-Bone, adjusts twist"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + + prop = RNA_def_property(srna, "bbone_rollout", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_float_sdna(prop, NULL, "roll2"); + RNA_def_property_range(prop, -M_PI * 2.0f, M_PI * 2.0f); + RNA_def_property_ui_text(prop, "Roll Out", "Roll offset for the end of the B-Bone, adjusts twist"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + + if (is_posebone == false) { + prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Inherit End Roll", "Use Roll Out of parent bone as Roll In of its children"); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ADD_PARENT_END_ROLL); + RNA_def_property_update(prop, 0, "rna_Armature_update_data"); + } + + /* Curve X/Y Offsets */ + prop = RNA_def_property(srna, "bbone_curveinx", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curveInX"); + RNA_def_property_range(prop, -5.0f, 5.0f); + RNA_def_property_ui_text(prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + + prop = RNA_def_property(srna, "bbone_curveiny", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curveInY"); + RNA_def_property_range(prop, -5.0f, 5.0f); + RNA_def_property_ui_text(prop, "In Y", "Y-axis handle offset for start of the B-Bone's curve, adjusts curvature"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + + prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curveOutX"); + RNA_def_property_range(prop, -5.0f, 5.0f); + RNA_def_property_ui_text(prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + + prop = RNA_def_property(srna, "bbone_curveouty", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curveOutY"); + RNA_def_property_range(prop, -5.0f, 5.0f); + RNA_def_property_ui_text(prop, "Out Y", "Y-axis handle offset for end of the B-Bone's curve, adjusts curvature"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + + /* Scale In/Out */ + prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "scaleIn"); + RNA_def_property_range(prop, 0.0f, 5.0f); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Scale In", "Scale factor for start of the B-Bone, adjusts thickness (for tapering effects)"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + + prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "scaleOut"); + RNA_def_property_range(prop, 0.0f, 5.0f); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_text(prop, "Scale Out", "Scale factor for end of the B-Bone, adjusts thickness (for tapering effects)"); + RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone); + +#undef RNA_DEF_CURVEBONE_UPDATE +} + static void rna_def_bone_common(StructRNA *srna, int editbone) { PropertyRNA *prop; @@ -653,6 +729,7 @@ static void rna_def_bone(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone"); rna_def_bone_common(srna, 0); + rna_def_bone_curved_common(srna, 0); /* XXX should we define this in PoseChannel wrapping code instead? * But PoseChannels directly get some of their flags from here... */ @@ -766,6 +843,7 @@ static void rna_def_edit_bone(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); rna_def_bone_common(srna, 1); + rna_def_bone_curved_common(srna, 0); prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_A); |