diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-04-15 20:25:41 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-04-16 18:41:57 +0300 |
commit | ad9275ed4e60b7ca4874bbb2c80fef6e2606eb39 (patch) | |
tree | 901785b1d79494754a4d96450ce13a093a74ab95 /source/blender/makesrna | |
parent | 752edc0a155a3cd9ff6b0152cd7c96cecd542c9b (diff) |
Spline IK: support changing individual bone length via Y scaling.
Previously Spline IK provided only two choices: either scale the
length of the bone chain to fit the length of the curve, or don't
scale the bone in the Y dimension at all (ignoring effects of
actually fitting to the curve due to curvature and curve object
scale).
This patch adds a new option to use the pre-IK Y scale of the
bones to adjust their length when fitted to the curve, allowing
individual posing control over the length of the segments.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D4687
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index bd7f75f86b5..731e25b7e9a 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -2262,6 +2262,15 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem splineik_y_scale_mode[] = { + {CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"}, + {CONSTRAINT_SPLINEIK_YS_FIT_CURVE, "FIT_CURVE", 0, "Fit Curve", + "Scale the bones to fit the entire length of the curve"}, + {CONSTRAINT_SPLINEIK_YS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", + "Use the original Y scale of the bone"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve"); RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data"); @@ -2308,11 +2317,6 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) "Ignore the relative lengths of the bones when fitting to the curve"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - prop = RNA_def_property(srna, "use_y_stretch", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_SCALE_LIMITED); - RNA_def_property_ui_text(prop, "Y Stretch", "Stretch the Y axis of the bones to fit the curve"); - RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); - prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD); RNA_def_property_ui_text(prop, "Use Curve Radius", @@ -2328,6 +2332,15 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) "Method used for determining the scaling of the X and Z axes of the bones"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + /* y scaling mode */ + prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "yScaleMode"); + RNA_def_property_enum_items(prop, splineik_y_scale_mode); + RNA_def_property_ui_text(prop, "Y Scale Mode", + "Method used for determining the scaling of the Y axis of the bones, " + "on top of the shape and scaling of the curve itself"); + RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + /* volume presevation for "volumetric" scale mode */ prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 100.f); |