diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-06-16 16:24:41 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-06-16 16:24:41 +0400 |
commit | 39a526a963e9e0a0f206556a8b740fab56ba2654 (patch) | |
tree | 69290c8f2186c5dbc4673da0a6de60a874e18ab2 /source/blender/python/api2_2x/Ipo.c | |
parent | 5135ed7b0e5c09c77a54e4359d7ff0b92003f4f0 (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/Ipo.c')
-rw-r--r-- | source/blender/python/api2_2x/Ipo.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c index 466337ff914..45b6f8a2c79 100644 --- a/source/blender/python/api2_2x/Ipo.c +++ b/source/blender/python/api2_2x/Ipo.c @@ -86,7 +86,7 @@ struct PyMethodDef M_Ipo_methods[] = { M_Ipo_New_doc}, {"Get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc}, {"get", M_Ipo_Get, METH_VARARGS, M_Ipo_Get_doc}, - {"Recalc", M_Ipo_Recalc, METH_VARARGS, M_Ipo_Get_doc}, + {"Recalc", M_Ipo_Recalc, METH_O, M_Ipo_Get_doc}, {NULL, NULL, 0, NULL} }; @@ -103,7 +103,7 @@ static int Ipo_setRctf( BPy_Ipo * self, PyObject * args ); static PyObject *Ipo_getCurve( BPy_Ipo * self, PyObject * args ); static PyObject *Ipo_getCurves( BPy_Ipo * self ); static PyObject *Ipo_getCurveNames( BPy_Ipo * self ); -static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * args ); +static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * value ); static PyObject *Ipo_delCurve( BPy_Ipo * self, PyObject * args ); static PyObject *Ipo_getNcurves( BPy_Ipo * self ); static PyObject *Ipo_getNBezPoints( BPy_Ipo * self, PyObject * args ); @@ -142,7 +142,7 @@ static PyMethodDef BPy_Ipo_methods[] = { "() - Return Ipo rctf"}, {"setRctf", ( PyCFunction ) Ipo_oldsetRctf, METH_VARARGS, "(flt,flt,flt,flt) - Change Ipo rctf"}, - {"addCurve", ( PyCFunction ) Ipo_addCurve, METH_VARARGS, + {"addCurve", ( PyCFunction ) Ipo_addCurve, METH_O, "() - Add a curve to Ipo"}, {"delCurve", ( PyCFunction ) Ipo_delCurve, METH_VARARGS, "(str) - Delete curve from Ipo"}, @@ -790,15 +790,13 @@ static PyObject *M_Ipo_Get( PyObject * self_unused, PyObject * args ) /* Description: Receives (presumably) an IpoCurve object and */ /* updates the curve after changes to control points. */ /*****************************************************************************/ -static PyObject *M_Ipo_Recalc( PyObject * self_unused, PyObject * args ) +static PyObject *M_Ipo_Recalc( PyObject * self_unused, PyObject * value ) { - PyObject *pyobj; - - if( !PyArg_ParseTuple( args, "O!", &IpoCurve_Type, &pyobj ) ) + if( !BPy_IpoCurve_Check(value) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected Ipo curve argument" ); - testhandles_ipocurve( IpoCurve_FromPyObject( pyobj ) ); + testhandles_ipocurve( IpoCurve_FromPyObject( value ) ); Py_RETURN_NONE; } @@ -882,15 +880,15 @@ static PyObject *Ipo_getNcurves( BPy_Ipo * self ) cu = ipo.addCurve('LocX') */ -static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * args ) +static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * value ) { short param; /* numeric curve name constant */ - char *cur_name = 0; /* input arg: curve name */ + char *cur_name = PyString_AsString(value); /* input arg: curve name */ Ipo *ipo = 0; IpoCurve *icu = 0; Link *link; - if( !PyArg_ParseTuple( args, "s", &cur_name ) ) + if( !cur_name ) return ( EXPP_ReturnPyObjError ( PyExc_TypeError, "expected string argument" ) ); @@ -959,12 +957,12 @@ static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * args ) cu = ipo.delCurve('LocX') */ -static PyObject *Ipo_delCurve( BPy_Ipo * self, PyObject * args ) +static PyObject *Ipo_delCurve( BPy_Ipo * self, PyObject * value ) { IpoCurve *icu; - char *strname; + char *strname = PyString_AsString(value); - if( !PyArg_ParseTuple( args, "s", &strname ) ) + if( !strname ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); |