diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-01-15 20:14:58 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-01-15 20:14:58 +0300 |
commit | 4f916b3081defe5cd61b5ed27aa0db6919883cf7 (patch) | |
tree | ac7fa5c3a21417b6f6db39c6c385efe7797e5503 /source/blender/python/api2_2x/BezTriple.c | |
parent | 56de05c4970f32651f15a4b3a55ec5f1cb7de7dc (diff) |
Removed printfs in setPoints(), add proper exception handling.
Diffstat (limited to 'source/blender/python/api2_2x/BezTriple.c')
-rw-r--r-- | source/blender/python/api2_2x/BezTriple.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/source/blender/python/api2_2x/BezTriple.c b/source/blender/python/api2_2x/BezTriple.c index 3d610e38fd6..c8b82d16a88 100644 --- a/source/blender/python/api2_2x/BezTriple.c +++ b/source/blender/python/api2_2x/BezTriple.c @@ -256,39 +256,20 @@ static PyObject *BezTriple_getTriple( BPy_BezTriple * self ) static PyObject *BezTriple_setPoints( BPy_BezTriple * self, PyObject * args ) { - int i; struct BezTriple *bezt = self->beztriple; PyObject *popo = 0; - if( !PyArg_ParseTuple( args, "O", &popo ) ) - return ( EXPP_ReturnPyObjError - ( PyExc_TypeError, "expected sequence argument" ) ); - - if( PySequence_Check( popo ) == 0 ) { - puts( "error in BezTriple_setPoints - expected sequence" ); - Py_INCREF( Py_None ); - return Py_None; - } - - { - /* - some debug stuff - this will become an overloaded args check - */ - int size = PySequence_Size( popo ); - printf( "\n dbg: sequence size is %d\n", size ); - } + if( !PyArg_ParseTuple( args, "O", &popo ) || !PySequence_Check( popo ) ) + return EXPP_ReturnPyObjError( PyExc_TypeError, + "expected sequence argument" ); for( i = 0; i < 2; i++ ) { - PyObject *o = PySequence_GetItem( popo, i ); - if( !o ) - printf( "\n bad o. o no!\n" ); - - /* bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i)); */ + PyObject *o = PySequence_ITEM( popo, i ); bezt->vec[1][i] = (float)PyFloat_AsDouble( o ); bezt->vec[0][i] = bezt->vec[1][i] - 1; bezt->vec[2][i] = bezt->vec[1][i] + 1; + Py_DECREF( o ); } /* experimental fussing with handles - ipo.c: calchandles_ipocurve */ @@ -298,8 +279,7 @@ static PyObject *BezTriple_setPoints( BPy_BezTriple * self, PyObject * args ) if( bezt->vec[2][0] < bezt->vec[1][0] ) bezt->vec[2][0] = bezt->vec[1][0]; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } |