Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-05 16:35:52 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-03-05 16:51:48 +0300
commitcb7e66737d2d2d0628dda49ddb7d5541915d017b (patch)
tree12cff3bdf0b4db962cad4ec5dc63c7894a6b3e3f /source/blender/editors
parent683e64247f060acbb8b9ba9178e7555dc57aa10b (diff)
Fix T62216: order of items flipped in some menus like object mode.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface.c29
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c8
2 files changed, 16 insertions, 21 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index f379432ede9..8051ea460fd 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -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) {
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index 43c94a5cb9d..73847d6fc71 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -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];