[Bf-blender-cvs] [84bb6d7c02d] master: UI: Header / Tool Settings: Show tool icon when tools are collapsed

Dalai Felinto noreply at git.blender.org
Thu Oct 21 12:12:11 CEST 2021


Commit: 84bb6d7c02d1fd56f454d4470fabad2f11b73808
Author: Dalai Felinto
Date:   Wed Oct 20 16:19:49 2021 +0200
Branches: master
https://developer.blender.org/rB84bb6d7c02d1fd56f454d4470fabad2f11b73808

UI: Header / Tool Settings: Show tool icon when tools are collapsed

Show the scaled down tool icon when the tool region is collapsed. Show a
blank space when the tool region is visible.

* Minimize the UI flickering when changing the active tool.
* Show the active tool when the tool region is collapsed.
* Smaler header footprint (the tool name is not visible).

This is a follow up for T91536.

Differential Revision: https://developer.blender.org/D12939

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 4a598d0aa63..4305476cb0f 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -190,7 +190,7 @@ class ToolActivePanelHelper:
         ToolSelectPanelHelper.draw_active_tool_header(
             context,
             layout.column(),
-            show_tool_icon=True,
+            show_tool_icon_always=True,
             tool_key=ToolSelectPanelHelper._tool_key_from_context(context, space_type=self.bl_space_type),
         )
 
@@ -766,7 +766,7 @@ class ToolSelectPanelHelper:
     def draw_active_tool_header(
             context, layout,
             *,
-            show_tool_icon=False,
+            show_tool_icon_always=False,
             tool_key=None,
     ):
         if tool_key is None:
@@ -783,11 +783,15 @@ class ToolSelectPanelHelper:
             return None
         # Note: we could show 'item.text' here but it makes the layout jitter when switching tools.
         # Add some spacing since the icon is currently assuming regular small icon size.
-        if show_tool_icon:
+        if show_tool_icon_always:
             layout.label(text="    " + item.label, icon_value=icon_value)
             layout.separator()
         else:
-            layout.label(text=item.label)
+            if context.space_data.show_region_toolbar:
+                layout.template_icon(icon_value=0, scale=0.5)
+            else:
+                layout.template_icon(icon_value=icon_value, scale=0.5)
+            layout.separator()
 
         draw_settings = item.draw_settings
         if draw_settings is not None:



More information about the Bf-blender-cvs mailing list