diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 1dbef0ba014..d235441d53e 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -418,7 +418,7 @@ void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int max int uiBlocksGetYMin(struct ListBase *lb); -void uiBlockSetDirection(uiBlock *block, int direction); +void uiBlockSetDirection(uiBlock *block, char direction); void uiBlockFlipOrder(uiBlock *block); void uiBlockSetFlag(uiBlock *block, int flag); void uiBlockClearFlag(uiBlock *block, int flag); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 2e6cb35faaa..aa3be71aa5d 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3684,7 +3684,7 @@ int uiBlocksGetYMin(ListBase *lb) return min; } -void uiBlockSetDirection(uiBlock *block, int direction) +void uiBlockSetDirection(uiBlock *block, char direction) { block->direction = direction; } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e27177be4b4..57e7ebfd800 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1793,6 +1793,9 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo uiLayoutSetOperatorContext(layout, lvl->opcontext); uiItemsEnumO(layout, lvl->opname, lvl->propname); + + /* override default, needed since this was assumed pre 2.70 */ + uiBlockSetDirection(layout->root->block, UI_DOWN); } void uiItemMenuEnumO(uiLayout *layout, bContext *C, const char *opname, 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 9bb8ed0d1e0..e413808f1dd 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2102,7 +2102,9 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi uiBlock *block; uiBut *bt; uiPopupMenu *pup = arg_pup; - int offset[2], direction, minwidth, width, height, flip; + int offset[2], minwidth, width, height; + char direction; + bool flip; if (pup->menu_func) { pup->block->handle = handle; @@ -2116,21 +2118,26 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi /* settings (typically rna-enum-popups) show above the button, * menu's like file-menu, show below */ - if (pup->but->type == PULLDOWN || (uiButGetMenuType(pup->but) != NULL)) { + if (pup->block->direction != 0) { + /* allow overriding the direction from menu_func */ + direction = pup->block->direction; + } + else if ((pup->but->type == PULLDOWN) || + (uiButGetMenuType(pup->but) != NULL)) + { direction = UI_DOWN; - flip = 1; } else { direction = UI_TOP; - flip = 0; } } else { minwidth = 50; direction = UI_DOWN; - flip = 1; } + flip = (direction == UI_DOWN); + block = pup->block; /* in some cases we create the block before the region,