forked from bartvdbraak/blender
patch #3011 ] update to curnurb.setFlagU doc, added set and get for Taper
Contributed by Toni Alatalo (antont). Support for Taper Objects for Curves. Code for curnurb.setFlagU() method not changed as per discussion on bf-python mail list.
This commit is contained in:
parent
5f15cf3d9a
commit
24ee7278b9
@ -115,6 +115,9 @@ static PyObject *Curve_getMaterials( BPy_Curve * self );
|
|||||||
static PyObject *Curve_getBevOb( BPy_Curve * self );
|
static PyObject *Curve_getBevOb( BPy_Curve * self );
|
||||||
static PyObject *Curve_setBevOb( BPy_Curve * self, PyObject * args );
|
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_getIter( BPy_Curve * self );
|
||||||
static PyObject *Curve_iterNext( 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"},
|
"() - returns Bevel Object assigned to this Curve"},
|
||||||
{"setBevOb", ( PyCFunction ) Curve_setBevOb, METH_VARARGS,
|
{"setBevOb", ( PyCFunction ) Curve_setBevOb, METH_VARARGS,
|
||||||
"() - assign a Bevel Object to this Curve"},
|
"() - 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}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1336,6 +1343,54 @@ PyObject *Curve_setBevOb( BPy_Curve * self, PyObject * args )
|
|||||||
return EXPP_incr_ret( Py_None );
|
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
|
* Curve_getIter
|
||||||
*
|
*
|
||||||
@ -1487,6 +1542,8 @@ static PyObject *CurveGetAttr( BPy_Curve * self, char *name )
|
|||||||
return Curve_getSize( self );
|
return Curve_getSize( self );
|
||||||
else if( strcmp( name, "bevob" ) == 0 )
|
else if( strcmp( name, "bevob" ) == 0 )
|
||||||
return Curve_getBevOb( self );
|
return Curve_getBevOb( self );
|
||||||
|
else if( strcmp( name, "taperob" ) == 0 )
|
||||||
|
return Curve_getTaperOb( self );
|
||||||
else if( strcmp( name, "key" ) == 0 )
|
else if( strcmp( name, "key" ) == 0 )
|
||||||
return Curve_getKey( self );
|
return Curve_getKey( self );
|
||||||
#if 0
|
#if 0
|
||||||
@ -1545,6 +1602,8 @@ static int CurveSetAttr( BPy_Curve * self, char *name, PyObject * value )
|
|||||||
error = Curve_setSize( self, valtuple );
|
error = Curve_setSize( self, valtuple );
|
||||||
else if( strcmp( name, "bevob" ) == 0 )
|
else if( strcmp( name, "bevob" ) == 0 )
|
||||||
error = Curve_setBevOb( self, valtuple );
|
error = Curve_setBevOb( self, valtuple );
|
||||||
|
else if( strcmp( name, "taperob" ) == 0 )
|
||||||
|
error = Curve_setTaperOb( self, valtuple );
|
||||||
|
|
||||||
else { /* Error */
|
else { /* Error */
|
||||||
Py_DECREF( valtuple );
|
Py_DECREF( valtuple );
|
||||||
|
@ -338,6 +338,23 @@ class Curve:
|
|||||||
@raise TypeError: throws exception if the parameter is not a Curve type Blender Object or PyNone
|
@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():
|
def update():
|
||||||
"""
|
"""
|
||||||
Updates display list for a Curve.
|
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.
|
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 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)
|
@ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4)
|
||||||
"""
|
"""
|
||||||
@ -467,16 +484,19 @@ class CurNurb:
|
|||||||
|
|
||||||
def getFlagU():
|
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
|
@rtype: integer
|
||||||
@return: 0 - uniform, 1 - endpoints, 2 - bezier
|
@return: 0 - uniform, 2 - endpoints, 4 - bezier
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setFlagU( value ):
|
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
|
@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
|
@rtype: PyNone
|
||||||
@return: PyNone
|
@return: PyNone
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user