[Bf-blender-cvs] [a15d584] master: UI: fix for recent menu flipping commit

Campbell Barton noreply at git.blender.org
Sun Nov 16 17:42:10 CET 2014


Commit: a15d584a4f17c6234ed5c07214121779a790fee3
Author: Campbell Barton
Date:   Sun Nov 16 17:40:46 2014 +0100
Branches: master
https://developer.blender.org/rBa15d584a4f17c6234ed5c07214121779a790fee3

UI: fix for recent menu flipping commit

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

M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_regions.c

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

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 4cc159d..2d952d6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -978,10 +978,8 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
 			MEM_freeN(item_array);
 		}
 
-		if ((block->flag & UI_BLOCK_NO_FLIP) == 0) {
-			BLI_assert((block->flag & UI_BLOCK_IS_FLIP) == 0);
-			block->flag |= UI_BLOCK_IS_FLIP;
-		}
+		/* intentionally don't touch UI_BLOCK_IS_FLIP here,
+		 * we don't know the context this is called in */
 	}
 	else if (prop && RNA_property_type(prop) != PROP_ENUM) {
 		RNA_warning("%s.%s, not an enum type", RNA_struct_identifier(ptr.type), propname);
@@ -1437,10 +1435,8 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
 		}
 	}
 
-	if ((block->flag & UI_BLOCK_NO_FLIP) == 0) {
-		BLI_assert((block->flag & UI_BLOCK_IS_FLIP) == 0);
-		block->flag |= UI_BLOCK_IS_FLIP;
-	}
+	/* intentionally don't touch UI_BLOCK_IS_FLIP here,
+	 * we don't know the context this is called in */
 }
 
 /* Pointer RNA button with search */
@@ -1869,6 +1865,8 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo
 	uiLayoutSetOperatorContext(layout, lvl->opcontext);
 	uiItemsEnumO(layout, lvl->opname, lvl->propname);
 
+	layout->root->block->flag |= UI_BLOCK_IS_FLIP;
+
 	/* override default, needed since this was assumed pre 2.70 */
 	UI_block_direction_set(layout->root->block, UI_DIR_DOWN);
 }
@@ -1921,6 +1919,7 @@ static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void
 
 	uiLayoutSetOperatorContext(layout, lvl->opcontext);
 	uiItemsEnumR(layout, &lvl->rnapoin, lvl->propname);
+	layout->root->block->flag |= UI_BLOCK_IS_FLIP;
 }
 
 void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, int icon)
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 7cc4bca..6a4bf23 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2640,7 +2640,7 @@ uiPopupMenu *UI_popup_menu_begin(bContext *C, const char *title, int icon)
 	uiBut *but;
 
 	pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS_PULLDOWN);
-	pup->block->flag |= UI_BLOCK_POPUP_MEMORY;
+	pup->block->flag |= UI_BLOCK_POPUP_MEMORY | UI_BLOCK_IS_FLIP;
 	pup->block->puphash = ui_popup_menu_hash(title);
 	pup->layout = UI_block_layout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, MENU_PADDING, style);




More information about the Bf-blender-cvs mailing list