WIP: uv-simple-select #1

Closed
Chris Blackbourn wants to merge 182 commits from uv-simple-select into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit fa1222f296 - Show all commits

View File

@ -4287,6 +4287,7 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p
int totitems = 0; int totitems = 0;
int categories = 0; int categories = 0;
int entries_nosepr_count = 0; int entries_nosepr_count = 0;
bool has_item_with_icon = false;
for (const EnumPropertyItem *item = item_array; item->identifier; item++, totitems++) { for (const EnumPropertyItem *item = item_array; item->identifier; item++, totitems++) {
if (!item->identifier[0]) { if (!item->identifier[0]) {
/* inconsistent, but menus with categories do not look good flipped */ /* inconsistent, but menus with categories do not look good flipped */
@ -4298,6 +4299,9 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p
/* We do not want simple separators in `entries_nosepr_count`. */ /* We do not want simple separators in `entries_nosepr_count`. */
continue; continue;
} }
if (item->icon) {
has_item_with_icon = true;
}
entries_nosepr_count++; entries_nosepr_count++;
} }
@ -4402,11 +4406,18 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p
uiItemS(column); uiItemS(column);
} }
else { else {
if (item->icon) { int icon = item->icon;
/* Use blank icon if there is none for this item (but for some other one) to make sure labels
* align. */
if (icon == ICON_NONE && has_item_with_icon) {
icon = ICON_BLANK1;
}
if (icon) {
uiDefIconTextButI(block, uiDefIconTextButI(block,
UI_BTYPE_BUT_MENU, UI_BTYPE_BUT_MENU,
B_NOP, B_NOP,
item->icon, icon,
item->name, item->name,
0, 0,
0, 0,