Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2016-12-16 00:22:54 +0300
committerJulian Eisel <eiseljulian@gmail.com>2016-12-16 01:43:17 +0300
commit524ab96245211bb722b82e197ac75bba6bd10e69 (patch)
treef6a5a77234a0e7a5ab531f4f85828276400db241 /source/blender/editors
parente2d7efc9503720770b9652284e25006eecbec8d4 (diff)
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)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_layout.c13
1 files changed, 10 insertions, 3 deletions
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;