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>2005-01-13 06:42:53 +0300
committerStephen Swaney <sswaney@centurytel.net>2005-01-13 06:42:53 +0300
commitdf1acca4c5bdc47d62bee1369e28c378cf68fcc6 (patch)
treeb0566f38f62dc0e20c9c2a90446904446cd99c84 /source/blender/python/api2_2x/CurNurb.c
parent9f43accdb2319b567551f652a6966a5fa56f086b (diff)
New methods: Curve.isCyclic(), CurNurb.isCyclic() for checking if curve is cyclic ( closed ). Both methods are boolean.
Patch contributed by Toni Alatalo. Thanks.
Diffstat (limited to 'source/blender/python/api2_2x/CurNurb.c')
-rw-r--r--source/blender/python/api2_2x/CurNurb.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c
index e04204be07f..6128519c5b4 100644
--- a/source/blender/python/api2_2x/CurNurb.c
+++ b/source/blender/python/api2_2x/CurNurb.c
@@ -63,6 +63,7 @@ static PyObject *CurNurb_iterNext( BPy_CurNurb * self );
PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * args );
PyObject *CurNurb_pointAtIndex( Nurb * nurb, int index );
static PyObject *CurNurb_isNurb( BPy_CurNurb * self );
+static PyObject *CurNurb_isCyclic( BPy_CurNurb * self );
char M_CurNurb_doc[] = "CurNurb";
@@ -426,6 +427,23 @@ static PyObject *CurNurb_isNurb( BPy_CurNurb * self )
}
}
+/*
+ * CurNurb_isCyclic()
+ * test whether spline cyclic (closed) or not (open)
+ */
+
+static PyObject *CurNurb_isCyclic( BPy_CurNurb * self )
+{
+ /* supposing that the flagu is always set */
+
+ if( self->nurb->flagu & CU_CYCLIC ) {
+ Py_INCREF( Py_True );
+ return Py_True;
+ } else {
+ Py_INCREF( Py_False );
+ return ( Py_False );
+ }
+}
/*
table of module methods
@@ -463,6 +481,8 @@ static PyMethodDef BPy_CurNurb_methods[] = {
"( point ) - add a new point. arg is BezTriple or list of x,y,z,w floats"},
{"isNurb", ( PyCFunction ) CurNurb_isNurb, METH_NOARGS,
"( ) - boolean function tests if this spline is type nurb or bezier"},
+ {"isCyclic", ( PyCFunction ) CurNurb_isCyclic, METH_NOARGS,
+ "( ) - boolean function tests if this spline is cyclic (closed) or not (open)"},
{NULL, NULL, 0, NULL}
};