[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26240] trunk/blender: Add option to choose between radians or degrees for rotation units in the UI .
Matt Ebb
matt at mke3.net
Mon Jan 25 11:05:17 CET 2010
Revision: 26240
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26240
Author: broken
Date: 2010-01-25 11:05:17 +0100 (Mon, 25 Jan 2010)
Log Message:
-----------
Add option to choose between radians or degrees for rotation units in the UI.
Setting is in Scene->unit settings with the others, degrees by default.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/properties_scene.py
trunk/blender/source/blender/editors/interface/interface.c
trunk/blender/source/blender/makesdna/DNA_scene_types.h
trunk/blender/source/blender/makesrna/intern/rna_scene.c
Modified: trunk/blender/release/scripts/ui/properties_scene.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_scene.py 2010-01-25 09:44:04 UTC (rev 26239)
+++ trunk/blender/release/scripts/ui/properties_scene.py 2010-01-25 10:05:17 UTC (rev 26240)
@@ -74,6 +74,8 @@
if wide_ui:
col = split.column()
col.prop(unit, "use_separate")
+
+ layout.column().prop(unit, "rotation_units")
class SCENE_PT_keying_sets(SceneButtonsPanel):
Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c 2010-01-25 09:44:04 UTC (rev 26239)
+++ trunk/blender/source/blender/editors/interface/interface.c 2010-01-25 10:05:17 UTC (rev 26240)
@@ -1232,7 +1232,10 @@
unit_type = RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
- if(scene->unit.system == USER_UNIT_NONE) {
+ if (scene->unit.flag & USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
+ return 0;
+
+ if (scene->unit.system == USER_UNIT_NONE) {
if (unit_type != PROP_UNIT_ROTATION)
return 0;
}
Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h 2010-01-25 09:44:04 UTC (rev 26239)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h 2010-01-25 10:05:17 UTC (rev 26240)
@@ -1221,6 +1221,7 @@
#define USER_UNIT_IMPERIAL 2
/* UnitSettings->flag */
#define USER_UNIT_OPT_SPLIT 1
+#define USER_UNIT_ROT_RADIANS 2
#ifdef __cplusplus
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2010-01-25 09:44:04 UTC (rev 26239)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2010-01-25 10:05:17 UTC (rev 26240)
@@ -888,6 +888,11 @@
{USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
{USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
{0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem rotation_units[] = {
+ {0, "DEGREES", 0, "Degrees", ""},
+ {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
+ {0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UnitSettings", NULL);
RNA_def_struct_ui_text(srna, "Unit Settings", "");
@@ -908,6 +913,12 @@
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs.");
RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop= RNA_def_property(srna, "rotation_units", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, rotation_units);
+ RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
}
void rna_def_render_layer_common(StructRNA *srna, int scene)
More information about the Bf-blender-cvs
mailing list