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:
authorWillian Padovani Germano <wpgermano@gmail.com>2005-09-09 05:31:10 +0400
committerWillian Padovani Germano <wpgermano@gmail.com>2005-09-09 05:31:10 +0400
commit039a8c95f3a9536b7e919fc5a55ddf864dd78d1c (patch)
tree8e182dcc31b9774c756901510ad3c8e66fd54edc /source/blender/python/api2_2x/Curve.c
parent34ae14778c183762069c2596705ae3ad88c0119f (diff)
BPython:
- Pontus Lidman contributed a new module: Blender.Key + access to key objects from NMesh, Lattice and Curve + docs (thanks and sorry for taking so long to check/commit the patch!) - Allowing EVENT spacehandlers to call the file selector (scriptlinks in general are not allowed, but this special case should be able to). Requested by Paolo Colombo (thanks!) - tiny doc update (Ken Hughes pointed an error in the space handlers example) I didn't have time to update the Key module to follow the current bpython design, will do that later and also test it better than I did.
Diffstat (limited to 'source/blender/python/api2_2x/Curve.c')
-rw-r--r--source/blender/python/api2_2x/Curve.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c
index e457a2c6b2e..2cd89b9db4e 100644
--- a/source/blender/python/api2_2x/Curve.c
+++ b/source/blender/python/api2_2x/Curve.c
@@ -40,6 +40,7 @@
#include "CurNurb.h"
#include "Material.h"
#include "Object.h"
+#include "Key.h"
#include "gen_utils.h"
@@ -100,6 +101,7 @@ static PyObject *Curve_setRot( BPy_Curve * self, PyObject * args );
static PyObject *Curve_getSize( BPy_Curve * self );
static PyObject *Curve_setSize( BPy_Curve * self, PyObject * args );
static PyObject *Curve_getNumCurves( BPy_Curve * self );
+static PyObject *Curve_getKey( BPy_Curve * self );
static PyObject *Curve_isNurb( BPy_Curve * self, PyObject * args );
static PyObject *Curve_isCyclic( BPy_Curve * self, PyObject * args);
static PyObject *Curve_getNumPoints( BPy_Curve * self, PyObject * args );
@@ -199,6 +201,8 @@ Sets a control point "},
METH_VARARGS, "(3-tuple) - Sets curve size"},
{"getNumCurves", ( PyCFunction ) Curve_getNumCurves,
METH_NOARGS, "() - Gets number of curves in Curve"},
+ {"getKey", ( PyCFunction ) Curve_getKey,
+ METH_NOARGS, "() - Gets curve key"},
{"isNurb", ( PyCFunction ) Curve_isNurb,
METH_VARARGS,
"(nothing or integer) - returns 1 if curve is type Nurb, O otherwise."},
@@ -995,6 +999,20 @@ static PyObject *Curve_getNumCurves( BPy_Curve * self )
"couldn't get number of curves" ) );
}
+/*
+ * get the key object linked to this curve
+ */
+
+static PyObject *Curve_getKey( BPy_Curve * self )
+{
+ PyObject *keyObj;
+
+ if (self->curve->key)
+ keyObj = Key_CreatePyObject(self->curve->key);
+ else keyObj = EXPP_incr_ret(Py_None);
+
+ return keyObj;
+}
/*
* count the number of points in a given spline
@@ -1443,34 +1461,36 @@ static PyObject *CurveGetAttr( BPy_Curve * self, char *name )
if( strcmp( name, "name" ) == 0 )
attr = PyString_FromString( self->curve->id.name + 2 );
- if( strcmp( name, "pathlen" ) == 0 )
+ else if( strcmp( name, "pathlen" ) == 0 )
attr = PyInt_FromLong( self->curve->pathlen );
- if( strcmp( name, "totcol" ) == 0 )
+ else if( strcmp( name, "totcol" ) == 0 )
attr = PyInt_FromLong( self->curve->totcol );
- if( strcmp( name, "flag" ) == 0 )
+ else if( strcmp( name, "flag" ) == 0 )
attr = PyInt_FromLong( self->curve->flag );
- if( strcmp( name, "bevresol" ) == 0 )
+ else if( strcmp( name, "bevresol" ) == 0 )
attr = PyInt_FromLong( self->curve->bevresol );
- if( strcmp( name, "resolu" ) == 0 )
+ else if( strcmp( name, "resolu" ) == 0 )
attr = PyInt_FromLong( self->curve->resolu );
- if( strcmp( name, "resolv" ) == 0 )
+ else if( strcmp( name, "resolv" ) == 0 )
attr = PyInt_FromLong( self->curve->resolv );
- if( strcmp( name, "width" ) == 0 )
+ else if( strcmp( name, "width" ) == 0 )
attr = PyFloat_FromDouble( self->curve->width );
- if( strcmp( name, "ext1" ) == 0 )
+ else if( strcmp( name, "ext1" ) == 0 )
attr = PyFloat_FromDouble( self->curve->ext1 );
- if( strcmp( name, "ext2" ) == 0 )
+ else if( strcmp( name, "ext2" ) == 0 )
attr = PyFloat_FromDouble( self->curve->ext2 );
- if( strcmp( name, "loc" ) == 0 )
+ else if( strcmp( name, "loc" ) == 0 )
return Curve_getLoc( self );
- if( strcmp( name, "rot" ) == 0 )
+ else if( strcmp( name, "rot" ) == 0 )
return Curve_getRot( self );
- if( strcmp( name, "size" ) == 0 )
+ else if( strcmp( name, "size" ) == 0 )
return Curve_getSize( self );
- if( strcmp( name, "bevob" ) == 0 )
+ else if( strcmp( name, "bevob" ) == 0 )
return Curve_getBevOb( self );
+ else if( strcmp( name, "key" ) == 0 )
+ return Curve_getKey( self );
#if 0
- if( strcmp( name, "numpts" ) == 0 )
+ else if( strcmp( name, "numpts" ) == 0 )
return Curve_getNumPoints( self );
#endif