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:
authorMatt Ebb <matt@mke3.net>2010-01-25 09:24:05 +0300
committerMatt Ebb <matt@mke3.net>2010-01-25 09:24:05 +0300
commit0c5998e7998cba70d1dceacc5ed8109a5bba9e23 (patch)
treef9e250055d9de1647b283e7c493902bc51f0a9a5 /source/blender/makesrna/intern/rna_constraint.c
parentc94f385fce14fa5beb8637590ad4d4662cd733c6 (diff)
Radians -> Degrees (in UI)
Rotations are now stored internally as radians, while exposing degrees in the UI - in the graph editor and UI controls. This is done in two areas: 1) Using the unit system to convert RNA data to display as degrees in the UI controls 2) FCurves now use degrees for rotation, so you can edit in the graph editor what you see in the UI. All rotation data is consistently accessible in DNA and RNA as radians, degrees are only used for the UI controls and graph editor. This commit includes conversions will convert old files (stored data and also fcurve data) to the new units, hopefully everything should go smoothly! Part of this also changes a few properties that were hard-coded as degrees before (such as IK pole angle and brush texture rotation) to also use the same consistent system of radians (dna/rna) and degrees (ui). Thanks to Joshua for hints and review here too.
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 5ec8d438c42..1f023555456 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -29,6 +29,8 @@
#include "rna_internal.h"
+#include "BLI_math.h"
+
#include "DNA_action_types.h"
#include "DNA_constraint_types.h"
#include "DNA_modifier_types.h"
@@ -488,9 +490,9 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
- prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE); // XXX - todo, convert to rad
+ prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "poleangle");
- RNA_def_property_range(prop, -180.0f, 180.f);
+ RNA_def_property_range(prop, -M_PI, M_PI);
RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1190,21 +1192,21 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
+ prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "axX");
- RNA_def_property_range(prop, -360.0, 360.f);
+ RNA_def_property_range(prop, -M_PI*2, M_PI*2);
RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
+ prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "axY");
- RNA_def_property_range(prop, -360.0, 360.f);
+ RNA_def_property_range(prop, -M_PI*2, M_PI*2);
RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE); // XXX - convert to radians
+ prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "axZ");
- RNA_def_property_range(prop, -360.0, 360.f);
+ RNA_def_property_range(prop, -M_PI*2, M_PI*2);
RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");