From 2c3b4a91dcfcafb94eb964ab3f02d02f46d1a059 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sat, 2 Apr 2011 16:45:17 +0000 Subject: [PATCH] Committing patch [#26740] Interface improvement for toolbar by Brecht. Thanks! This patch makes the bool properties inside the toolshelf more compact, only 1 row per item now. :) --- .../editors/interface/interface_utils.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index b72ae1a2a77..f22c8eb4bfe 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -145,16 +145,22 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper continue; if(label_align != '\0') { + PropertyType type = RNA_property_type(prop); + int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(ptr, prop)); + name= RNA_property_ui_name(prop); if(label_align=='V') { col= uiLayoutColumn(layout, 1); - uiItemL(col, name, ICON_NONE); + + if(!is_boolean) + uiItemL(col, name, ICON_NONE); } else if(label_align=='H') { split = uiLayoutSplit(layout, 0.5f, 0); - uiItemL(uiLayoutColumn(split, 0), name, ICON_NONE); + col= uiLayoutColumn(split, 0); + uiItemL(col, (is_boolean)? "": name, ICON_NONE); col= uiLayoutColumn(split, 0); } else { @@ -163,12 +169,9 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper /* may meed to add more cases here. * don't override enum flag names */ - if(flag & PROP_ENUM_FLAG) { - name= NULL; - } - else { - name= ""; /* name is shown above, empty name for button below */ - } + + /* name is shown above, empty name for button below */ + name= (flag & PROP_ENUM_FLAG || is_boolean)? NULL: ""; } else { col= layout;