[Bf-blender-cvs] [2ee2f87f29b] blender-v2.92-release: Add Object Tool: move extra settings popover last

Campbell Barton noreply at git.blender.org
Sun Jan 17 11:37:47 CET 2021


Commit: 2ee2f87f29bb35642f0eb0a195f267608cca0196
Author: Campbell Barton
Date:   Sun Jan 17 21:33:37 2021 +1100
Branches: blender-v2.92-release
https://developer.blender.org/rB2ee2f87f29bb35642f0eb0a195f267608cca0196

Add Object Tool: move extra settings popover last

This is intended to be used when settings don't fit in the top bar,
so it makes sense to keep them last.

===================================================================

M	release/scripts/startup/bl_ui/space_toolsystem_toolbar.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index 1b2303b6e7d..ba165d1e86c 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -474,6 +474,7 @@ class _defs_view3d_add:
     # this shows limits in layout engine, as buttons are using a lot of space.
     @staticmethod
     def draw_settings_interactive_add(layout, tool, extra):
+        show_extra = False
         props = tool.operator_properties("view3d.interactive_add")
         if not extra:
             row = layout.row()
@@ -494,7 +495,8 @@ class _defs_view3d_add:
             region_is_header = bpy.context.region.type == 'TOOL_HEADER'
 
             if region_is_header:
-                layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
+                # Don't draw the "extra" popover here as we might have other settings & this should be last.
+                show_extra = True
             else:
                 extra = True
 
@@ -508,12 +510,15 @@ class _defs_view3d_add:
             layout.label(text="Height")
             layout.row().prop(props, "plane_origin_depth", expand=True)
             layout.row().prop(props, "plane_aspect_depth", expand=True)
-
+        return show_extra
 
     @ToolDef.from_fn
     def cube_add():
         def draw_settings(_context, layout, tool, *, extra=False):
-            _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
+            show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
+            if show_extra:
+                layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
+
         return dict(
             idname="builtin.primitive_cube_add",
             label="Add Cube",
@@ -529,13 +534,17 @@ class _defs_view3d_add:
     @ToolDef.from_fn
     def cone_add():
         def draw_settings(_context, layout, tool, *, extra=False):
-            _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
+            show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
             if extra:
                 return
 
             props = tool.operator_properties("mesh.primitive_cone_add")
             layout.prop(props, "vertices")
             layout.prop(props, "end_fill_type")
+
+            if show_extra:
+                layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
+
         return dict(
             idname="builtin.primitive_cone_add",
             label="Add Cone",
@@ -551,13 +560,16 @@ class _defs_view3d_add:
     @ToolDef.from_fn
     def cylinder_add():
         def draw_settings(_context, layout, tool, *, extra=False):
-            _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
+            show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
             if extra:
                 return
 
             props = tool.operator_properties("mesh.primitive_cylinder_add")
             layout.prop(props, "vertices")
             layout.prop(props, "end_fill_type")
+
+            if show_extra:
+                layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
         return dict(
             idname="builtin.primitive_cylinder_add",
             label="Add Cylinder",
@@ -573,13 +585,16 @@ class _defs_view3d_add:
     @ToolDef.from_fn
     def uv_sphere_add():
         def draw_settings(_context, layout, tool, *, extra=False):
-            _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
+            show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
             if extra:
                 return
 
             props = tool.operator_properties("mesh.primitive_uv_sphere_add")
             layout.prop(props, "segments")
             layout.prop(props, "ring_count")
+
+            if show_extra:
+                layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
         return dict(
             idname="builtin.primitive_uv_sphere_add",
             label="Add UV Sphere",
@@ -595,12 +610,15 @@ class _defs_view3d_add:
     @ToolDef.from_fn
     def ico_sphere_add():
         def draw_settings(_context, layout, tool, *, extra=False):
-            _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
+            show_extra = _defs_view3d_add.draw_settings_interactive_add(layout, tool, extra)
             if extra:
                 return
 
             props = tool.operator_properties("mesh.primitive_ico_sphere_add")
             layout.prop(props, "subdivisions")
+
+            if show_extra:
+                layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
         return dict(
             idname="builtin.primitive_ico_sphere_add",
             label="Add Ico Sphere",



More information about the Bf-blender-cvs mailing list