forked from bartvdbraak/blender
fix for bug 1110.
Updated epydoc. Function name is BezTriple.getTriple(). Set prototype to NOARGS in source.
This commit is contained in:
parent
d2f95ea72e
commit
c1e33eb1e7
@ -85,8 +85,8 @@ static PyMethodDef C_BezTriple_methods[] = {
|
|||||||
"(str) - Change BezTriple point coordinates"},
|
"(str) - Change BezTriple point coordinates"},
|
||||||
{"getPoints", (PyCFunction) BezTriple_getPoints, METH_NOARGS,
|
{"getPoints", (PyCFunction) BezTriple_getPoints, METH_NOARGS,
|
||||||
"() - return BezTriple knot point x and y coordinates"},
|
"() - return BezTriple knot point x and y coordinates"},
|
||||||
{"getTriple", (PyCFunction) BezTriple_getTriple, METH_VARARGS,
|
{"getTriple", (PyCFunction) BezTriple_getTriple, METH_NOARGS,
|
||||||
"() - return list of floating point triplets. order is H1, knot, H2"},
|
"() - return list of 3 floating point triplets. order is H1, knot, H2"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -169,6 +169,15 @@ BezTriple_getPoints (C_BezTriple * self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BezTriple_getTriple
|
||||||
|
*
|
||||||
|
* get the coordinate data for a BezTriple.
|
||||||
|
* returns a list of 3 points.
|
||||||
|
* list order is handle1, knot, handle2.
|
||||||
|
* each point consists of a list of x,y,z float values.
|
||||||
|
*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
BezTriple_getTriple (C_BezTriple * self)
|
BezTriple_getTriple (C_BezTriple * self)
|
||||||
{
|
{
|
||||||
@ -200,7 +209,7 @@ BezTriple_setPoints (C_BezTriple * self, PyObject * args)
|
|||||||
if (!PyArg_ParseTuple (args, "O", &popo))
|
if (!PyArg_ParseTuple (args, "O", &popo))
|
||||||
return (EXPP_ReturnPyObjError
|
return (EXPP_ReturnPyObjError
|
||||||
(PyExc_TypeError, "expected tuple argument"));
|
(PyExc_TypeError, "expected tuple argument"));
|
||||||
if (PyTuple_Check (popo) == 0)
|
if (PySequence_Check (popo) == 0)
|
||||||
{
|
{
|
||||||
puts ("error in BezTriple_setPoints");
|
puts ("error in BezTriple_setPoints");
|
||||||
Py_INCREF (Py_None);
|
Py_INCREF (Py_None);
|
||||||
@ -208,7 +217,12 @@ BezTriple_setPoints (C_BezTriple * self, PyObject * args)
|
|||||||
}
|
}
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i));
|
PyObject *o = PySequence_GetItem( popo, i );
|
||||||
|
if( !o )
|
||||||
|
printf("\n bad o. o no!\n");
|
||||||
|
|
||||||
|
/* bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i));*/
|
||||||
|
bezt->vec[1][i] = PyFloat_AsDouble ( o );
|
||||||
bezt->vec[0][i] = bezt->vec[1][i] - 1;
|
bezt->vec[0][i] = bezt->vec[1][i] - 1;
|
||||||
bezt->vec[2][i] = bezt->vec[1][i] + 1;
|
bezt->vec[2][i] = bezt->vec[1][i] + 1;
|
||||||
}
|
}
|
||||||
@ -230,6 +244,10 @@ BezTripleGetAttr (C_BezTriple * self, char *name)
|
|||||||
{
|
{
|
||||||
if (strcmp (name, "pt") == 0)
|
if (strcmp (name, "pt") == 0)
|
||||||
return BezTriple_getPoints (self);
|
return BezTriple_getPoints (self);
|
||||||
|
else if (strcmp (name, "vec") == 0)
|
||||||
|
return BezTriple_getTriple (self);
|
||||||
|
|
||||||
|
/* look for default methods */
|
||||||
return Py_FindMethod (C_BezTriple_methods, (PyObject *) self, name);
|
return Py_FindMethod (C_BezTriple_methods, (PyObject *) self, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +246,15 @@ class IpoCurve:
|
|||||||
@return: the points of the ipo curve.
|
@return: the points of the ipo curve.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def evaluate( time ):
|
||||||
|
"""
|
||||||
|
Compute the value of the IpoCurve at a particular time.
|
||||||
|
@type time: float
|
||||||
|
@param time: value along the X axis
|
||||||
|
@rtype: float
|
||||||
|
@return: the Y value of the curve at the given time
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class BezTriple:
|
class BezTriple:
|
||||||
"""
|
"""
|
||||||
@ -271,3 +280,18 @@ class BezTriple:
|
|||||||
@rtype: PyNone
|
@rtype: PyNone
|
||||||
@return: PyNone
|
@return: PyNone
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def getTriple():
|
||||||
|
"""
|
||||||
|
Returns the x,y,z coordinates for each of the three points that make up a BezierTriple.
|
||||||
|
|
||||||
|
The return list looks like this [ [H1x, H1y, H1z], [Px, Py, Pz], [H2x, H2y, H2z] ] .
|
||||||
|
|
||||||
|
Example::
|
||||||
|
# where bt is of type BezierTriple
|
||||||
|
# and h1, p, and h2 are lists of 3 floats
|
||||||
|
h1, p, h2 = bt.getTriple()
|
||||||
|
|
||||||
|
@rtype: list consisting of 3 lists of 3 floats
|
||||||
|
@return: handle1, knot, handle2
|
||||||
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user