From 524ab96245211bb722b82e197ac75bba6bd10e69 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 15 Dec 2016 22:22:54 +0100 Subject: 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) --- source/blender/editors/interface/interface_layout.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 342c7182453..80d091c0fdb 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; -- cgit v1.2.3