Make curnurb.flagU and curnurb.flagV range check their inputs, plus make
the documentation correctly describe how the attributes and methods work.
This commit is contained in:
@@ -638,7 +638,8 @@ static PyObject *CurNurb_getFlagU( BPy_CurNurb * self )
|
||||
*
|
||||
* set curve's flagu and recalculate the knots
|
||||
*
|
||||
* Possible values: 0 - uniform, 1 - endpoints, 2 - bezier
|
||||
* Possible values: 0 - uniform, 2 - endpoints, 4 - bezier
|
||||
* bit 0 controls CU_CYCLIC
|
||||
*/
|
||||
|
||||
static PyObject *CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args )
|
||||
@@ -646,9 +647,12 @@ static PyObject *CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args )
|
||||
int flagu;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "i", &( flagu ) ) )
|
||||
return ( EXPP_ReturnPyObjError
|
||||
( PyExc_AttributeError,
|
||||
"expected integer argument" ) );
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected integer argument in range [0,5]" );
|
||||
|
||||
if( flagu < 0 || flagu > 5 )
|
||||
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"expected integer argument in range [0,5]" );
|
||||
|
||||
if( self->nurb->flagu != flagu ) {
|
||||
self->nurb->flagu = (short)flagu;
|
||||
@@ -689,9 +693,12 @@ static PyObject *CurNurb_setFlagV( BPy_CurNurb * self, PyObject * args )
|
||||
int flagv;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "i", &( flagv ) ) )
|
||||
return ( EXPP_ReturnPyObjError
|
||||
( PyExc_AttributeError,
|
||||
"expected integer argument" ) );
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected integer argument in range [0,5]" );
|
||||
|
||||
if( flagv < 0 || flagv > 5 )
|
||||
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"expected integer argument in range [0,5]" );
|
||||
|
||||
if( self->nurb->flagv != flagv ) {
|
||||
self->nurb->flagv = (short)flagv;
|
||||
|
||||
@@ -418,8 +418,8 @@ 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. See L{setFlagU} for bit definitions.
|
||||
@ivar flagV: The CurNurb knot flag V (0: uniform, 1: endpoints, 2: bezier)
|
||||
@ivar flagU: The CurNurb knot flag U. See L{setFlagU} for description.
|
||||
@ivar flagV: The CurNurb knot flag V. See L{setFlagU} for description.
|
||||
@ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4)
|
||||
"""
|
||||
|
||||
@@ -484,35 +484,37 @@ class CurNurb:
|
||||
|
||||
def getFlagU():
|
||||
"""
|
||||
Get the CurNurb knot flag U. This flag is a bitfield. See L{setFlagU} for bit definitions.
|
||||
Get the CurNurb knot flag U.
|
||||
@rtype: integer
|
||||
@return: 0 - uniform, 2 - endpoints, 4 - bezier
|
||||
@return: See L{setFlagU} for description of return value.
|
||||
"""
|
||||
|
||||
def setFlagU( value ):
|
||||
def setFlagU( flag ):
|
||||
"""
|
||||
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, 2 - endpoints, 4 - bezier)
|
||||
Set the entire CurNurb knot flag U (knots are recalculated automatically).
|
||||
The flag can be one of six values:
|
||||
- 0 or 1: uniform knots
|
||||
- 2 or 3: endpoints knots
|
||||
- 4 or 5: bezier knots
|
||||
Bit 0 controls whether or not the curve is cyclic (1 = cyclic).
|
||||
@type flag: integer
|
||||
@param flag: CurNurb knot flag
|
||||
@rtype: PyNone
|
||||
@return: PyNone
|
||||
"""
|
||||
|
||||
def getFlagV():
|
||||
"""
|
||||
Get the CurNurb knot flag V
|
||||
Get the CurNurb knot flag V.
|
||||
@rtype: integer
|
||||
@return: 0 - uniform, 1 - endpoints, 2 - bezier
|
||||
@return: See L{setFlagU} for description of return value.
|
||||
"""
|
||||
|
||||
def setFlagV( value ):
|
||||
"""
|
||||
Set the CurNurb knot flag V (knots are recalculated automatically)
|
||||
Set the CurNurb knot flag V (knots are recalculated automatically).
|
||||
@type value: integer
|
||||
@param value: CurNurb knot flag (0 - uniform, 1 - endpoints, 2 - bezier)
|
||||
@param value: See L{setFlagU} for description of return.
|
||||
@rtype: PyNone
|
||||
@return: PyNone
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user