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:
parent
eabb134840
commit
4cf4bb2664
Notes:
blender-bot
2023-04-10 05:36:30 +02:00
Referenced by issue #98362, Menu bar overlapped and few option were not showing in the menu bar Referenced by issue #98238, Icons at the top overlapping Referenced by issue #96759, Missing toolbar in 2.93LTS when header position is flipped (file saved in 3.1) Referenced by issue #94717, Edit Mode and Sculpt mode top bar is on top of other Referenced by issue #94065, Strange behavior in blender menu - layers Referenced by issue #93193, GUI elements drawn on top of eachother Referenced by issue #92844, 3d view's header no longer transparent (with Tool Settings hidden) Referenced by issue #92676, Menus and tool settings overlap Referenced by issue #92421, Opening a Blender file in 3.0 and then re-opening it in 2.93 causes bug in header bar Referenced by issue #91809, Geometry nodes (Fields) Assertion failed at input_has_attribute_toggle() Referenced by issue #106746, Scrolling over Labels and icons does not detect tool settings bar
|
@ -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")
|
||||
|
||||
|
|
|
@ -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="")
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -1625,5 +1625,30 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
*/
|
||||
{
|
||||
/* Keep this block, even when empty. */
|
||||
|
||||
/* Swap header with the tool header so the regular header is always on the edge. */
|
||||
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
|
||||
&sl->regionbase;
|
||||
ARegion *region_tool = NULL, *region_head = NULL;
|
||||
int region_tool_index = -1, region_head_index = -1, i;
|
||||
LISTBASE_FOREACH_INDEX (ARegion *, region, regionbase, i) {
|
||||
if (region->regiontype == RGN_TYPE_TOOL_HEADER) {
|
||||
region_tool = region;
|
||||
region_tool_index = i;
|
||||
}
|
||||
else if (region->regiontype == RGN_TYPE_HEADER) {
|
||||
region_head = region;
|
||||
region_head_index = i;
|
||||
}
|
||||
}
|
||||
if ((region_tool && region_head) && (region_head_index > region_tool_index)) {
|
||||
BLI_listbase_swaplinks(regionbase, region_tool, region_head);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1284,8 +1284,8 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
|
|||
RGN_TYPE_TOOLS,
|
||||
RGN_TYPE_UI,
|
||||
RGN_TYPE_TOOL_PROPS,
|
||||
RGN_TYPE_HEADER,
|
||||
RGN_TYPE_FOOTER)) {
|
||||
RGN_TYPE_FOOTER,
|
||||
RGN_TYPE_TOOL_HEADER)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,6 +128,13 @@ static SpaceLink *image_create(const ScrArea *UNUSED(area), const Scene *UNUSED(
|
|||
|
||||
simage->custom_grid_subdiv = 10;
|
||||
|
||||
/* header */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for image");
|
||||
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* tool header */
|
||||
region = MEM_callocN(sizeof(ARegion), "tool header for image");
|
||||
|
||||
|
@ -136,13 +143,6 @@ static SpaceLink *image_create(const ScrArea *UNUSED(area), const Scene *UNUSED(
|
|||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* header */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for image");
|
||||
|
||||
BLI_addtail(&simage->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* buttons/list view */
|
||||
region = MEM_callocN(sizeof(ARegion), "buttons for image");
|
||||
|
||||
|
|
|
@ -109,6 +109,13 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce
|
|||
BLI_rctf_init(&sseq->runtime.last_thumbnail_area, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
sseq->runtime.last_displayed_thumbnails = NULL;
|
||||
|
||||
/* Header. */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for sequencer");
|
||||
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* Tool header. */
|
||||
region = MEM_callocN(sizeof(ARegion), "tool header for sequencer");
|
||||
|
||||
|
@ -117,13 +124,6 @@ static SpaceLink *sequencer_create(const ScrArea *UNUSED(area), const Scene *sce
|
|||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* Header. */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for sequencer");
|
||||
|
||||
BLI_addtail(&sseq->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* Buttons/list view. */
|
||||
region = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
|
||||
|
||||
|
|
|
@ -276,6 +276,13 @@ static SpaceLink *view3d_create(const ScrArea *UNUSED(area), const Scene *scene)
|
|||
v3d->camera = scene->camera;
|
||||
}
|
||||
|
||||
/* header */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for view3d");
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* tool header */
|
||||
region = MEM_callocN(sizeof(ARegion), "tool header for view3d");
|
||||
|
||||
|
@ -284,13 +291,6 @@ static SpaceLink *view3d_create(const ScrArea *UNUSED(area), const Scene *scene)
|
|||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* header */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for view3d");
|
||||
|
||||
BLI_addtail(&v3d->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* tool shelf */
|
||||
region = MEM_callocN(sizeof(ARegion), "toolshelf for view3d");
|
||||
|
||||
|
|
Loading…
Reference in New Issue