[Bf-blender-cvs] [524ab96] master: Fix drawing enum property with icon only flag

Julian Eisel noreply at git.blender.org
Thu Dec 15 23:45:10 CET 2016


Commit: 524ab96245211bb722b82e197ac75bba6bd10e69
Author: Julian Eisel
Date:   Thu Dec 15 22:22:54 2016 +0100
Branches: master
https://developer.blender.org/rB524ab96245211bb722b82e197ac75bba6bd10e69

Fix drawing enum property with icon only flag

Enum properties with icon only flag should use minimum/fixed width in expanded layouts (alignment=UI_LAYOUT_ALIGN_EXPAND).

Differential Revision: https://developer.blender.org/D2415 by @raa (only made some really minor corrections)

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

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 342c718..80d091c 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1235,8 +1235,15 @@ static void ui_item_rna_size(
 		}
 	}
 
-	if (!w)
-		w = ui_text_icon_width(layout, name, icon, 0);
+	if (!w) {
+		if (type == PROP_ENUM && icon_only) {
+			w = ui_text_icon_width(layout, "", ICON_BLANK1, 0);
+			w += 0.6f * UI_UNIT_X;
+		}
+		else {
+			w = ui_text_icon_width(layout, name, icon, 0);
+		}
+	}
 	h = UI_UNIT_Y;
 
 	/* increase height for arrays */
@@ -1254,7 +1261,7 @@ static void ui_item_rna_size(
 	else if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
 		if (type == PROP_BOOLEAN && name[0])
 			w += UI_UNIT_X / 5;
-		else if (type == PROP_ENUM)
+		else if (type == PROP_ENUM && !icon_only)
 			w += UI_UNIT_X / 4;
 		else if (type == PROP_FLOAT || type == PROP_INT)
 			w += UI_UNIT_X * 3;




More information about the Bf-blender-cvs mailing list