diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-12-11 19:17:39 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2021-06-18 18:56:03 +0300 |
commit | 682a74e0909ba4e669a3f282b3bc5da0ae81e4da (patch) | |
tree | 85aecf8652ddc680973a8cf9eed3a5b60b8a36d7 /source/blender/makesrna/intern | |
parent | aee04d496035c2b11b640a91b2e7eca86e878cf2 (diff) |
Armature: add B-Bone Y scale channel and extra flag fields to DNA.
In addition to the base bone transformation itself, B-Bones have
controls that affect transformation of its segments. For rotation
the features are quite complete, allowing to both reorient the
Bezier handles via properties, and to control them using custom
handle bones. However for scaling there are two deficiencies.
First, there are only X and Y scale factors (actually X and Z),
while lengthwise all segments have the same scaling. The ease
option merely affects the shape of the curve, and does not cause
actual scaling.
Second, scaling can only be controlled via properties, thus
requiring up to 6 drivers per joint between B-Bones to transfer
scaling factors from the handle bone. This is very inefficient.
Finally, the Z channels are confusingly called Y.
This commit adds a B-Bone Y Scale channel and extra B-Bone flag
fields to DNA with appropriate versioning (including for F-Curves
and drivers) in preparation to addressing these limitations.
Functionality is not changed, so the new fields are not used
until the following commits.
Differential Revision: https://developer.blender.org/D9870
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index c8fccfc27f8..53ccdb3b2b7 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -720,7 +720,7 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text( prop, "Inherit End Roll", "Add Roll Out of the Start Handle bone to the Roll In value"); - RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ADD_PARENT_END_ROLL); + RNA_def_property_boolean_sdna(prop, NULL, "bbone_flag", BBONE_ADD_PARENT_END_ROLL); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_Armature_dependency_update"); } @@ -733,11 +733,11 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_curveiny", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "curve_in_y"); + prop = RNA_def_property(srna, "bbone_curveinz", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curve_in_z"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_ui_text( - prop, "In Y", "Y-axis handle offset for start of the B-Bone's curve, adjusts curvature"); + prop, "In Z", "Z-axis handle offset for start of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE); @@ -747,11 +747,11 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_curveouty", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "curve_out_y"); + prop = RNA_def_property(srna, "bbone_curveoutz", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curve_out_z"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_ui_text( - prop, "Out Y", "Y-axis handle offset for end of the B-Bone's curve, adjusts curvature"); + prop, "Out Z", "Z-axis handle offset for end of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); /* Ease In/Out */ @@ -769,49 +769,30 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bezier Handle (for B-Bones only)"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - /* Scale In/Out */ - prop = RNA_def_property(srna, "bbone_scaleinx", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_in_x"); - RNA_def_property_flag(prop, PROP_PROPORTIONAL); - RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale In X", - "X-axis scale factor for start of the B-Bone, " - "adjusts thickness (for tapering effects)"); - RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - - prop = RNA_def_property(srna, "bbone_scaleiny", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_in_y"); - RNA_def_property_flag(prop, PROP_PROPORTIONAL); - RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale In Y", - "Y-axis scale factor for start of the B-Bone, " - "adjusts thickness (for tapering effects)"); - RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_scaleoutx", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_out_x"); + /* Scale In/Out */ + prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "scale_in"); + RNA_def_property_array(prop, 3); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale Out X", - "X-axis scale factor for end of the B-Bone, " - "adjusts thickness (for tapering effects)"); + RNA_def_property_float_array_default(prop, rna_default_scale_3d); + RNA_def_property_ui_text( + prop, + "Scale In", + "Scale factors for the start of the B-Bone, adjusts thickness (for tapering effects)"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_scaleouty", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_out_y"); + prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "scale_out"); + RNA_def_property_array(prop, 3); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale Out Y", - "Y-axis scale factor for end of the B-Bone, " - "adjusts thickness (for tapering effects)"); + RNA_def_property_float_array_default(prop, rna_default_scale_3d); + RNA_def_property_ui_text( + prop, + "Scale Out", + "Scale factors for the end of the B-Bone, adjusts thickness (for tapering effects)"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); # undef RNA_DEF_CURVEBONE_UPDATE |