fix [#24786] Setting Rotation Units to Radians doesn't affect the UI [33146]
This commit is contained in:
@@ -53,6 +53,7 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
|
|||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.row().prop(unit, "system", expand=True)
|
col.row().prop(unit, "system", expand=True)
|
||||||
|
col.row().prop(unit, "system_rotation", expand=True)
|
||||||
|
|
||||||
split = layout.split()
|
split = layout.split()
|
||||||
split.active = (unit.system != 'NONE')
|
split.active = (unit.system != 'NONE')
|
||||||
@@ -63,8 +64,6 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
|
|||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(unit, "use_separate")
|
col.prop(unit, "use_separate")
|
||||||
|
|
||||||
layout.column().prop(unit, "rotation_units")
|
|
||||||
|
|
||||||
|
|
||||||
class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
|
class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
|
||||||
bl_label = "Keying Sets"
|
bl_label = "Keying Sets"
|
||||||
|
@@ -255,6 +255,8 @@ static struct bUnitCollection buNaturalTimeCollecton = {buNaturalTimeDef, 3, 0,
|
|||||||
|
|
||||||
static struct bUnitDef buNaturalRotDef[] = {
|
static struct bUnitDef buNaturalRotDef[] = {
|
||||||
{"degree", "degrees", "°", NULL, "Degrees", M_PI/180.0, 0.0, B_UNIT_DEF_NONE},
|
{"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}
|
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
|
||||||
};
|
};
|
||||||
static struct bUnitCollection buNaturalRotCollection = {buNaturalRotDef, 0, 0, sizeof(buNaturalRotDef)/sizeof(bUnitDef)};
|
static struct bUnitCollection buNaturalRotCollection = {buNaturalRotDef, 0, 0, sizeof(buNaturalRotDef)/sizeof(bUnitDef)};
|
||||||
|
@@ -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 (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 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)
|
if (restore)
|
||||||
return M_PI / 180.0f; /* degrees to radians */
|
return M_PI / 180.0f; /* degrees to radians */
|
||||||
else
|
else
|
||||||
|
@@ -1252,8 +1252,8 @@ int ui_is_but_unit(uiBut *but)
|
|||||||
|
|
||||||
unit_type = RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
|
unit_type = RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
|
||||||
|
|
||||||
#if 0 // removed so angle buttons get correct snapping
|
#if 1 // removed so angle buttons get correct snapping
|
||||||
if (scene->unit.flag & USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -743,8 +743,10 @@ typedef struct bStats {
|
|||||||
typedef struct UnitSettings {
|
typedef struct UnitSettings {
|
||||||
/* Display/Editing unit options for each scene */
|
/* Display/Editing unit options for each scene */
|
||||||
float scale_length; /* maybe have other unit conversions? */
|
float scale_length; /* maybe have other unit conversions? */
|
||||||
short system;
|
char system; /* imperial, metric etc */
|
||||||
short flag; /* imperial, metric etc */
|
char system_rotation; /* not implimented as a propper unit system yet */
|
||||||
|
short flag;
|
||||||
|
|
||||||
} UnitSettings;
|
} UnitSettings;
|
||||||
|
|
||||||
typedef struct PhysicsSettings {
|
typedef struct PhysicsSettings {
|
||||||
|
@@ -1278,6 +1278,11 @@ static void rna_def_unit_settings(BlenderRNA *brna)
|
|||||||
RNA_def_property_enum_items(prop, unit_systems);
|
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_ui_text(prop, "Unit System", "The unit system to use for button display");
|
||||||
RNA_def_property_update(prop, NC_WINDOW, NULL);
|
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);
|
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");
|
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_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
|
||||||
RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs");
|
RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs");
|
||||||
RNA_def_property_update(prop, NC_WINDOW, NULL);
|
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)
|
void rna_def_render_layer_common(StructRNA *srna, int scene)
|
||||||
|
Reference in New Issue
Block a user