Fix T62216: order of items flipped in some menus like object mode.
This commit is contained in:
parent
683e64247f
commit
cb7e66737d
Notes:
blender-bot
2023-02-14 03:35:26 +01:00
Referenced by issue #62216, Mode menu order is flipped Referenced by issue #61907, Interaction mode dropdown inverted after recent UI changes
|
@ -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) {
|
||||
|
|
|
@ -222,14 +222,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
|
|||
|
||||
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
|
||||
|
||||
/* Flip layout because rna enum list ordered in reverse. */
|
||||
if ((pup->but && pup->but->type != UI_BTYPE_PULLDOWN) &&
|
||||
(UI_but_menutype_get(pup->but) == NULL) &&
|
||||
(UI_but_is_tool(pup->but) == false))
|
||||
{
|
||||
UI_block_order_flip(block);
|
||||
}
|
||||
|
||||
if (pup->popup) {
|
||||
uiBut *bt;
|
||||
int offset[2];
|
||||
|
|
Loading…
Reference in New Issue