diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-02-23 17:51:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-02-23 17:51:20 +0300 |
commit | 086d51c822774ec68e95d9ab68679fb219ad8a12 (patch) | |
tree | 49591a038e005b8aaa7263668929d645dbfc8ca1 /source/blender/python/api2_2x/Ipo.c | |
parent | 260af5f3c1590900353cce62657536bc96d3f53b (diff) |
BPython API
* Added data.lib attributes to almost all data types, (except for Text3d and NLA)
This is None or the path of the library as a string.
* Main was giving a warning, Include Curve.h rather then CurNurb.h
* Added Library.LinkedLibs(), returns a list of externaly linked libs.
Diffstat (limited to 'source/blender/python/api2_2x/Ipo.c')
-rw-r--r-- | source/blender/python/api2_2x/Ipo.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c index 6a36079371b..e546a1932da 100644 --- a/source/blender/python/api2_2x/Ipo.c +++ b/source/blender/python/api2_2x/Ipo.c @@ -101,6 +101,8 @@ static PyObject *Ipo_getRctf( BPy_Ipo * self ); static PyObject *Ipo_oldsetRctf( BPy_Ipo * self, PyObject * args ); static int Ipo_setRctf( BPy_Ipo * self, PyObject * args ); +static PyObject *Ipo_getLib( BPy_Ipo * self ); +static PyObject *Ipo_getUsers( BPy_Ipo * self ); static PyObject *Ipo_getCurve( BPy_Ipo * self, PyObject * args ); static PyObject *Ipo_getCurves( BPy_Ipo * self ); static PyObject *Ipo_getCurveNames( BPy_Ipo * self ); @@ -119,6 +121,9 @@ static PyObject *Ipo_getCurveBeztriple( BPy_Ipo * self, PyObject * args ); static PyObject *Ipo_getChannel( BPy_Ipo * self ); static int Ipo_setChannel( BPy_Ipo * self, PyObject * args ); +static PyObject *Ipo_getFakeUser( BPy_Ipo * self ); +static int Ipo_setFakeUser( BPy_Ipo * self, PyObject * value ); + static int Ipo_length( BPy_Ipo * inst ); static PyObject *Ipo_getIpoCurveByName( BPy_Ipo * self, PyObject * key ); static int Ipo_setIpoCurveByName( BPy_Ipo * self, PyObject * key, @@ -177,6 +182,18 @@ static PyGetSetDef BPy_Ipo_getseters[] = { (getter)Ipo_getName, (setter)Ipo_setName, "Ipo data name", NULL}, + {"lib", + (getter)Ipo_getLib, (setter)NULL, + "Ipos linked library", + NULL}, + {"users", + (getter)Ipo_getUsers, (setter)NULL, + "Number of Ipo users", + NULL}, + {"fakeUser", + (getter)Ipo_getFakeUser, (setter)Ipo_setFakeUser, + "Ipos fake user state", + NULL}, {"curves", (getter)Ipo_getCurves, (setter)NULL, "Ipo curves", @@ -227,7 +244,7 @@ static PySequenceMethods Ipo_as_sequence = { /* Python Ipo_Type callback function prototypes: */ /*****************************************************************************/ static void Ipo_dealloc( BPy_Ipo * self ); -//static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags); +/*static int IpoPrint (BPy_Ipo *self, FILE *fp, int flags);*/ static int Ipo_compare( BPy_Ipo * a, BPy_Ipo * b ); static PyObject *Ipo_repr( BPy_Ipo * self ); static PyObject *Ipo_getIter( BPy_Ipo * self ); @@ -830,6 +847,33 @@ static int Ipo_setName( BPy_Ipo * self, PyObject * args ) return 0; } + +static PyObject *Ipo_getLib( BPy_Ipo * self ) +{ + return EXPP_GetIdLib((ID *)self->ipo); + +} + +static PyObject *Ipo_getUsers( BPy_Ipo * self ) +{ + return PyInt_FromLong( self->ipo->id.us ); +} + +static PyObject *Ipo_getFakeUser( BPy_Ipo * self ) +{ + if (self->ipo->id.flag & LIB_FAKEUSER) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +static int Ipo_setFakeUser( BPy_Ipo * self, PyObject * value ) +{ + return SetIdFakeUser(&self->ipo->id, value); +} + + + static PyObject *Ipo_getBlocktype( BPy_Ipo * self ) { PyObject *attr = PyInt_FromLong( self->ipo->blocktype ); @@ -1631,7 +1675,7 @@ static PyObject *Ipo_nextIter( BPy_Ipo * self ) /*****************************************************************************/ PyObject *Ipo_Init( void ) { - // PyObject *submodule; + /* PyObject *submodule; */ if( PyType_Ready( &Ipo_Type ) < 0 ) return NULL; @@ -1822,7 +1866,7 @@ static PyObject *Ipo_getCurvecurval( BPy_Ipo * self, PyObject * args ) return ( EXPP_ReturnPyObjError ( PyExc_TypeError, "No IPO curve" ) ); - if( PyNumber_Check( PyTuple_GetItem( args, 0 ) ) ) // args is an integer + if( PyNumber_Check( PyTuple_GetItem( args, 0 ) ) ) /* args is an integer */ { if( !PyArg_ParseTuple( args, "i", &numcurve ) ) return ( EXPP_ReturnPyObjError @@ -1837,7 +1881,7 @@ static PyObject *Ipo_getCurvecurval( BPy_Ipo * self, PyObject * args ) } } - else // args is a string + else /* args is a string */ { if( !PyArg_ParseTuple( args, "s", &stringname ) ) return ( EXPP_ReturnPyObjError |