Fix T62216: order of items flipped in some menus like object mode.
This commit is contained in:
@@ -3500,7 +3500,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
|
||||
|
||||
int totitems = 0;
|
||||
int columns, rows, a, b;
|
||||
int column_start = 0, column_end = 0;
|
||||
int column_end = 0;
|
||||
int nbr_entries_nosepr = 0;
|
||||
|
||||
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
|
||||
@@ -3513,7 +3513,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
|
||||
|
||||
for (item = item_array; item->identifier; item++, totitems++) {
|
||||
if (!item->identifier[0]) {
|
||||
/* inconsistent, but menus with labels do not look good flipped */
|
||||
/* inconsistent, but menus with categories do not look good flipped */
|
||||
if (item->name) {
|
||||
block->flag |= UI_BLOCK_NO_FLIP;
|
||||
nbr_entries_nosepr++;
|
||||
@@ -3537,10 +3537,12 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
|
||||
while (rows * columns < totitems)
|
||||
rows++;
|
||||
|
||||
/* Title */
|
||||
uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_property_ui_name(but->rnaprop),
|
||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiItemS(layout);
|
||||
if (block->flag & UI_BLOCK_NO_FLIP) {
|
||||
/* Title at the top for menus with categories. */
|
||||
uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_property_ui_name(but->rnaprop),
|
||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiItemS(layout);
|
||||
}
|
||||
|
||||
/* note, item_array[...] is reversed on access */
|
||||
|
||||
@@ -3551,7 +3553,6 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
|
||||
if (a == column_end) {
|
||||
/* start new column, and find out where it ends in advance, so we
|
||||
* can flip the order of items properly per column */
|
||||
column_start = a;
|
||||
column_end = totitems;
|
||||
|
||||
for (b = a + 1; b < totitems; b++) {
|
||||
@@ -3567,12 +3568,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
|
||||
column = uiLayoutColumn(split, false);
|
||||
}
|
||||
|
||||
if (block->flag & UI_BLOCK_NO_FLIP) {
|
||||
item = &item_array[a];
|
||||
}
|
||||
else {
|
||||
item = &item_array[(column_start + column_end - 1 - a)];
|
||||
}
|
||||
item = &item_array[a];
|
||||
|
||||
if (!item->identifier[0]) {
|
||||
if (item->name) {
|
||||
@@ -3603,6 +3599,13 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
|
||||
}
|
||||
}
|
||||
|
||||
if (!(block->flag & UI_BLOCK_NO_FLIP)) {
|
||||
/* Title at the bottom for menus without categories. */
|
||||
uiItemS(layout);
|
||||
uiDefBut(block, UI_BTYPE_LABEL, 0, RNA_property_ui_name(but->rnaprop),
|
||||
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
}
|
||||
|
||||
UI_block_layout_set_current(block, layout);
|
||||
|
||||
if (free) {
|
||||
|
Reference in New Issue
Block a user