[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41278] trunk/blender: - fix numpad comma replacement which was broken since unicode input was added .

Campbell Barton ideasman42 at gmail.com
Tue Oct 25 15:13:03 CEST 2011


Revision: 41278
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41278
Author:   campbellbarton
Date:     2011-10-25 13:13:02 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
- fix numpad comma replacement which was broken since unicode input was added.
- add blender-softwaregl wrapper script for unix
- quiet compiler warning.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/string_utf8.c
    trunk/blender/source/blender/editors/interface/interface_handlers.c

Added Paths:
-----------
    trunk/blender/release/bin/blender-softwaregl

Added: trunk/blender/release/bin/blender-softwaregl
===================================================================
--- trunk/blender/release/bin/blender-softwaregl	                        (rev 0)
+++ trunk/blender/release/bin/blender-softwaregl	2011-10-25 13:13:02 UTC (rev 41278)
@@ -0,0 +1,22 @@
+#!/bin/sh
+BF_DIST_BIN=`dirname "$0"`
+BF_PROGRAM="blender" # BF_PROGRAM=`basename "$0"`-bin
+exitcode=0
+
+LD_LIBRARY_PATH=${BF_DIST_BIN}/lib:${LD_LIBRARY_PATH}
+
+if [ -n "$LD_LIBRARYN32_PATH" ]; then
+    LD_LIBRARYN32_PATH=${BF_DIST_BIN}/lib:${LD_LIBRARYN32_PATH}
+fi
+if [ -n "$LD_LIBRARYN64_PATH" ]; then
+    LD_LIBRARYN64_PATH=${BF_DIST_BIN}/lib:${LD_LIBRARYN64_PATH}
+fi
+if [ -n "$LD_LIBRARY_PATH_64" ]; then
+    LD_LIBRARY_PATH_64=${BF_DIST_BIN}/lib:${LD_LIBRARY_PATH_64}
+fi
+
+export LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARYN64_PATH LD_LIBRARY_PATH_64 LD_PRELOAD
+
+"$BF_DIST_BIN/$BF_PROGRAM" ${1+"$@"}
+exitcode=$?
+exit $exitcode

Modified: trunk/blender/source/blender/blenlib/intern/string_utf8.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string_utf8.c	2011-10-25 12:37:42 UTC (rev 41277)
+++ trunk/blender/source/blender/blenlib/intern/string_utf8.c	2011-10-25 13:13:02 UTC (rev 41278)
@@ -319,6 +319,8 @@
 
     UTF8_COMPUTE (c, mask, len);
 
+	(void)mask; /* quiet warning */
+
 	return len;
 }
 

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2011-10-25 12:37:42 UTC (rev 41277)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2011-10-25 13:13:02 UTC (rev 41278)
@@ -1944,18 +1944,26 @@
 
 		if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
 			char ascii = event->ascii;
+			const char *utf8_buf= event->utf8_buf;
 
 			/* exception that's useful for number buttons, some keyboard
 			   numpads have a comma instead of a period */
-			if(ELEM3(but->type, NUM, NUMABS, NUMSLI))
-				if(event->type == PADPERIOD && ascii == ',')
+			if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
+				if(event->type == PADPERIOD && ascii == ',') {
 					ascii = '.';
+					utf8_buf= NULL; /* force ascii fallback */
+				}
+			}
 
-			if(event->utf8_buf[0]) {
+			if(utf8_buf && utf8_buf[0]) {
+				int utf8_buf_len= BLI_str_utf8_size(utf8_buf);
 				/* keep this printf until utf8 is well tested */
-				printf("%s: utf8 char '%.*s'\n", __func__, BLI_str_utf8_size(event->utf8_buf), event->utf8_buf);
-				// strcpy(event->utf8_buf, "12345");
-				changed= ui_textedit_type_buf(but, data, event->utf8_buf, BLI_str_utf8_size(event->utf8_buf));
+				if (utf8_buf_len != 1) {
+					printf("%s: utf8 char '%.*s'\n", __func__, utf8_buf_len, utf8_buf);
+				}
+
+				// strcpy(utf8_buf, "12345");
+				changed= ui_textedit_type_buf(but, data, event->utf8_buf, utf8_buf_len);
 			}
 			else {
 				changed= ui_textedit_type_ascii(but, data, ascii);




More information about the Bf-blender-cvs mailing list