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/CurNurb.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/CurNurb.c')
-rw-r--r--source/blender/python/api2_2x/CurNurb.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c
index 9d930fee1ca..f919167372c 100644
--- a/source/blender/python/api2_2x/CurNurb.c
+++ b/source/blender/python/api2_2x/CurNurb.c
@@ -62,7 +62,7 @@ static int CurNurb_setPoint( BPy_CurNurb * self, int index, PyObject * ob );
static int CurNurb_length( PyInstanceObject * inst );
static PyObject *CurNurb_getIter( BPy_CurNurb * self );
static PyObject *CurNurb_iterNext( BPy_CurNurb * self );
-PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * args );
+PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * value );
static PyObject *CurNurb_isNurb( BPy_CurNurb * self );
static PyObject *CurNurb_isCyclic( BPy_CurNurb * self );
@@ -124,7 +124,7 @@ static PyMethodDef BPy_CurNurb_methods[] = {
"( type ) - change the type of the curve (Poly: 0, Bezier: 1, NURBS: 4)"},
{"getType", ( PyCFunction ) CurNurb_getType, METH_NOARGS,
"( ) - get the type of the curve (Poly: 0, Bezier: 1, NURBS: 4)"},
- {"append", ( PyCFunction ) CurNurb_append, METH_VARARGS,
+ {"append", ( PyCFunction ) CurNurb_append, METH_O,
"( point ) - add a new point. arg is BezTriple or list of x,y,z,w floats"},
{"isNurb", ( PyCFunction ) CurNurb_isNurb, METH_NOARGS,
"( ) - boolean function tests if this spline is type nurb or bezier"},
@@ -435,11 +435,9 @@ static PyObject *CurNurb_getPoints( BPy_CurNurb * self )
* arg is BezTriple or list of xyzw floats
*/
-PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * args )
+PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * value )
{
- Nurb *nurb = self->nurb;
-
- return CurNurb_appendPointToNurb( nurb, args );
+ return CurNurb_appendPointToNurb( self->nurb, value );
}
@@ -449,29 +447,22 @@ PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * args )
* notice the first arg is Nurb*.
*/
-PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
+PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
{
int i;
int size;
- PyObject *pyOb;
int npoints = nurb->pntsu;
/*
do we have a list of four floats or a BezTriple?
*/
- if( !PyArg_ParseTuple( args, "O", &pyOb ))
- return EXPP_ReturnPyObjError
- ( PyExc_RuntimeError,
- "Internal error parsing arguments" );
-
-
-
+
/* if curve is empty, adjust type depending on input type */
if (nurb->bezt==NULL && nurb->bp==NULL) {
- if (BPy_BezTriple_Check( pyOb ))
+ if (BPy_BezTriple_Check( value ))
nurb->type |= CU_BEZIER;
- else if (PySequence_Check( pyOb ))
+ else if (PySequence_Check( value ))
nurb->type |= CU_NURBS;
else
return( EXPP_ReturnPyObjError( PyExc_TypeError,
@@ -483,7 +474,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
if ((nurb->type & 7)==CU_BEZIER) {
BezTriple *tmp;
- if( !BPy_BezTriple_Check( pyOb ) )
+ if( !BPy_BezTriple_Check( value ) )
return( EXPP_ReturnPyObjError( PyExc_TypeError,
"Expected a BezTriple\n" ) );
@@ -507,11 +498,11 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
nurb->pntsu++;
/* add new point to end of list */
memcpy( nurb->bezt + npoints,
- BezTriple_FromPyObject( pyOb ), sizeof( BezTriple ) );
+ BezTriple_FromPyObject( value ), sizeof( BezTriple ) );
}
- else if( PySequence_Check( pyOb ) ) {
- size = PySequence_Size( pyOb );
+ else if( PySequence_Check( value ) ) {
+ size = PySequence_Size( value );
/* printf("\ndbg: got a sequence of size %d\n", size ); */
if( size == 4 || size == 5 ) {
BPoint *tmp;
@@ -537,7 +528,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
sizeof( BPoint ) );
for( i = 0; i < 4; ++i ) {
- PyObject *item = PySequence_GetItem( pyOb, i );
+ PyObject *item = PySequence_GetItem( value, i );
if (item == NULL)
return NULL;
@@ -548,7 +539,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * args )
}
if (size == 5) {
- PyObject *item = PySequence_GetItem( pyOb, i );
+ PyObject *item = PySequence_GetItem( value, i );
if (item == NULL)
return NULL;