Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2019-12-12 19:56:20 +0300
committerHans Goudey <h.goudey@me.com>2019-12-12 19:56:20 +0300
commitd7a8a606889fed58775c88bfdc079bee3c9333e2 (patch)
treec8bb638791aa8445a7d9654b881001289ddcb322 /release/scripts/startup/bl_ui/space_topbar.py
parentc8d121bf352b7a688015918d819a6f01f276e4f6 (diff)
UI: Add extra bevel options to popover from tool settings bar
Also adds a generic popover that can be used whenever an active tool has too many settings than can fit in the horizontal area. The popover calls the active tool's draw_settings with "extra" set to True.
Diffstat (limited to 'release/scripts/startup/bl_ui/space_topbar.py')
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 09531cb5ef6..2e2c5adb970 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -20,7 +20,6 @@
import bpy
from bpy.types import Header, Menu, Panel
-
class TOPBAR_HT_upper_bar(Header):
bl_space_type = 'TOPBAR'
@@ -78,6 +77,30 @@ class TOPBAR_HT_upper_bar(Header):
unlink="scene.view_layer_remove")
+class TOPBAR_PT_tool_settings_extra(Panel):
+ """
+ Popover panel for adding extra options that don't fit in the tool settings header
+ """
+ bl_idname = "TOPBAR_PT_tool_settings_extra"
+ bl_region_type = 'HEADER'
+ bl_space_type = 'TOPBAR'
+ bl_label = "Extra Options"
+
+ def draw(self, context):
+ from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
+ layout = self.layout
+
+ # Get the active tool
+ space_type, mode = ToolSelectPanelHelper._tool_key_from_context(context)
+ cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type)
+ item, tool, _ = cls._tool_get_active(context, space_type, mode, with_icon=True)
+ if item is None:
+ return
+
+ # Draw the extra settings
+ item.draw_settings(context, layout, tool, extra=True)
+
+
class TOPBAR_PT_tool_fallback(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
@@ -790,6 +813,7 @@ classes = (
TOPBAR_MT_window,
TOPBAR_MT_help,
TOPBAR_PT_tool_fallback,
+ TOPBAR_PT_tool_settings_extra,
TOPBAR_PT_gpencil_layers,
TOPBAR_PT_gpencil_primitive,
TOPBAR_PT_gpencil_fill,