diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-26 13:41:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-26 13:41:39 +0400 |
commit | fc4ba5e13116835c3208ecfe21c9ccc3e93277f7 (patch) | |
tree | b742ef83ced1955f32fa36f6e2be372649b93b26 | |
parent | fb7803c300a89892f1d5a76398b3c2506465cf60 (diff) |
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.
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 21 | ||||
-rw-r--r-- | source/blender/src/buttons_logic.c | 2 |
2 files changed, 9 insertions, 14 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 7b1fc67d0c6..6925186d63a 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -79,29 +79,24 @@ void GPU_render_text(MTFace *tface, int mode, 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 @@ void GPU_render_text(MTFace *tface, int mode, 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 diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c index 67531e9b3b8..0a7bbf656b3 100644 --- a/source/blender/src/buttons_logic.c +++ b/source/blender/src/buttons_logic.c @@ -2389,7 +2389,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh 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) |