UI: swap tool and regular header

Swap the tool-header and header order so the tool-header
so the header is always next to the window edge.

Note that files saved in 3.0 will have overlapping headers when opened
in any version of Blender before this commit.

Reviewed By: Severin, fsiddi

Maniphest Tasks: T91536

Ref D12631
This commit is contained in:
Campbell Barton
2021-09-28 14:44:36 +10:00
parent eabb134840
commit 4cf4bb2664
9 changed files with 60 additions and 51 deletions

View File

@@ -598,16 +598,10 @@ class IMAGE_HT_tool_header(Header):
def draw(self, context):
layout = self.layout
layout.template_header()
self.draw_tool_settings(context)
layout.separator_spacer()
IMAGE_HT_header.draw_xform_template(layout, context)
layout.separator_spacer()
self.draw_mode_settings(context)
def draw_tool_settings(self, context):
@@ -762,8 +756,7 @@ class IMAGE_HT_header(Header):
show_uvedit = sima.show_uvedit
show_maskedit = sima.show_maskedit
if not show_region_tool_header:
layout.template_header()
layout.template_header()
if sima.mode != 'UV':
layout.prop(sima, "ui_mode", text="")
@@ -784,8 +777,7 @@ class IMAGE_HT_header(Header):
layout.separator_spacer()
if not show_region_tool_header:
IMAGE_HT_header.draw_xform_template(layout, context)
IMAGE_HT_header.draw_xform_template(layout, context)
layout.template_ID(sima, "image", new="image.new", open="image.open")

View File

@@ -99,8 +99,6 @@ class SEQUENCER_HT_tool_header(Header):
def draw(self, context):
layout = self.layout
layout.template_header()
self.draw_tool_settings(context)
# TODO: options popover.
@@ -132,8 +130,7 @@ class SEQUENCER_HT_header(Header):
show_region_tool_header = st.show_region_tool_header
if not show_region_tool_header:
layout.template_header()
layout.template_header()
layout.prop(st, "view_type", text="")

View File

@@ -190,7 +190,7 @@ class ToolActivePanelHelper:
ToolSelectPanelHelper.draw_active_tool_header(
context,
layout.column(),
show_tool_name=True,
show_tool_icon=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_name=False,
show_tool_icon=False,
tool_key=None,
):
if tool_key is None:
@@ -783,9 +783,12 @@ 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.
layout.label(text=" " + item.label if show_tool_name else " ", icon_value=icon_value)
if show_tool_name:
if show_tool_icon:
layout.label(text=" " + item.label, icon_value=icon_value)
layout.separator()
else:
layout.label(text=item.label)
draw_settings = item.draw_settings
if draw_settings is not None:
draw_settings(context, layout, tool)

View File

@@ -46,16 +46,10 @@ class VIEW3D_HT_tool_header(Header):
def draw(self, context):
layout = self.layout
layout.row(align=True).template_header()
self.draw_tool_settings(context)
layout.separator_spacer()
VIEW3D_HT_header.draw_xform_template(layout, context)
layout.separator_spacer()
self.draw_mode_settings(context)
def draw_tool_settings(self, context):
@@ -604,10 +598,8 @@ class VIEW3D_HT_header(Header):
tool_settings = context.tool_settings
view = context.space_data
shading = view.shading
show_region_tool_header = view.show_region_tool_header
if not show_region_tool_header:
layout.row(align=True).template_header()
layout.row(align=True).template_header()
row = layout.row(align=True)
obj = context.active_object
@@ -754,7 +746,7 @@ class VIEW3D_HT_header(Header):
)
layout.separator_spacer()
elif not show_region_tool_header:
else:
# Transform settings depending on tool header visibility
VIEW3D_HT_header.draw_xform_template(layout, context)