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:
authorCampbell Barton <ideasman42@gmail.com>2007-02-25 15:41:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2007-02-25 15:41:50 +0300
commita05f95f347848932705c1f62e6f70775c3d0c3e8 (patch)
tree1c07979be35cab0ebadf725be5f37411d8035c9c /source/blender/python/api2_2x/NLA.c
parent436e1697fdf07f5a17bcfbdde8b18e89e44e9cf1 (diff)
Image.c
* moved to getseters (use new generic ID funcs) * added 'reflect' attribute Text.c * moved to getseters (new generic ID funcs too) NLA.c * moved to getseters (ditto) Ipo.c * bugfix, allow nested loops on an IPO's curves. Blender.c * removed undocumented function RemoveFakeuser, since actions now have the fakeUser attribute.
Diffstat (limited to 'source/blender/python/api2_2x/NLA.c')
-rw-r--r--source/blender/python/api2_2x/NLA.c175
1 files changed, 91 insertions, 84 deletions
diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c
index 2c0577bd9c2..17ebaa8335e 100644
--- a/source/blender/python/api2_2x/NLA.c
+++ b/source/blender/python/api2_2x/NLA.c
@@ -120,39 +120,9 @@ static PyMethodDef BPy_Action_methods[] = {
/* Python TypeAction callback function prototypes: */
/*****************************************************************************/
static void Action_dealloc( BPy_Action * bone );
-static PyObject *Action_getAttr( BPy_Action * bone, char *name );
-static int Action_setAttr( BPy_Action * bone, char *name, PyObject * v );
static int Action_compare( BPy_Action * a, BPy_Action * b );
static PyObject *Action_repr( BPy_Action * bone );
-
-/*****************************************************************************/
-/* Python TypeAction structure definition: */
-/*****************************************************************************/
-PyTypeObject Action_Type = {
- PyObject_HEAD_INIT( NULL )
- 0, /* ob_size */
- "Blender Action", /* tp_name */
- sizeof( BPy_Action ), /* tp_basicsize */
- 0, /* tp_itemsize */
- /* methods */
- ( destructor ) Action_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- ( getattrfunc ) Action_getAttr, /* tp_getattr */
- ( setattrfunc ) Action_setAttr, /* tp_setattr */
- ( cmpfunc ) Action_compare, /* tp_compare */
- ( reprfunc ) Action_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_as_hash */
- 0, 0, 0, 0, 0, 0,
- 0, /* tp_doc */
- 0, 0, 0, 0, 0, 0,
- BPy_Action_methods, /* tp_methods */
- 0, /* tp_members */
-};
-
/*-------------------------------------------------------------------------*/
static PyObject *M_NLA_NewAction( PyObject * self_unused, PyObject * args )
{
@@ -401,65 +371,11 @@ static void Action_dealloc( BPy_Action * self )
}
/*----------------------------------------------------------------------*/
-static PyObject *Action_getAttr( BPy_Action * self, char *name )
-{
- PyObject *attr = Py_None;
-
- if( strcmp( name, "name" ) == 0 )
- attr = GenericLib_getName( self );
- else if( strcmp( name, "__members__" ) == 0 ) {
- attr = Py_BuildValue( "[s]", "name" );
- }
-
- if( !attr )
- return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
- "couldn't create PyObject" ) );
-
- if( attr != Py_None )
- return attr; /* member attribute found, return it */
-
- /* not an attribute, search the methods table */
- return Py_FindMethod( BPy_Action_methods, ( PyObject * ) self, name );
-}
-
-/*----------------------------------------------------------------------*/
-static int Action_setAttr( BPy_Action * self, char *name, PyObject * value )
-{
- PyObject *valtuple;
- PyObject *error = NULL;
-
- valtuple = Py_BuildValue( "(O)", value ); /* the set* functions expect a tuple */
-
- if( !valtuple )
- return EXPP_ReturnIntError( PyExc_MemoryError,
- "ActionSetAttr: couldn't create tuple" );
-
- if( strcmp( name, "name" ) == 0 )
- error = GenericLib_setName_with_method( self, valtuple );
- else { /* Error */
- Py_DECREF( valtuple );
-
- /* ... member with the given name was found */
- return ( EXPP_ReturnIntError
- ( PyExc_KeyError, "attribute not found" ) );
- }
-
- Py_DECREF( valtuple );
-
- if( error != Py_None )
- return -1;
-
- Py_DECREF( Py_None ); /* was incref'ed by the called Action_set* function */
- return 0; /* normal exit */
-}
-
-/*----------------------------------------------------------------------*/
static int Action_compare( BPy_Action * a, BPy_Action * b )
{
return ( a->action == b->action ) ? 0 : -1;
}
-
/*----------------------------------------------------------------------*/
static PyObject *Action_repr( BPy_Action * self )
{
@@ -504,6 +420,97 @@ struct bAction *Action_FromPyObject( PyObject * py_obj )
}
/*****************************************************************************/
+/* Python attributes get/set structure: */
+/*****************************************************************************/
+static PyGetSetDef BPy_Action_getseters[] = {
+ GENERIC_LIB_GETSETATTR,
+ {NULL,NULL,NULL,NULL,NULL} /* Sentinel */
+};
+
+/*****************************************************************************/
+/* Python TypeAction structure definition: */
+/*****************************************************************************/
+PyTypeObject Action_Type = {
+ PyObject_HEAD_INIT( NULL )
+ 0, /* ob_size */
+ "Blender Action", /* tp_name */
+ sizeof( BPy_Action ), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ ( destructor ) Action_dealloc, /* tp_dealloc */
+ NULL, /* tp_print */
+ NULL, /* tp_getattr */
+ NULL, /* tp_setattr */
+ ( cmpfunc ) Action_compare, /* tp_compare */
+ ( reprfunc ) Action_repr, /* tp_repr */
+ /* Method suites for standard classes */
+
+ NULL, /* PyNumberMethods *tp_as_number; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
+
+ /* More standard operations (here for binary compatibility) */
+
+ NULL, /* hashfunc tp_hash; */
+ NULL, /* ternaryfunc tp_call; */
+ NULL, /* reprfunc tp_str; */
+ NULL, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
+
+ /* Functions to access object as input/output buffer */
+ NULL, /* PyBufferProcs *tp_as_buffer; */
+
+ /*** Flags to define presence of optional/expanded features ***/
+ Py_TPFLAGS_DEFAULT, /* long tp_flags; */
+
+ NULL, /* char *tp_doc; Documentation string */
+ /*** Assigned meaning in release 2.0 ***/
+ /* call function for all accessible objects */
+ NULL, /* traverseproc tp_traverse; */
+
+ /* delete references to contained objects */
+ NULL, /* inquiry tp_clear; */
+
+ /*** Assigned meaning in release 2.1 ***/
+ /*** rich comparisons ***/
+ NULL, /* richcmpfunc tp_richcompare; */
+
+ /*** weak reference enabler ***/
+ 0, /* long tp_weaklistoffset; */
+
+ /*** Added in release 2.2 ***/
+ /* Iterators */
+ NULL, /* getiterfunc tp_iter; */
+ NULL, /* iternextfunc tp_iternext; */
+
+ /*** Attribute descriptor and subclassing stuff ***/
+ BPy_Action_methods, /* struct PyMethodDef *tp_methods; */
+ NULL, /* struct PyMemberDef *tp_members; */
+ BPy_Action_getseters, /* struct PyGetSetDef *tp_getset; */
+ NULL, /* struct _typeobject *tp_base; */
+ NULL, /* PyObject *tp_dict; */
+ NULL, /* descrgetfunc tp_descr_get; */
+ NULL, /* descrsetfunc tp_descr_set; */
+ 0, /* long tp_dictoffset; */
+ NULL, /* initproc tp_init; */
+ NULL, /* allocfunc tp_alloc; */
+ NULL, /* newfunc tp_new; */
+ /* Low-level free-memory routine */
+ NULL, /* freefunc tp_free; */
+ /* For PyObject_IS_GC */
+ NULL, /* inquiry tp_is_gc; */
+ NULL, /* PyObject *tp_bases; */
+ /* method resolution order */
+ NULL, /* PyObject *tp_mro; */
+ NULL, /* PyObject *tp_cache; */
+ NULL, /* PyObject *tp_subclasses; */
+ NULL, /* PyObject *tp_weaklist; */
+ NULL
+};
+
+
+
+/*****************************************************************************/
/* ActionStrip wrapper */
/*****************************************************************************/