diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-03-24 21:01:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-03-24 21:03:25 +0300 |
commit | 7f3da8f5c91e5dbf030b938a5d852ebc9ce6b361 (patch) | |
tree | cf1bbf56ee270930cb94dca16668739495f84329 /release/scripts/startup/bl_ui/properties_scene.py | |
parent | 9dc5e1dbc2b62b69833b8452fafd31e83292a96b (diff) |
UI: Presets for scene units
This adds simple preset menu for unit scale scene property.
D1799 by @alm
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_scene.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_scene.py | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index bbf11abe6d9..a05f0ac9618 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -18,7 +18,12 @@ # <pep8 compliant> import bpy -from bpy.types import Panel, UIList +from bpy.types import ( + Menu, + Panel, + UIList, + ) + from rna_prop_ui import PropertyPanel from bl_ui.properties_physics_common import ( @@ -27,6 +32,14 @@ from bl_ui.properties_physics_common import ( ) +class SCENE_MT_units_length_presets(Menu): + """Sets the unit of measure for properties that use length values""" + bl_label = "Unit Presets" + preset_subdir = "units_length" + preset_operator = "script.execute_preset" + draw = Menu.draw_preset + + class SCENE_UL_keying_set_paths(UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.KeyingSetPath) @@ -75,14 +88,28 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel): unit = context.scene.unit_settings - col = layout.column() - col.row().prop(unit, "system", expand=True) - col.row().prop(unit, "system_rotation", expand=True) + row = layout.row(align=True) + row.menu("SCENE_MT_units_length_presets", text=SCENE_MT_units_length_presets.bl_label) + row.operator("scene.units_length_preset_add", text="", icon='ZOOMIN') + row.operator("scene.units_length_preset_add", text="", icon='ZOOMOUT').remove_active = True - if unit.system != 'NONE': - row = layout.row() - row.prop(unit, "scale_length", text="Scale") - row.prop(unit, "use_separate") + layout.separator() + + split = layout.split(percentage=0.35) + split.label("Length:") + split.prop(unit, "system", text="") + split = layout.split(percentage=0.35) + split.label("Angle:") + split.prop(unit, "system_rotation", text="") + + col = layout.column() + col.enabled = unit.system != 'NONE' + split = col.split(percentage=0.35) + split.label("Unit Scale:") + split.prop(unit, "scale_length", text="") + split = col.split(percentage=0.35) + split.row() + split.prop(unit, "use_separate") class SceneKeyingSetsPanel: |