[Bf-blender-cvs] [cc1d6b849de] blender2.8: Fix T56898: misaligned icons in buttons in popovers.

Brecht Van Lommel noreply at git.blender.org
Thu Oct 11 17:46:13 CEST 2018


Commit: cc1d6b849de2c237bb0079bcf5d7967528b3c504
Author: Brecht Van Lommel
Date:   Thu Oct 11 17:42:50 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcc1d6b849de2c237bb0079bcf5d7967528b3c504

Fix T56898: misaligned icons in buttons in popovers.

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

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

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

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index dcd09f0d4b0..c27d00f4087 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3316,8 +3316,9 @@ static uiBut *ui_def_but(
 
 	if (block->flag & UI_BLOCK_RADIAL) {
 		but->drawflag |= UI_BUT_TEXT_LEFT;
-		if (but->str && but->str[0])
+		if (but->str && but->str[0]) {
 			but->drawflag |= UI_BUT_ICON_LEFT;
+		}
 	}
 	else if ((block->flag & UI_BLOCK_LOOP) ||
 	         ELEM(but->type,
@@ -3325,7 +3326,10 @@ static uiBut *ui_def_but(
 	              UI_BTYPE_BLOCK, UI_BTYPE_BUT_MENU, UI_BTYPE_SEARCH_MENU,
 	              UI_BTYPE_PROGRESS_BAR, UI_BTYPE_POPOVER))
 	{
-		but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
+		but->drawflag |= UI_BUT_TEXT_LEFT;
+		if (but->str && but->str[0]) {
+			but->drawflag |= UI_BUT_ICON_LEFT;
+		}
 	}
 #ifdef USE_NUMBUTS_LR_ALIGN
 	else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) {
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index b71152fcd19..cb4939adc56 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -100,7 +100,15 @@ static void ui_popover_create_block(bContext *C, uiPopover *pup, int opcontext)
 	BLI_assert(pup->ui_size_x != 0);
 
 	uiStyle *style = UI_style_get_dpi();
+
 	pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS);
+	UI_block_flag_enable(pup->block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_POPOVER);
+#ifdef USE_UI_POPOVER_ONCE
+	if (pup->is_once) {
+		UI_block_flag_enable(pup->block, UI_BLOCK_POPOVER_ONCE);
+	}
+#endif
+
 	pup->layout = UI_block_layout(
 	        pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0,
 	        pup->ui_size_x, 0, MENU_PADDING, style);
@@ -139,12 +147,6 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
 
 	UI_block_region_set(block, handle->region);
 	UI_block_layout_resolve(block, &width, &height);
-	UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_POPOVER);
-#ifdef USE_UI_POPOVER_ONCE
-	if (pup->is_once) {
-		UI_block_flag_enable(block, UI_BLOCK_POPOVER_ONCE);
-	}
-#endif
 	UI_block_direction_set(block, UI_DIR_DOWN | UI_DIR_CENTER_X);
 
 	const int block_margin = U.widget_unit / 2;



More information about the Bf-blender-cvs mailing list