diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2005-05-25 08:52:52 +0400 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2005-05-25 08:52:52 +0400 |
commit | 2a1fe1b0cbbb45cbec7d9864ad79b1b321880da0 (patch) | |
tree | 098787ab375a550fd606ff7965a13d3e5b0960e7 /source/blender/python/api2_2x/Draw.c | |
parent | 524e411dbfce7702c270a590c78aba4012f66666 (diff) |
BPython bug fixes:
- Patch #2491: Mathutils.AngleBetweenVecs BUGFIX
http://projects.blender.org/tracker/?func=detail&aid=2491&group_id=9&atid=127
- #2607: Python String button can segfault if the allowable length is greater than 400
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2607&group_id=9
- #2490: Vector == None gives warning
http://projects.blender.org/tracker/?func=detail&aid=2490&group_id=9&atid=125
- #2476: Image.Draw()
http://projects.blender.org/tracker/?func=detail&aid=2476&group_id=9&atid=125
All reported by Campbell, who also wrote the #2491 patch. Ken Hughes provided patches for #2490 and #2476. Thanks guys.
Diffstat (limited to 'source/blender/python/api2_2x/Draw.c')
-rw-r--r-- | source/blender/python/api2_2x/Draw.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c index 873e00b5a88..0c75ee22ab6 100644 --- a/source/blender/python/api2_2x/Draw.c +++ b/source/blender/python/api2_2x/Draw.c @@ -1045,6 +1045,11 @@ static PyObject *Method_String( PyObject * self, PyObject * args ) "expected a string, five ints, a string, an int and\n\ optionally another string as arguments" ); + if (len > (UI_MAX_DRAW_STR - 1)) { + len = UI_MAX_DRAW_STR - 1; + newstr[len] = '\0'; + } + real_len = strlen(newstr); if (real_len > len) real_len = len; @@ -1053,7 +1058,7 @@ static PyObject *Method_String( PyObject * self, PyObject * args ) but->slen = len; but->val.asstr = MEM_mallocN( len + 1, "pybutton str" ); - BLI_strncpy( but->val.asstr, newstr, len + 1 ); /* adds '\0' */ + BLI_strncpy( but->val.asstr, newstr, len + 1); /* adds '\0' */ but->val.asstr[real_len] = '\0'; if (info_arg[0] == '\0') info_str = info_str0; @@ -1244,7 +1249,7 @@ static PyObject *Method_Image( PyObject * self, PyObject * args ) float originX, originY; float zoomX = 1.0, zoomY = 1.0; int clipX = 0, clipY = 0, clipW = -1, clipH = -1; - GLfloat scissorBox[4]; + /*GLfloat scissorBox[4];*/ /* parse the arguments passed-in from Python */ if( !PyArg_ParseTuple( args, "Off|ffiiii", &pyObjImage, @@ -1301,10 +1306,28 @@ static PyObject *Method_Image( PyObject * self, PyObject * args ) * This particular technique is documented in the glRasterPos() man * page, although I haven't seen it used elsewhere in Blender. */ + + /* update (W): to fix a bug where images wouldn't get drawn if the bottom + * left corner of the Scripts win were above a given height or to the right + * of a given width, the code below is being commented out. It should not + * be needed anyway, because spaces in Blender are projected to lie inside + * their areas, see src/drawscript.c for example. Note: the + * glaRasterPosSafe2i function in src/glutil.c does use the commented out + * technique, but with 0,0 instead of scissorBox. This function can be + * a little optimized, based on glaDrawPixelsSafe in that same fine, but + * we're too close to release 2.37 right now. */ + /* glGetFloatv( GL_SCISSOR_BOX, scissorBox ); glRasterPos2i( scissorBox[0], scissorBox[1] ); glBitmap( 0, 0, 0.0, 0.0, originX-scissorBox[0], originY-scissorBox[1], NULL ); + */ + + /* update (cont.): using these two lines instead: + * (based on glaRasterPosSafe2i, but Ken Hughes deserves credit + * for suggesting this exact fix in the bug tracker) */ + glRasterPos2i(0, 0); + glBitmap( 0, 0, 0.0, 0.0, originX, originY, NULL ); /* set the zoom */ glPixelZoom( zoomX, zoomY ); |