[Bf-blender-cvs] [700012b66e8] blender2.8: UI: icon-only hold popup uses region alignment
Campbell Barton
noreply at git.blender.org
Wed Apr 25 20:54:59 CEST 2018
Commit: 700012b66e87390a9eee33d4437a073cb8e42076
Author: Campbell Barton
Date: Wed Apr 25 20:41:26 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB700012b66e87390a9eee33d4437a073cb8e42076
UI: icon-only hold popup uses region alignment
Gives nicer tool popups for icon only buttons.
===================================================================
M source/blender/editors/interface/interface_layout.c
===================================================================
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 3ea6ae08173..0163b19d57e 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -902,7 +902,23 @@ static void ui_item_menu_hold(struct bContext *C, ARegion *butregion, uiBut *but
block->flag |= UI_BLOCK_POPUP_HOLD;
block->flag |= UI_BLOCK_IS_FLIP;
- UI_block_direction_set(block, UI_DIR_DOWN);
+
+ char direction = UI_DIR_DOWN;
+ if (!but->drawstr[0]) {
+ if (butregion->alignment == RGN_ALIGN_LEFT) {
+ direction = UI_DIR_RIGHT;
+ }
+ else if (butregion->alignment == RGN_ALIGN_RIGHT) {
+ direction = UI_DIR_LEFT;
+ }
+ else if (butregion->alignment == RGN_ALIGN_BOTTOM) {
+ direction = UI_DIR_UP;
+ }
+ else {
+ direction = UI_DIR_DOWN;
+ }
+ }
+ UI_block_direction_set(block, direction);
const char *menu_id = but->hold_argN;
MenuType *mt = WM_menutype_find(menu_id, true);
More information about the Bf-blender-cvs
mailing list