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:
authorCampbell Barton <ideasman42@gmail.com>2018-05-30 18:28:12 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-30 18:29:20 +0300
commitefd0333a9c11ed4f60d1090fb97703db785ecd4a (patch)
tree473b711e8e4a603cee34a87e21f14990f17040c6 /source/blender/editors
parent127293677334cb342b2c6f01c5a064912b6bc0b4 (diff)
UI: fix property split w/ color buttons & empty text
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_layout.c80
1 files changed, 45 insertions, 35 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 7991f03ea31..3449e9b0190 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1520,45 +1520,55 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
/* Split the label / property. */
if (use_prop_sep) {
- uiLayout *layout_split = uiLayoutSplit(layout, UI_ITEM_PROP_SEP_DIVIDE, true);
- layout_split->space = 0;
- uiLayout *layout_sub = uiLayoutColumn(layout_split, true);
- layout_sub->space = 0;
-
- if (index == RNA_NO_INDEX && is_array) {
- char name_with_suffix[UI_MAX_DRAW_STR + 2];
- char str[2] = {'\0'};
- for (int a = 0; a < len; a++) {
- str[0] = RNA_property_array_item_char(prop, a);
- const bool use_prefix = (a == 0 && name && name[0]);
- if (use_prefix) {
- char *s = name_with_suffix;
- s += STRNCPY_RLEN(name_with_suffix, name);
- *s++ = ' ';
- *s++ = str[0];
- *s++ = '\0';
- }
- but = uiDefBut(
- block, UI_BTYPE_LABEL, 0, use_prefix ? name_with_suffix : str,
- 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
- but->drawflag |= UI_BUT_TEXT_RIGHT;
- but->drawflag &= ~UI_BUT_TEXT_LEFT;
- }
+ if (name[0] == '\0') {
+ /* Ensure we get a column when text is not set. */
+ layout = uiLayoutColumn(layout, true);
+ layout->space = 0;
}
else {
- if (name) {
- but = uiDefBut(
- block, UI_BTYPE_LABEL, 0, name,
- 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
- but->drawflag |= UI_BUT_TEXT_RIGHT;
- but->drawflag &= ~UI_BUT_TEXT_LEFT;
+ const PropertySubType subtype = RNA_property_subtype(prop);
+ uiLayout *layout_split = uiLayoutSplit(layout, UI_ITEM_PROP_SEP_DIVIDE, true);
+ layout_split->space = 0;
+ uiLayout *layout_sub = uiLayoutColumn(layout_split, true);
+ layout_sub->space = 0;
+
+ if ((index == RNA_NO_INDEX && is_array) &&
+ ((ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) == 0))
+ {
+ char name_with_suffix[UI_MAX_DRAW_STR + 2];
+ char str[2] = {'\0'};
+ for (int a = 0; a < len; a++) {
+ str[0] = RNA_property_array_item_char(prop, a);
+ const bool use_prefix = (a == 0 && name && name[0]);
+ if (use_prefix) {
+ char *s = name_with_suffix;
+ s += STRNCPY_RLEN(name_with_suffix, name);
+ *s++ = ' ';
+ *s++ = str[0];
+ *s++ = '\0';
+ }
+ but = uiDefBut(
+ block, UI_BTYPE_LABEL, 0, use_prefix ? name_with_suffix : str,
+ 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but->drawflag |= UI_BUT_TEXT_RIGHT;
+ but->drawflag &= ~UI_BUT_TEXT_LEFT;
+ }
+ }
+ else {
+ if (name) {
+ but = uiDefBut(
+ block, UI_BTYPE_LABEL, 0, name,
+ 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+ but->drawflag |= UI_BUT_TEXT_RIGHT;
+ but->drawflag &= ~UI_BUT_TEXT_LEFT;
+ }
}
- }
- /* Watch out! We can only write into the new column now. */
- layout = uiLayoutColumn(layout_split, true);
- layout->space = 0;
- name = "";
+ /* Watch out! We can only write into the new column now. */
+ layout = uiLayoutColumn(layout_split, true);
+ layout->space = 0;
+ name = "";
+ }
}
/* End split. */