diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index c1c235d497b..ac319a545ac 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -351,7 +351,9 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) } } -static void rna_ConstraintTargetBone_target_set(PointerRNA *ptr, PointerRNA value) +static void rna_ConstraintTargetBone_target_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *UNUSED(reports)) { bConstraintTarget *tgt = (bConstraintTarget *)ptr->data; Object *ob = value.data; @@ -665,7 +667,9 @@ static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value) return 0; } -static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA value) +static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *UNUSED(reports)) { bConstraint *con = (bConstraint *)ptr->data; bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data; @@ -682,7 +686,9 @@ static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA va } } -static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerRNA value) +static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *UNUSED(reports)) { bConstraint *con = (bConstraint *)ptr->data; bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data; @@ -712,7 +718,9 @@ static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, Pointer return 0; } -static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA value) +static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, + PointerRNA value, + struct ReportList *UNUSED(reports)) { bConstraint *con = (bConstraint *)ptr->data; bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data; @@ -1327,6 +1335,13 @@ static void rna_def_constraint_size_like(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "power"); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3); + RNA_def_property_ui_text(prop, "Power", "Raise the target's scale to the specified power"); + RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET); RNA_def_property_ui_text(prop, "Offset", "Combine original scale with copied scale"); @@ -1346,13 +1361,34 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem volume_items[] = { + static const EnumPropertyItem axis_items[] = { {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""}, {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""}, {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""}, {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem mode_items[] = { + {SAMEVOL_STRICT, + "STRICT", + 0, + "Strict", + "Volume is strictly preserved, overriding the scaling of non-free axes"}, + {SAMEVOL_UNIFORM, + "UNIFORM", + 0, + "Uniform", + "Volume is preserved when the object is scaled uniformly. " + "Deviations from uniform scale on non-free axes are passed through"}, + {SAMEVOL_SINGLE_AXIS, + "SINGLE_AXIS", + 0, + "Single Axis", + "Volume is preserved when the object is scaled only on the free axis. " + "Non-free axis scaling is passed through"}, + {0, NULL, 0, NULL, NULL}, + }; + srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint"); RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", @@ -1360,11 +1396,18 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna) RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data"); prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "flag"); - RNA_def_property_enum_items(prop, volume_items); + RNA_def_property_enum_sdna(prop, NULL, "free_axis"); + RNA_def_property_enum_items(prop, axis_items); RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "mode"); + RNA_def_property_enum_items(prop, mode_items); + RNA_def_property_ui_text( + prop, "Mode", "The way the constraint treats original non-free axis scaling"); + RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_range(prop, 0.001f, 100.0f); RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest"); @@ -2576,6 +2619,13 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) "on top of the shape and scaling of the curve itself"); RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update"); + /* take original scaling of the bone into account in volume preservation */ + prop = RNA_def_property(srna, "use_original_scale", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE); + RNA_def_property_ui_text( + prop, "Use Original Scale", "Apply volume preservation over the original scaling"); + 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); |