From 864afd76a710b798ea0f3f11bf8f74e7e62f388e Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Thu, 5 Jun 2025 20:51:56 +0200 Subject: [PATCH] UI: Top Bar Tabs as Pills Show Top Bar Workspace items as pills (rounded on all sides) rather than tabs (connected to region edge). This change also raises them slightly to vertically align with other content, and adds a vertical bar to separate the sections. Pull Request: https://projects.blender.org/blender/blender/pulls/137070 --- scripts/startup/bl_ui/space_topbar.py | 2 +- source/blender/editors/interface/interface_align.cc | 2 ++ .../editors/interface/templates/interface_template_id.cc | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/startup/bl_ui/space_topbar.py b/scripts/startup/bl_ui/space_topbar.py index d99477f4ba8..3fd0e34216d 100644 --- a/scripts/startup/bl_ui/space_topbar.py +++ b/scripts/startup/bl_ui/space_topbar.py @@ -30,7 +30,7 @@ class TOPBAR_HT_upper_bar(Header): TOPBAR_MT_editor_menus.draw_collapsible(context, layout) - layout.separator() + layout.separator(type='LINE') if not screen.show_fullscreen: layout.template_ID_tabs(window, "workspace", new="workspace.add", menu="TOPBAR_MT_workspace_menu") diff --git a/source/blender/editors/interface/interface_align.cc b/source/blender/editors/interface/interface_align.cc index ff9c6387a80..8394f7ca50a 100644 --- a/source/blender/editors/interface/interface_align.cc +++ b/source/blender/editors/interface/interface_align.cc @@ -359,6 +359,8 @@ static void ui_block_align_but_to_region(uiBut *but, const ARegion *region) break; default: /* Tabs may be shown in unaligned regions too, they just appear as regular buttons then. */ + rect->ymin += UI_SCALE_FAC; + rect->ymax += UI_SCALE_FAC; break; } } diff --git a/source/blender/editors/interface/templates/interface_template_id.cc b/source/blender/editors/interface/templates/interface_template_id.cc index 46a3bae5697..ebfde5c3df3 100644 --- a/source/blender/editors/interface/templates/interface_template_id.cc +++ b/source/blender/editors/interface/templates/interface_template_id.cc @@ -1432,7 +1432,12 @@ static void template_ID_tabs(const bContext *C, const PointerRNA active_ptr = RNA_property_pointer_get(&template_id.ptr, template_id.prop); MenuType *mt = menu ? WM_menutype_find(menu, false) : nullptr; - const int but_align = ui_but_align_opposite_to_area_align_get(region); + /* When horizonal show the tabs as pills, rounded on all corners. */ + const bool horizontal = + (region->regiontype == RGN_TYPE_HEADER && + ELEM(RGN_ALIGN_ENUM_FROM_MASK(region->alignment), RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)); + const int but_align = horizontal ? 0 : ui_but_align_opposite_to_area_align_get(region); + const int but_height = UI_UNIT_Y * 1.1; uiBlock *block = uiLayoutGetBlock(layout);