[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33159] trunk/blender: fix [#24786] Setting Rotation Units to Radians doesn't affect the UI [33146]
Campbell Barton
ideasman42 at gmail.com
Thu Nov 18 15:10:09 CET 2010
Revision: 33159
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33159
Author: campbellbarton
Date: 2010-11-18 15:10:09 +0100 (Thu, 18 Nov 2010)
Log Message:
-----------
fix [#24786] Setting Rotation Units to Radians doesn't affect the UI [33146]
Modified Paths:
--------------
trunk/blender/release/scripts/ui/properties_scene.py
trunk/blender/source/blender/blenkernel/intern/unit.c
trunk/blender/source/blender/editors/animation/anim_draw.c
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-11-18 13:52:09 UTC (rev 33158)
+++ trunk/blender/release/scripts/ui/properties_scene.py 2010-11-18 14:10:09 UTC (rev 33159)
@@ -53,6 +53,7 @@
col = layout.column()
col.row().prop(unit, "system", expand=True)
+ col.row().prop(unit, "system_rotation", expand=True)
split = layout.split()
split.active = (unit.system != 'NONE')
@@ -63,9 +64,7 @@
col = split.column()
col.prop(unit, "use_separate")
- layout.column().prop(unit, "rotation_units")
-
class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
bl_label = "Keying Sets"
Modified: trunk/blender/source/blender/blenkernel/intern/unit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/unit.c 2010-11-18 13:52:09 UTC (rev 33158)
+++ trunk/blender/source/blender/blenkernel/intern/unit.c 2010-11-18 14:10:09 UTC (rev 33159)
@@ -255,6 +255,8 @@
static struct bUnitDef buNaturalRotDef[] = {
{"degree", "degrees", "°", NULL, "Degrees", M_PI/180.0, 0.0, B_UNIT_DEF_NONE},
+// {"radian", "radians", "r", NULL, "Radians", 1.0, 0.0, B_UNIT_DEF_NONE},
+// {"turn", "turns", "t", NULL, "Turns", 1.0/(M_PI*2.0), 0.0,B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
static struct bUnitCollection buNaturalRotCollection = {buNaturalRotDef, 0, 0, sizeof(buNaturalRotDef)/sizeof(bUnitDef)};
Modified: trunk/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_draw.c 2010-11-18 13:52:09 UTC (rev 33158)
+++ trunk/blender/source/blender/editors/animation/anim_draw.c 2010-11-18 14:10:09 UTC (rev 33159)
@@ -392,7 +392,7 @@
if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION)
{
/* if the radians flag is not set, default to using degrees which need conversions */
- if ((scene) && (scene->unit.flag & USER_UNIT_ROT_RADIANS) == 0) {
+ if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) {
if (restore)
return M_PI / 180.0f; /* degrees to radians */
else
Modified: trunk/blender/source/blender/editors/interface/interface.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface.c 2010-11-18 13:52:09 UTC (rev 33158)
+++ trunk/blender/source/blender/editors/interface/interface.c 2010-11-18 14:10:09 UTC (rev 33159)
@@ -1252,8 +1252,8 @@
unit_type = RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
-#if 0 // removed so angle buttons get correct snapping
- if (scene->unit.flag & USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
+#if 1 // removed so angle buttons get correct snapping
+ if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
return 0;
#endif
Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h 2010-11-18 13:52:09 UTC (rev 33158)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h 2010-11-18 14:10:09 UTC (rev 33159)
@@ -743,8 +743,10 @@
typedef struct UnitSettings {
/* Display/Editing unit options for each scene */
float scale_length; /* maybe have other unit conversions? */
- short system;
- short flag; /* imperial, metric etc */
+ char system; /* imperial, metric etc */
+ char system_rotation; /* not implimented as a propper unit system yet */
+ short flag;
+
} UnitSettings;
typedef struct PhysicsSettings {
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2010-11-18 13:52:09 UTC (rev 33158)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2010-11-18 14:10:09 UTC (rev 33159)
@@ -1278,6 +1278,11 @@
RNA_def_property_enum_items(prop, unit_systems);
RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop= RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
+ 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);
prop= RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions");
@@ -1289,12 +1294,6 @@
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