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:
authorCampbell Barton <ideasman42@gmail.com>2018-08-30 01:55:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-08-30 02:00:39 +0300
commitadd923f98a75f11200056c83d7f766304bb6b29b (patch)
tree1dff069a9ea796cd48615ce7b6dbaf0ccd4113be /release
parent6fa7fa6671c9e7cf9baad54b0f0861755b43f2b1 (diff)
UI: add active tool panel to tool settings
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_common.py13
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py21
2 files changed, 30 insertions, 4 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index e03b3eb585d..b8e3d81c1d4 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -513,16 +513,21 @@ class ToolSelectPanelHelper:
self.draw_cls(self.layout, context)
@staticmethod
- def draw_active_tool_header(context, layout):
+ def draw_active_tool_header(
+ context, layout,
+ *,
+ show_tool_name=False,
+ ):
# BAD DESIGN WARNING: last used tool
workspace = context.workspace
space_type = workspace.tools_space_type
mode = workspace.tools_mode
item, tool, icon_value = ToolSelectPanelHelper._tool_get_active(context, space_type, mode, with_icon=True)
if item is None:
- return
- # Note: we could show 'item.text' here but it makes the layout jitter when switcuing tools.
- layout.label(text=" ", icon_value=icon_value)
+ 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.
+ layout.label(text=" " + item.text if show_tool_name else " ", icon_value=icon_value)
draw_settings = item.draw_settings
if draw_settings is not None:
draw_settings(context, layout, tool)
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index b6a68f06785..3395889cf82 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -614,6 +614,26 @@ class TOPBAR_MT_workspace_menu(Menu):
layout.operator("workspace.delete", text="Delete")
+class TOPBAR_PT_active_tool(Panel):
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_category = ""
+ bl_context = ".active_tool" # dot on purpose (access from tool settings)
+ bl_label = "Active Tool"
+
+ def draw(self, context):
+ layout = self.layout
+
+ # Panel display of topbar tool settings.
+ # currently displays in tool settings, keep here since the same functionality is used for the topbar.
+
+ layout.use_property_split = True
+ layout.use_property_decorate = False
+
+ from .space_toolsystem_common import ToolSelectPanelHelper
+ ToolSelectPanelHelper.draw_active_tool_header(context, layout, show_tool_name=True)
+
+
classes = (
TOPBAR_HT_upper_bar,
TOPBAR_HT_lower_bar,
@@ -630,6 +650,7 @@ classes = (
TOPBAR_MT_render,
TOPBAR_MT_window,
TOPBAR_MT_help,
+ TOPBAR_PT_active_tool,
)
if __name__ == "__main__": # only for live edit.