diff options
author | Sv. Lockal <lockalsash@gmail.com> | 2012-09-02 17:36:33 +0400 |
---|---|---|
committer | Sv. Lockal <lockalsash@gmail.com> | 2012-09-02 17:36:33 +0400 |
commit | ebbfc46bea44c8900eca3deedd25bb990d1fa923 (patch) | |
tree | 6bb044a1b275728e9873783dcee929658c68ffe6 | |
parent | f1d279912fa4f955865a40c9c1be8b2e8e216b3a (diff) |
Use function pointers instead of hard-coded english button names in color picker block.
This solves the problem with es/ru translations of color picker block reported by Gabriel Gazzán in Bf-translations-dev.
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 96c1b00d46d..301aea896bc 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2021,27 +2021,20 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) /* tag buttons */ for (bt = block->buttons.first; bt; bt = bt->next) { - - if (bt->type == LABEL) { - if (bt->str[1] == 'G') { - if (colormode == 2) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } - } - - if (bt->type == NUMSLI || bt->type == TEX) { - if (bt->str[1] == 'e') { - if (colormode == 2) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } - else if (ELEM3(bt->str[0], 'R', 'G', 'B')) { - if (colormode == 0) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } - else if (ELEM3(bt->str[0], 'H', 'S', 'V')) { - if (colormode == 1) bt->flag &= ~UI_HIDDEN; - else bt->flag |= UI_HIDDEN; - } + if (bt->func == do_picker_rna_cb && bt->type == NUMSLI) { + /* RGB sliders (color circle is always shown) */ + if (colormode == 0) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + else if (bt->func == do_hsv_rna_cb) { + /* HSV sliders */ + if (colormode == 1) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + else if (bt->func == do_hex_rna_cb || bt->type == LABEL) { + /* hex input or gamma correction status label */ + if (colormode == 2) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; } } } |