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
|
* 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 )
|
static PyObject *CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args )
|
||||||
@@ -646,9 +647,12 @@ static PyObject *CurNurb_setFlagU( BPy_CurNurb * self, PyObject * args )
|
|||||||
int flagu;
|
int flagu;
|
||||||
|
|
||||||
if( !PyArg_ParseTuple( args, "i", &( flagu ) ) )
|
if( !PyArg_ParseTuple( args, "i", &( flagu ) ) )
|
||||||
return ( EXPP_ReturnPyObjError
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||||
( PyExc_AttributeError,
|
"expected integer argument in range [0,5]" );
|
||||||
"expected integer argument" ) );
|
|
||||||
|
if( flagu < 0 || flagu > 5 )
|
||||||
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||||
|
"expected integer argument in range [0,5]" );
|
||||||
|
|
||||||
if( self->nurb->flagu != flagu ) {
|
if( self->nurb->flagu != flagu ) {
|
||||||
self->nurb->flagu = (short)flagu;
|
self->nurb->flagu = (short)flagu;
|
||||||
@@ -689,9 +693,12 @@ static PyObject *CurNurb_setFlagV( BPy_CurNurb * self, PyObject * args )
|
|||||||
int flagv;
|
int flagv;
|
||||||
|
|
||||||
if( !PyArg_ParseTuple( args, "i", &( flagv ) ) )
|
if( !PyArg_ParseTuple( args, "i", &( flagv ) ) )
|
||||||
return ( EXPP_ReturnPyObjError
|
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||||
( PyExc_AttributeError,
|
"expected integer argument in range [0,5]" );
|
||||||
"expected integer argument" ) );
|
|
||||||
|
if( flagv < 0 || flagv > 5 )
|
||||||
|
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||||
|
"expected integer argument in range [0,5]" );
|
||||||
|
|
||||||
if( self->nurb->flagv != flagv ) {
|
if( self->nurb->flagv != flagv ) {
|
||||||
self->nurb->flagv = (short)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.
|
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 flagU: The CurNurb knot flag U. See L{setFlagU} for description.
|
||||||
@ivar flagV: The CurNurb knot flag V (0: uniform, 1: endpoints, 2: bezier)
|
@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)
|
@ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -484,35 +484,37 @@ class CurNurb:
|
|||||||
|
|
||||||
def getFlagU():
|
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
|
@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.
|
Set the entire CurNurb knot flag U (knots are recalculated automatically).
|
||||||
- bit 0: continuous.
|
The flag can be one of six values:
|
||||||
- bit 1: endpoints.
|
- 0 or 1: uniform knots
|
||||||
- bit 2: bezier.
|
- 2 or 3: endpoints knots
|
||||||
@type value: integer
|
- 4 or 5: bezier knots
|
||||||
@param value: CurNurb knot flag (0 - uniform, 2 - endpoints, 4 - bezier)
|
Bit 0 controls whether or not the curve is cyclic (1 = cyclic).
|
||||||
|
@type flag: integer
|
||||||
|
@param flag: CurNurb knot flag
|
||||||
@rtype: PyNone
|
@rtype: PyNone
|
||||||
@return: PyNone
|
@return: PyNone
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def getFlagV():
|
def getFlagV():
|
||||||
"""
|
"""
|
||||||
Get the CurNurb knot flag V
|
Get the CurNurb knot flag V.
|
||||||
@rtype: integer
|
@rtype: integer
|
||||||
@return: 0 - uniform, 1 - endpoints, 2 - bezier
|
@return: See L{setFlagU} for description of return value.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setFlagV( 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
|
@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
|
@rtype: PyNone
|
||||||
@return: PyNone
|
@return: PyNone
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user