Python API
---------- Perform better param checking on Curve bevel and taper objects so that an curve can't use its own object. Also stick a big warning in the docs for Curve.setTotcol(), which seems to be an extremely dangerous method.
This commit is contained in:
@@ -732,47 +732,6 @@ PyObject *Curve_setExt2( BPy_Curve * self, PyObject * args )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static PyObject *Curve_setControlPoint(BPy_Curve *self, PyObject *args)
|
||||
{
|
||||
Nurb*ptrnurb = self->curve->nurb.first;
|
||||
int numcourbe,numpoint,i,j;
|
||||
float x,y,z,w;
|
||||
float bez[9];
|
||||
if (!ptrnurb){ Py_INCREF(Py_None);return Py_None;}
|
||||
|
||||
if (ptrnurb->bp)
|
||||
if (!PyArg_ParseTuple(args, "iiffff", &numcourbe,&numpoint,&x,&y,&z,&w))
|
||||
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
|
||||
"expected int int float float float float arguments"));
|
||||
if (ptrnurb->bezt)
|
||||
if (!PyArg_ParseTuple(args, "iifffffffff", &numcourbe,&numpoint,
|
||||
bez,bez+1,bez+2,bez+3,bez+4,bez+5,bez+6,bez+7,bez+8))
|
||||
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
|
||||
"expected int int float float float float float float "
|
||||
"float float float arguments"));
|
||||
|
||||
for(i = 0;i< numcourbe;i++)
|
||||
ptrnurb=ptrnurb->next;
|
||||
if (ptrnurb->bp)
|
||||
{
|
||||
ptrnurb->bp[numpoint].vec[0] = x;
|
||||
ptrnurb->bp[numpoint].vec[1] = y;
|
||||
ptrnurb->bp[numpoint].vec[2] = z;
|
||||
ptrnurb->bp[numpoint].vec[3] = w;
|
||||
}
|
||||
if (ptrnurb->bezt)
|
||||
{
|
||||
for(i = 0;i<3;i++)
|
||||
for(j = 0;j<3;j++)
|
||||
ptrnurb->bezt[numpoint].vec[i][j] = bez[i*3+j];
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Curve_setControlPoint
|
||||
* this function sets an EXISTING control point.
|
||||
@@ -1367,7 +1326,11 @@ PyObject *Curve_setBevOb( BPy_Curve * self, PyObject * args )
|
||||
} else {
|
||||
/* Accept Object with type 'Curve' */
|
||||
if( Object_CheckPyObject( ( PyObject * ) pybevobj ) &&
|
||||
pybevobj->object->type == OB_CURVE) {
|
||||
pybevobj->object->type == OB_CURVE) {
|
||||
if(self->curve == pybevobj->object->data )
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"objects cannot bevel themselves" );
|
||||
|
||||
self->curve->bevobj =
|
||||
Object_FromPyObject( ( PyObject * ) pybevobj );
|
||||
} else {
|
||||
@@ -1415,7 +1378,10 @@ PyObject *Curve_setTaperOb( BPy_Curve * self, PyObject * args )
|
||||
} else {
|
||||
/* Accept Object with type 'Curve' */
|
||||
if( Object_CheckPyObject( ( PyObject * ) pytaperobj ) &&
|
||||
pytaperobj->object->type == OB_CURVE) {
|
||||
pytaperobj->object->type == OB_CURVE) {
|
||||
if(self->curve == pytaperobj->object->data )
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"objects cannot taper themselves" );
|
||||
self->curve->taperobj =
|
||||
Object_FromPyObject( ( PyObject * ) pytaperobj );
|
||||
} else {
|
||||
|
||||
@@ -105,7 +105,7 @@ class Curve:
|
||||
@type name: string
|
||||
@ivar pathlen: The Curve Data path length.
|
||||
@type pathlen: int
|
||||
@ivar totcol: The Curve Data maximal number of linked materials.
|
||||
@ivar totcol: The Curve Data maximal number of linked materials. Read-only.
|
||||
@type totcol: int
|
||||
@ivar flag: The Curve Data flag value; see L{getFlag()} for the semantics.
|
||||
@ivar bevresol: The Curve Data bevel resolution.
|
||||
@@ -179,10 +179,15 @@ class Curve:
|
||||
|
||||
def setTotcol(totcol):
|
||||
"""
|
||||
Set the number of materials linked to the Curve.
|
||||
Set the number of materials linked to the Curve. B{Note}: this method
|
||||
will probably be deprecated in the future.
|
||||
@rtype: None
|
||||
@type totcol: int
|
||||
@param totcol: number of materials linked.
|
||||
@warn: It is not advisable to use this method unless you know what you
|
||||
are doing; it's possible to
|
||||
corrupt a .blend file if you don't know what you're doing. If you want
|
||||
to change the number of materials, use the L{materials} attribute.
|
||||
"""
|
||||
|
||||
def getFlag():
|
||||
|
||||
Reference in New Issue
Block a user