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
This commit is contained in:
committed by
Harley Acheson
parent
117a12cc0a
commit
864afd76a7
@@ -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")
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user