Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-04-07 14:10:37 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-04-07 14:17:01 +0400
commit8714ae09f89426242ecd0c65f3291de1a2b51fc4 (patch)
tree9bb7eae32b739ff7972670909271e81fa10fa186 /source/blender/makesrna/intern/rna_constraint.c
parentf3db0389c02bf9fec7a195fa5c2767e81337e3b2 (diff)
Fix T39563: Tiny unit-display problem in constraint panels.
There is no good solution here, since RNA props can only have one type/unit. Tried to find the less worse one - have different RNA props for same DNA value (a bit like the angle/length for camera lens). Also fixed two other issues with Transform conctraint: * Angle were still in degrees (yes, another backward-compatibility breacking). * Scale was absolute, unlike loc/rot. Also cleaned up a bit the code, replaced some magic numbers by proper enums, ...
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c153
1 files changed, 150 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index c0ad4fecc39..6d6ea80fec8 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1581,9 +1581,9 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem transform_items[] = {
- {0, "LOCATION", 0, "Loc", ""},
- {1, "ROTATION", 0, "Rot", ""},
- {2, "SCALE", 0, "Scale", ""},
+ {TRANS_LOCATION, "LOCATION", 0, "Loc", ""},
+ {TRANS_ROTATION, "ROTATION", 0, "Rot", ""},
+ {TRANS_SCALE, "SCALE", 0, "Scale", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1644,6 +1644,7 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ /* Loc */
prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
@@ -1715,6 +1716,152 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* Rot */
+ prop = RNA_def_property(srna, "from_min_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* Scale */
+ prop = RNA_def_property(srna, "from_min_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_location_limit(BlenderRNA *brna)