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
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.
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_toolbar.py50
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py26
2 files changed, 70 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index f0c1b0d135f..639fb2a31a4 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -590,12 +590,52 @@ class _defs_edit_mesh:
@ToolDef.from_fn
def bevel():
- def draw_settings(_context, layout, tool):
+ def draw_settings(context, layout, tool, *, extra=False):
props = tool.operator_properties("mesh.bevel")
- layout.prop(props, "offset_type")
- layout.prop(props, "segments")
- layout.prop(props, "profile", slider=True)
- layout.prop(props, "vertex_only")
+ region_type = context.region.type
+
+ if extra == False:
+ if props.offset_type == 'PERCENT':
+ layout.prop(props, "offset_pct")
+ else:
+ offset_text = "Width"
+ if props.offset_type == 'DEPTH':
+ offset_text = "Depth"
+ elif props.offset_type == 'OFFSET':
+ offset_text = "Offset"
+ layout.prop(props, "offset", text=offset_text)
+ if region_type == 'TOOL_HEADER':
+ layout.prop(props, "offset_type", text="")
+ else:
+ layout.prop(props, "offset_type")
+
+ layout.prop(props, "segments")
+ layout.prop(props, "profile", slider=True)
+
+ if region_type == 'TOOL_HEADER':
+ layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
+ else:
+ extra = True
+
+ if extra or region_type != 'TOOL_HEADER':
+ layout.prop(props, "vertex_only")
+ layout.prop(props, "clamp_overlap")
+ layout.prop(props, "loop_slide")
+ layout.prop(props, "mark_seam")
+ layout.prop(props, "mark_sharp")
+ layout.prop(props, "harden_normals")
+
+ layout.prop(props, "material")
+
+ layout.prop(props, "miter_outer", text="Outer Miter")
+ layout.prop(props, "miter_inner", text="Inner Miter")
+ if props.miter_inner == 'ARC':
+ layout.prop(props, "spread")
+
+ layout.prop(props, "use_custom_profile")
+ if props.use_custom_profile:
+ tool_settings = context.tool_settings
+ layout.template_curveprofile(tool_settings, "custom_bevel_profile_preset")
return dict(
idname="builtin.bevel",
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,