From 3d4438dcd76d74b47daba6c8a1ab2683ba6db123 Mon Sep 17 00:00:00 2001 From: Willian Padovani Germano Date: Sun, 12 Jun 2005 05:54:15 +0000 Subject: Scripts: - Campbell Barton updated his Wavefront obj importer; - Jean-Michel Soler updated his paths import (eps part). BPython bug fixes: - oldie found by Ken Hughes: reference count of two pyobjects not being decremented in slider callback (Draw.c): http://projects.blender.org/tracker/index.php?func=detail&aid=2727&group_id=9&atid=127 - Gergely Erdelyi found that setText() in Text3d module was not updating str length var, leading to mem corruption and provided a patch: http://projects.blender.org/tracker/?func=detail&aid=2713&group_id=9&atid=127 - doc updates (suggested by Campbell) Thanks guys. --- source/blender/python/api2_2x/Draw.c | 10 ++++++++-- source/blender/python/api2_2x/Text3d.c | 11 ++++++----- source/blender/python/api2_2x/doc/Material.py | 26 +++++++++++++------------- 3 files changed, 27 insertions(+), 20 deletions(-) (limited to 'source') diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c index f6c5aff0db8..ec72394efc2 100644 --- a/source/blender/python/api2_2x/Draw.c +++ b/source/blender/python/api2_2x/Draw.c @@ -850,6 +850,8 @@ static PyObject *Method_Toggle( PyObject * self, PyObject * args ) static void py_slider_update( void *butv, void *data2_unused ) { uiBut *but = butv; + PyObject *ref = Py_BuildValue( "(i)", SPACE_VIEW3D ); + PyObject *ret = NULL; EXPP_disable_force_draw = 1; /*@ Disable forced drawing, otherwise the button object which @@ -862,8 +864,12 @@ static void py_slider_update( void *butv, void *data2_unused ) spacescript_do_pywin_buttons( curarea->spacedata.first, uiButGetRetVal( but ) ); - /* XXX useless right now: */ - M_Window_Redraw( 0, Py_BuildValue( "(i)", SPACE_VIEW3D ) ); + + /* XXX useless right now, investigate better before a bcon 5 */ + ret = M_Window_Redraw( 0, ref ); + + Py_DECREF(ref); + if (ret) { Py_DECREF(ret); } disable_where_script( 0 ); diff --git a/source/blender/python/api2_2x/Text3d.c b/source/blender/python/api2_2x/Text3d.c index e9a957648fe..1f717281117 100644 --- a/source/blender/python/api2_2x/Text3d.c +++ b/source/blender/python/api2_2x/Text3d.c @@ -491,11 +491,12 @@ static PyObject *Text3d_setText( BPy_Text3d * self, PyObject * args ) if( !PyArg_ParseTuple( args, "s", &text ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected string argument" ) ); - if (self) { - MEM_freeN (self->curve->str); - self->curve->str= MEM_mallocN (strlen (text)+1, "str"); - strcpy (self->curve->str, text); - self->curve->pos= strlen (text); + if( self ) { + MEM_freeN( self->curve->str ); + self->curve->str = MEM_mallocN( strlen (text)+1, "str" ); + strcpy( self->curve->str, text ); + self->curve->pos = strlen ( text ); + self->curve->len = strlen ( text ); } Py_INCREF( Py_None ); return Py_None; diff --git a/source/blender/python/api2_2x/doc/Material.py b/source/blender/python/api2_2x/doc/Material.py index c8d85096b67..59914a32d53 100644 --- a/source/blender/python/api2_2x/doc/Material.py +++ b/source/blender/python/api2_2x/doc/Material.py @@ -14,7 +14,7 @@ Example:: import Blender from Blender import Material mat = Material.New('newMat') # create a new Material called 'newMat' - print mat.rgbCol # print its rgb color triplet + print mat.rgbCol # print its rgb color triplet sequence mat.rgbCol = [0.8, 0.2, 0.2] # change its color mat.setAlpha(0.2) # mat.alpha = 0.2 -- almost transparent mat.emit = 0.7 # equivalent to mat.setEmit(0.8) @@ -87,9 +87,9 @@ class Material: @type mode: int @cvar mode: Mode flags as an or'ed int value. See the Modes dictionary keys and descriptions in L{Modes}. - @cvar rgbCol: Material's RGB color triplet. - @cvar specCol: Specular color rgb triplet. - @cvar mirCol: Mirror color rgb triplet. + @cvar rgbCol: Material's RGB color triplet sequence. + @cvar specCol: Specular color rgb triplet sequence. + @cvar mirCol: Mirror color rgb triplet sequence. @cvar R: Red component of L{rgbCol} - [0.0, 1.0]. @cvar G: Green component of L{rgbCol} - [0.0, 1.0]. @cvar B: Blue component of L{rgbCol} - [0.0, 1.0]. @@ -221,14 +221,14 @@ class Material: def getRGBCol(): """ - Get the rgb color triplet. + Get the rgb color triplet sequence. @rtype: list of 3 floats @return: [r, g, b] """ def setRGBCol(rgb = None): """ - Set the rgb color triplet. If B{rgb} is None, set the color to black. + Set the rgb color triplet sequence. If B{rgb} is None, set the color to black. @type rgb: three floats or a list of three floats @param rgb: The rgb color values in [0.0, 1.0] as: - a list of three floats: setRGBCol ([r, g, b]) B{or} @@ -237,14 +237,14 @@ class Material: def getSpecCol(): """ - Get the specular color triplet. + Get the specular color triplet sequence. @rtype: list of 3 floats @return: [specR, specG, specB] """ def setSpecCol(rgb = None): """ - Set the specular color triplet. If B{rgb} is None, set the color to black. + Set the specular color triplet sequence. If B{rgb} is None, set the color to black. @type rgb: three floats or a list of three floats @param rgb: The rgb color values in [0.0, 1.0] as: - a list of three floats: setSpecCol ([r, g, b]) B{or} @@ -253,14 +253,14 @@ class Material: def getMirCol(): """ - Get the mirror color triplet. + Get the mirror color triplet sequence. @rtype: list of 3 floats @return: [mirR, mirG, mirb] """ def setMirCol(rgb = None): """ - Set the mirror color triplet. If B{rgb} is None, set the color to black. + Set the mirror color triplet sequence. If B{rgb} is None, set the color to black. @type rgb: three floats or a list of three floats @param rgb: The rgb color values in [0.0, 1.0] as: - a list of three floats: setMirCol ([r, g, b]) B{or} @@ -459,7 +459,7 @@ class Material: """ Set the hardness of the specularity. @type hardness: int - @param hardness: The new value in [1, 255]. + @param hardness: The new value in [1, 511]. """ def getNFlares(): @@ -622,7 +622,7 @@ class Material: """ Assign a Blender Texture object to slot number 'number'. @type index: int - @param index: material's texture index in [0, 7]. + @param index: material's texture index in [0, 9]. @type texture: Blender Texture @param texture: a Blender Texture object. @type texco: int @@ -635,7 +635,7 @@ class Material: """ Clear the ith (given by 'index') texture channel of this material. @type index: int - @param index: material's texture channel index in [0, 7]. + @param index: material's texture channel index in [0, 9]. """ def getTextures (): -- cgit v1.2.3