[Bf-blender-cvs] [e62368e6c43] blender2.8: Fix enum icon button size for fractional UI scale.

Brecht Van Lommel noreply at git.blender.org
Tue Dec 18 15:31:28 CET 2018


Commit: e62368e6c435dad23a0d47016fcbfc65fce8d62b
Author: Brecht Van Lommel
Date:   Tue Dec 18 15:28:24 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBe62368e6c435dad23a0d47016fcbfc65fce8d62b

Fix enum icon button size for fractional UI scale.

Err on the side of too much padding.

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

M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/space_view3d/view3d_header.c

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

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 7778444435e..9e9c244cfaf 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -721,7 +721,7 @@ static void ui_item_enum_expand_exec(
 		if (icon && name[0] && !icon_only)
 			but = uiDefIconTextButR_prop(block, but_type, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
 		else if (icon)
-			but = uiDefIconButR_prop(block, but_type, 0, icon, 0, 0, (is_first) ? itemw : itemw - UI_DPI_FAC, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+			but = uiDefIconButR_prop(block, but_type, 0, icon, 0, 0, (is_first) ? itemw : ceilf(itemw - UI_DPI_FAC), h, ptr, prop, -1, 0, value, -1, -1, NULL);
 		else
 			but = uiDefButR_prop(block, but_type, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
 
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 954a528ce9d..7ed7d399df4 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -36,6 +36,7 @@
 #include "DNA_object_types.h"
 #include "DNA_gpencil_types.h"
 
+#include "BLI_math_base.h"
 #include "BLI_utildefines.h"
 
 #include "BLT_translation.h"
@@ -142,10 +143,10 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
 		                 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
 		                 TIP_("Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
 		uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL,
-		                 0, 0, UI_UNIT_X - UI_DPI_FAC, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+		                 0, 0, ceilf(UI_UNIT_X - UI_DPI_FAC), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
 		                 TIP_("Edge select - Shift-Click for multiple modes, Ctrl-Click expands/contracts selection"));
 		uiDefIconButBitS(block, UI_BTYPE_TOGGLE, SCE_SELECT_FACE, B_SEL_FACE, ICON_FACESEL,
-		                 0, 0, UI_UNIT_X - UI_DPI_FAC, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
+		                 0, 0, ceilf(UI_UNIT_X - UI_DPI_FAC), UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0,
 		                 TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
 	}
 }



More information about the Bf-blender-cvs mailing list