[Bf-blender-cvs] [cb7e66737d2] master: Fix T62216: order of items flipped in some menus like object mode.

Brecht Van Lommel noreply at git.blender.org
Tue Mar 5 14:53:47 CET 2019


Commit: cb7e66737d2d2d0628dda49ddb7d5541915d017b
Author: Brecht Van Lommel
Date:   Tue Mar 5 14:35:52 2019 +0100
Branches: master
https://developer.blender.org/rBcb7e66737d2d2d0628dda49ddb7d5541915d017b

Fix T62216: order of items flipped in some menus like object mode.

===================================================================

M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_region_menu_popup.c

===================================================================

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];



More information about the Bf-blender-cvs mailing list