[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19928] trunk/blender/source/blender: When adding multiline text drawing I missed a case where the image pointer should have been checked - drawing text on a face with no image would crash blender .

Campbell Barton ideasman42 at gmail.com
Sun Apr 26 11:41:40 CEST 2009


Revision: 19928
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19928
Author:   campbellbarton
Date:     2009-04-26 11:41:39 +0200 (Sun, 26 Apr 2009)

Log Message:
-----------
When adding multiline text drawing I missed a case where the image pointer should have been checked - drawing text on a face with no image would crash blender.

Better tooltip for game actuator file field.

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_draw.c
    trunk/blender/source/blender/src/buttons_logic.c

Modified: trunk/blender/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_draw.c	2009-04-25 20:26:27 UTC (rev 19927)
+++ trunk/blender/source/blender/gpu/intern/gpu_draw.c	2009-04-26 09:41:39 UTC (rev 19928)
@@ -79,29 +79,24 @@
 	const char *textstr, int textlen, unsigned int *col,
 	float *v1, float *v2, float *v3, float *v4, int glattrib)
 {
-	if (mode & TF_BMFONT) {
-		Image* ima;
-		int characters, index, character;
+	if ((mode & TF_BMFONT) && (textlen>0) && tface->tpage) {
+		Image* ima = (Image*)tface->tpage;
+		int index, character;
 		float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
 		float advance_tab;
 		
-		
 		/* multiline */
-		float line_start= 0.0f, line_height; 
+		float line_start= 0.0f, line_height;
+		
 		if (v4)
 			line_height= MAX4(v1[1], v2[1], v3[1], v4[2]) - MIN4(v1[1], v2[1], v3[1], v4[2]);
 		else
 			line_height= MAX3(v1[1], v2[1], v3[1]) - MIN3(v1[1], v2[1], v3[1]);
 		line_height *= 1.2; /* could be an option? */
 		/* end multiline */
-		
-		characters = textlen;
 
-		ima = (Image*)tface->tpage;
-		if (ima == NULL)
-			characters = 0;
-
-		// color has been set
+		
+		/* color has been set */
 		if (tface->mode & TF_OBCOL)
 			col= NULL;
 		else if (!col)
@@ -116,7 +111,7 @@
 		advance_tab= advance * 4; /* tab width could also be an option */
 		
 		
-		for (index = 0; index < characters; index++) {
+		for (index = 0; index < textlen; index++) {
 			float uv[4][2];
 
 			// lets calculate offset stuff

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c	2009-04-25 20:26:27 UTC (rev 19927)
+++ trunk/blender/source/blender/src/buttons_logic.c	2009-04-26 09:41:39 UTC (rev 19928)
@@ -2389,7 +2389,7 @@
 				ysize = 48;
 				glRects(xco, yco-ysize, xco+width, yco); 
 				uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); 
-		   		uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this file");
+		   		uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, 63, 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
 //				uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, 63, 0, 0, "Use this loadinganimation");
 			}
 /*			else if (gma->type == ACT_GAME_START)





More information about the Bf-blender-cvs mailing list