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.
This commit is contained in:
Matt Ebb 2010-01-25 10:05:17 +00:00
parent 0a0f4c9d81
commit 41499247db
4 changed files with 18 additions and 1 deletions

View File

@ -74,6 +74,8 @@ class SCENE_PT_unit(SceneButtonsPanel):
if wide_ui:
col = split.column()
col.prop(unit, "use_separate")
layout.column().prop(unit, "rotation_units")
class SCENE_PT_keying_sets(SceneButtonsPanel):

View File

@ -1232,7 +1232,10 @@ int ui_is_but_unit(uiBut *but)
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;
}

View File

@ -1221,6 +1221,7 @@ typedef enum SculptFlags {
#define USER_UNIT_IMPERIAL 2
/* UnitSettings->flag */
#define USER_UNIT_OPT_SPLIT 1
#define USER_UNIT_ROT_RADIANS 2
#ifdef __cplusplus

View File

@ -888,6 +888,11 @@ static void rna_def_unit_settings(BlenderRNA *brna)
{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 @@ static void rna_def_unit_settings(BlenderRNA *brna)
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)