fix [#24786] Setting Rotation Units to Radians doesn't affect the UI [33146]

This commit is contained in:
Campbell Barton
2010-11-18 14:10:09 +00:00
parent 4045e838df
commit 3ae670fc02
6 changed files with 15 additions and 13 deletions

View File

@@ -53,6 +53,7 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
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,8 +64,6 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
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"

View File

@@ -255,6 +255,8 @@ static struct bUnitCollection buNaturalTimeCollecton = {buNaturalTimeDef, 3, 0,
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)};

View File

@@ -392,7 +392,7 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res
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

View File

@@ -1252,8 +1252,8 @@ int ui_is_but_unit(uiBut *but)
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

View File

@@ -743,8 +743,10 @@ typedef struct bStats {
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 {

View File

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