diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-27 14:50:26 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-13 16:22:34 +0300 |
commit | 7a10cfe7fe01bbeb7588239a9fd743ecc6af6c39 (patch) | |
tree | 05b5b281f0aef36fc27bcaf4b8b9aa9e14d193e3 /release/scripts/startup/bl_ui/properties_scene.py | |
parent | 1664ccb6752adf1bcf326b72d1230aa9b667a1fb (diff) |
UI: preset popover buttons in panel headers.
Moves the preset into a menu for the panel header, so it can be changed
without opening the panel and takes up less space. Two remaining issues:
* For long lists the add new preset button can be scrolled off screen.
* We should support showing the name of the chosen preset in the panel
header, but the current preset system does not support detecting which
preset is used.
Differential Revision: https://developer.blender.org/D3366
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_scene.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_scene.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index bcffe9795cc..9c5cf3a4d6d 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -25,6 +25,7 @@ from bpy.types import ( ) from rna_prop_ui import PropertyPanel +from bl_operators.presets import PresetMenu from .properties_physics_common import ( point_cache_ui, @@ -32,12 +33,12 @@ from .properties_physics_common import ( ) -class SCENE_MT_units_length_presets(Menu): +class SCENE_MT_units_length_presets(PresetMenu): """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 + preset_add_operator = "scene.units_length_preset_add" class SCENE_UL_keying_set_paths(UIList): @@ -81,16 +82,14 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel): bl_label = "Units" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} + def draw_header_preset(self, context): + SCENE_MT_units_length_presets.draw_panel_header(self.layout) + def draw(self, context): layout = self.layout unit = context.scene.unit_settings - 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 - layout.use_property_split = True col = layout.column() |