Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Swaney <sswaney@centurytel.net>2004-04-07 01:13:12 +0400
committerStephen Swaney <sswaney@centurytel.net>2004-04-07 01:13:12 +0400
commitc1e33eb1e7dd0071bd4fd0c9e94e2938b6af2978 (patch)
tree5b733f3df38ccfefa35dea8d1c3f38ccc1a3926f /source/blender/python/api2_2x/BezTriple.c
parentd2f95ea72ec1824ef06986c5adaca7c0abc36a48 (diff)
fix for bug 1110.
Updated epydoc. Function name is BezTriple.getTriple(). Set prototype to NOARGS in source.
Diffstat (limited to 'source/blender/python/api2_2x/BezTriple.c')
-rw-r--r--source/blender/python/api2_2x/BezTriple.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/BezTriple.c b/source/blender/python/api2_2x/BezTriple.c
index 94911cac1e7..0533bb8c584 100644
--- a/source/blender/python/api2_2x/BezTriple.c
+++ b/source/blender/python/api2_2x/BezTriple.c
@@ -85,8 +85,8 @@ static PyMethodDef C_BezTriple_methods[] = {
"(str) - Change BezTriple point coordinates"},
{"getPoints", (PyCFunction) BezTriple_getPoints, METH_NOARGS,
"() - return BezTriple knot point x and y coordinates"},
- {"getTriple", (PyCFunction) BezTriple_getTriple, METH_VARARGS,
- "() - return list of floating point triplets. order is H1, knot, H2"},
+ {"getTriple", (PyCFunction) BezTriple_getTriple, METH_NOARGS,
+ "() - return list of 3 floating point triplets. order is H1, knot, H2"},
{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 *
BezTriple_getTriple (C_BezTriple * self)
{
@@ -200,7 +209,7 @@ BezTriple_setPoints (C_BezTriple * self, PyObject * args)
if (!PyArg_ParseTuple (args, "O", &popo))
return (EXPP_ReturnPyObjError
(PyExc_TypeError, "expected tuple argument"));
- if (PyTuple_Check (popo) == 0)
+ if (PySequence_Check (popo) == 0)
{
puts ("error in BezTriple_setPoints");
Py_INCREF (Py_None);
@@ -208,7 +217,12 @@ BezTriple_setPoints (C_BezTriple * self, PyObject * args)
}
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[2][i] = bezt->vec[1][i] + 1;
}
@@ -230,6 +244,10 @@ BezTripleGetAttr (C_BezTriple * self, char *name)
{
if (strcmp (name, "pt") == 0)
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);
}