diff options
author | Joshua Leung <aligorith@gmail.com> | 2013-03-16 07:59:03 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2013-03-16 07:59:03 +0400 |
commit | 7fc79615e0c88aff445178f17e9c267f11a0d791 (patch) | |
tree | 1b3eea1d0ad2f653e536239d019192e6359b144e /source/blender/editors/interface/interface_templates.c | |
parent | 4db11a9e55c39eac9d2f061e87124aa30d0bfe26 (diff) |
Any ID Selector Template: ID Type dropdown now shows icon only as originally
intended
Finally, I've figured out a way to get the ID Selector Template to only show the
icon for the type of ID block (i.e. the intended design), instead of icon+text.
This improves the layout a bit, as previously the type selector and ID-block
pointer and label would all be the same sizes (roughly 1/3rd of the overall
width each), which meant that there wasn't much room left to actually see which
datablock had been selected.
Additionally, I've fixed a few more layout types which still didn't correctly
propagate the red-alert flags.
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index ba278c21adb..103c9a0c9e9 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -669,7 +669,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co const char *text) { PropertyRNA *propID, *propType; - uiLayout *row; + uiLayout *split, *row, *sub; /* get properties... */ propID = RNA_struct_find_property(ptr, propname); @@ -685,22 +685,34 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co } /* Start drawing UI Elements using standard defines */ - row = uiLayoutRow(layout, TRUE); + split = uiLayoutSplit(layout, 0.33f, FALSE); /* NOTE: split amount here needs to be synced with normal labels */ + + /* FIRST PART ................................................ */ + row = uiLayoutRow(split, FALSE); /* Label - either use the provided text, or will become "ID-Block:" */ if (text) { if (text[0]) uiItemL(row, text, ICON_NONE); } - else + else { uiItemL(row, IFACE_("ID-Block:"), ICON_NONE); + } + + /* SECOND PART ................................................ */ + row = uiLayoutRow(split, TRUE); /* ID-Type Selector - just have a menu of icons */ - /* FIXME: the icon-only setting doesn't work when we supply a blank name */ - uiItemFullR(row, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + sub = uiLayoutRow(row, TRUE); /* HACK: special group just for the enum, otherwise we */ + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */ + + uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE); /* ID-Block Selector - just use pointer widget... */ - uiItemFullR(row, ptr, propID, 0, 0, 0, "", ICON_NONE); + sub = uiLayoutRow(row, TRUE); /* HACK: special group to counteract the effects of the previous */ + uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */ + + uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE); } /********************* RNA Path Builder Template ********************/ |