diff options
author | Willian Padovani Germano <wpgermano@gmail.com> | 2005-02-09 08:19:24 +0300 |
---|---|---|
committer | Willian Padovani Germano <wpgermano@gmail.com> | 2005-02-09 08:19:24 +0300 |
commit | 05bf482f6a50bd711fc6bb7ad986919741d478ae (patch) | |
tree | 92954a8c8840ff02afec41a7b728f549dc5de6a6 /source/blender/python/api2_2x/Image.c | |
parent | 955d5aa6eb1a2d3763fd6e3d98e10357cf58fd03 (diff) |
BPython:
- NMesh: made nmesh.update accept an optional 'vertex_shade' param to init vcols with shading info, like when you enter vpaint mode or press the relevant "make" button for a mesh without vcols. This is still a test, the functionality was requested by Manuel Bastioni for the SSS script they are working on:
http://www.dedalo-3d.com/index.php?filename=SXCOL/makehuman/articles/subsurface_scattering_in_python.html
- sys: made makename() accept files with max FILE_MAXDIR+FILE_MAXFILE name length, should fix #2192. Was only FILE_MAXFILE, a mistake;
- Image: added .setFilename(), contributed by Campbell Barton;
- Camera: added camera.get/setScale for the new param added by Ton for ortho cameras. Requested by Jean-Michel Soler for the Texture Baker script;
- related doc updates.
Diffstat (limited to 'source/blender/python/api2_2x/Image.c')
-rw-r--r-- | source/blender/python/api2_2x/Image.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c index d4debde9000..b651745256f 100644 --- a/source/blender/python/api2_2x/Image.c +++ b/source/blender/python/api2_2x/Image.c @@ -247,6 +247,7 @@ static PyObject *Image_getXRep( BPy_Image * self ); static PyObject *Image_getYRep( BPy_Image * self ); static PyObject *Image_getBindCode( BPy_Image * self ); static PyObject *Image_setName( BPy_Image * self, PyObject * args ); +static PyObject *Image_setFilename( BPy_Image * self, PyObject * args ); static PyObject *Image_setXRep( BPy_Image * self, PyObject * args ); static PyObject *Image_setYRep( BPy_Image * self, PyObject * args ); static PyObject *Image_reload( BPy_Image * self ); /* by Campbell */ @@ -282,6 +283,8 @@ static PyMethodDef BPy_Image_methods[] = { see also image.glLoad()."}, {"setName", ( PyCFunction ) Image_setName, METH_VARARGS, "(str) - Change Image object name"}, + {"setFilename", ( PyCFunction ) Image_setFilename, METH_VARARGS, + "(str) - Change Image file name"}, {"setXRep", ( PyCFunction ) Image_setXRep, METH_VARARGS, "(int) - Change Image object x repetition value"}, {"setYRep", ( PyCFunction ) Image_setYRep, METH_VARARGS, @@ -546,6 +549,23 @@ static PyObject *Image_setName( BPy_Image * self, PyObject * args ) return Py_None; } +static PyObject *Image_setFilename( BPy_Image * self, PyObject * args ) +{ + char *name; + char buf[160]; + + if( !PyArg_ParseTuple( args, "s", &name ) ) + return ( EXPP_ReturnPyObjError( PyExc_TypeError, + "expected string argument" ) ); + + PyOS_snprintf( buf, sizeof( buf ), "%s", name ); + + strcpy(self->image->name, buf); + + Py_INCREF( Py_None ); + return Py_None; +} + static PyObject *Image_setXRep( BPy_Image * self, PyObject * args ) { short value; @@ -648,6 +668,8 @@ static int Image_setAttr( BPy_Image * self, char *name, PyObject * value ) if( strcmp( name, "name" ) == 0 ) error = Image_setName( self, valtuple ); + if( strcmp( name, "filename" ) == 0 ) + error = Image_setFilename( self, valtuple ); else if( strcmp( name, "xrep" ) == 0 ) error = Image_setXRep( self, valtuple ); else if( strcmp( name, "yrep" ) == 0 ) |