[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50316] trunk/blender/source/blender/ editors/interface/interface_regions.c: Use function pointers instead of hard-coded english button names in color picker block .

Sv. Lockal lockalsash at gmail.com
Sun Sep 2 15:36:33 CEST 2012


Revision: 50316
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50316
Author:   lockal
Date:     2012-09-02 13:36:33 +0000 (Sun, 02 Sep 2012)
Log Message:
-----------
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?\195?\161n in Bf-translations-dev.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_regions.c

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2012-09-02 13:34:12 UTC (rev 50315)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2012-09-02 13:36:33 UTC (rev 50316)
@@ -2021,28 +2021,21 @@
 	
 	/* 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->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;
 		}
-		
-		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;
-			}
+		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;
+		}
 	}
 }
 




More information about the Bf-blender-cvs mailing list