Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-06-16 16:24:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-06-16 16:24:41 +0400
commit39a526a963e9e0a0f206556a8b740fab56ba2654 (patch)
tree69290c8f2186c5dbc4673da0a6de60a874e18ab2 /source/blender/python/api2_2x/Material.c
parent5135ed7b0e5c09c77a54e4359d7ff0b92003f4f0 (diff)
Python PyMethodDef supports single argument methods (METH_O) but was using METH_VARARGS everywhere and getting the single args from the tuple.
Use METH_O where applicable.
Diffstat (limited to 'source/blender/python/api2_2x/Material.c')
-rw-r--r--source/blender/python/api2_2x/Material.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index 019c3d750b9..21200882a7f 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -621,9 +621,9 @@ static PyObject *Material_getTextures( BPy_Material * self );
static PyObject *Material_clearIpo( BPy_Material * self );
static PyObject *Material_setTexture( BPy_Material * self, PyObject * args );
-static PyObject *Material_clearTexture( BPy_Material * self, PyObject * args );
+static PyObject *Material_clearTexture( BPy_Material * self, PyObject * value );
-static PyObject *Material_getScriptLinks(BPy_Material *self, PyObject * args );
+static PyObject *Material_getScriptLinks(BPy_Material *self, PyObject * value );
static PyObject *Material_addScriptLink(BPy_Material * self, PyObject * args );
static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args);
@@ -840,10 +840,9 @@ static PyMethodDef BPy_Material_methods[] = {
"(f) - Set fresnel power for refractions factor- [0.0, 5.0]"},
{"setTexture", ( PyCFunction ) Material_setTexture, METH_VARARGS,
"(n,tex,texco=0,mapto=0) - Set numbered texture to tex"},
- {"clearTexture", ( PyCFunction ) Material_clearTexture, METH_VARARGS,
+ {"clearTexture", ( PyCFunction ) Material_clearTexture, METH_O,
"(n) - Remove texture from numbered slot"},
- {"getScriptLinks", ( PyCFunction ) Material_getScriptLinks,
- METH_VARARGS,
+ {"getScriptLinks", ( PyCFunction ) Material_getScriptLinks, METH_O,
"(eventname) - Get a list of this material's scriptlinks (Text names) "
"of the given type\n"
"(eventname) - string: FrameChanged, Redraw or Render."},
@@ -2548,14 +2547,11 @@ static PyObject *Material_setTexture( BPy_Material * self, PyObject * args )
Py_RETURN_NONE;
}
-static PyObject *Material_clearTexture( BPy_Material * self, PyObject * args )
+static PyObject *Material_clearTexture( BPy_Material * self, PyObject * value )
{
- int texnum;
+ int texnum = (int)PyInt_AsLong(value);
struct MTex *mtex;
-
- if( !PyArg_ParseTuple( args, "i", &texnum ) )
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expected int in [0,9]" );
+ /* non ints will be -1 */
if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int in [0,9]" );
@@ -2595,7 +2591,7 @@ static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args )
/* mat.getScriptLinks */
static PyObject *Material_getScriptLinks( BPy_Material * self,
- PyObject * args )
+ PyObject * value )
{
Material *mat = self->material;
ScriptLink *slink = NULL;
@@ -2606,7 +2602,7 @@ static PyObject *Material_getScriptLinks( BPy_Material * self,
/* can't this just return? EXP_getScriptLinks() returns a PyObject*
* or NULL anyway */
- ret = EXPP_getScriptLinks( slink, args, 0 );
+ ret = EXPP_getScriptLinks( slink, value, 0 );
if( ret )
return ret;