diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index 2cd89b9db4e..1a65031f1a7 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -115,6 +115,9 @@ static PyObject *Curve_getMaterials( BPy_Curve * self ); static PyObject *Curve_getBevOb( BPy_Curve * self ); static PyObject *Curve_setBevOb( BPy_Curve * self, PyObject * args ); +static PyObject *Curve_getTaperOb( BPy_Curve * self ); +static PyObject *Curve_setTaperOb( BPy_Curve * self, PyObject * args ); + static PyObject *Curve_getIter( BPy_Curve * self ); static PyObject *Curve_iterNext( BPy_Curve * self ); @@ -223,6 +226,10 @@ Sets a control point "}, "() - returns Bevel Object assigned to this Curve"}, {"setBevOb", ( PyCFunction ) Curve_setBevOb, METH_VARARGS, "() - assign a Bevel Object to this Curve"}, + {"getTaperOb", ( PyCFunction ) Curve_getTaperOb, METH_NOARGS, + "() - returns Taper Object assigned to this Curve"}, + {"setTaperOb", ( PyCFunction ) Curve_setTaperOb, METH_VARARGS, + "() - assign a Taper Object to this Curve"}, {NULL, NULL, 0, NULL} }; @@ -1336,6 +1343,54 @@ PyObject *Curve_setBevOb( BPy_Curve * self, PyObject * args ) return EXPP_incr_ret( Py_None ); } +/*****************************************************************************/ +/* Function: Curve_getTaperOb */ +/* Description: Get the taper object assign to the curve. */ +/*****************************************************************************/ + + +static PyObject *Curve_getTaperOb( BPy_Curve * self) +{ + if( self->curve->taperobj ) { + return Object_CreatePyObject( self->curve->taperobj ); + } + + return EXPP_incr_ret( Py_None ); +} + +/*****************************************************************************/ +/* Function: Curve_setTaperOb */ +/* Description: Assign a taper object to the curve. */ +/*****************************************************************************/ + +PyObject *Curve_setTaperOb( BPy_Curve * self, PyObject * args ) +{ + BPy_Object *pytaperobj; + + /* Parse and check input args */ + if( !PyArg_ParseTuple( args, "O", &pytaperobj) ) { + return ( EXPP_ReturnPyObjError( PyExc_AttributeError, + "expected object or None argument" ) ); + } + + /* Accept None */ + if( (PyObject *)pytaperobj == Py_None ) { + self->curve->taperobj = (Object *)NULL; + } else { + /* Accept Object with type 'Curve' */ + if( Object_CheckPyObject( ( PyObject * ) pytaperobj ) && + pytaperobj->object->type == OB_CURVE) { + self->curve->taperobj = + Object_FromPyObject( ( PyObject * ) pytaperobj ); + } else { + return ( EXPP_ReturnPyObjError( PyExc_TypeError, + "expected Curve object type or None argument" ) ); + } + } + + return EXPP_incr_ret( Py_None ); +} + /* * Curve_getIter * @@ -1487,6 +1542,8 @@ static PyObject *CurveGetAttr( BPy_Curve * self, char *name ) return Curve_getSize( self ); else if( strcmp( name, "bevob" ) == 0 ) return Curve_getBevOb( self ); + else if( strcmp( name, "taperob" ) == 0 ) + return Curve_getTaperOb( self ); else if( strcmp( name, "key" ) == 0 ) return Curve_getKey( self ); #if 0 @@ -1545,6 +1602,8 @@ static int CurveSetAttr( BPy_Curve * self, char *name, PyObject * value ) error = Curve_setSize( self, valtuple ); else if( strcmp( name, "bevob" ) == 0 ) error = Curve_setBevOb( self, valtuple ); + else if( strcmp( name, "taperob" ) == 0 ) + error = Curve_setTaperOb( self, valtuple ); else { /* Error */ Py_DECREF( valtuple ); diff --git a/source/blender/python/api2_2x/doc/Curve.py b/source/blender/python/api2_2x/doc/Curve.py index a7a66bf08ad..72ed08456e6 100644 --- a/source/blender/python/api2_2x/doc/Curve.py +++ b/source/blender/python/api2_2x/doc/Curve.py @@ -338,6 +338,23 @@ class Curve: @raise TypeError: throws exception if the parameter is not a Curve type Blender Object or PyNone """ + def getTaperOb(): + """ + Returns the Taper Object (TaperOb) assigned to the Curve. + @rtype: Blender Object or PyNone + @return: Taper Object (TaperOb) assigned to the Curve. + """ + + def setTaperOb( object ): + """ + Assign a Taper Object (TaperOb) to the Curve. Passing None as the object parameter removes the taper. + @rtype: PyNone + @return: PyNone + @type object: Curve type Blender Object + @param object: Blender Object to assign as Taper Object (TaperOb) + @raise TypeError: throws exception if the parameter is not a Curve type Blender Object or PyNone + """ + def update(): """ Updates display list for a Curve. @@ -401,7 +418,7 @@ class CurNurb: The CurNurb also supports the sequence protocol which means you can access the control points of a CurNurb using the [] operator. - @ivar flagU: The CurNurb knot flag U (0: uniform, 1: endpoints, 2: bezier) + @ivar flagU: The CurNurb knot flag U. See L{setFlagU} for bit definitions. @ivar flagV: The CurNurb knot flag V (0: uniform, 1: endpoints, 2: bezier) @ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4) """ @@ -467,16 +484,19 @@ class CurNurb: def getFlagU(): """ - Get the CurNurb knot flag U + Get the CurNurb knot flag U. This flag is a bitfield. See L{setFlagU} for bit definitions. @rtype: integer - @return: 0 - uniform, 1 - endpoints, 2 - bezier + @return: 0 - uniform, 2 - endpoints, 4 - bezier """ def setFlagU( value ): """ - Set the CurNurb knot flag U (knots are recalculated automatically) + Set the entire CurNurb knot flag U (knots are recalculated automatically). Another of Blender's bitfields. + - bit 0: continuous. + - bit 1: endpoints. + - bit 2: bezier. @type value: integer - @param value: CurNurb knot flag (0 - uniform, 1 - endpoints, 2 - bezier) + @param value: CurNurb knot flag (0 - uniform, 2 - endpoints, 4 - bezier) @rtype: PyNone @return: PyNone """