diff options
Diffstat (limited to 'source/blender/python/api2_2x/Object.c')
-rw-r--r-- | source/blender/python/api2_2x/Object.c | 255 |
1 files changed, 171 insertions, 84 deletions
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 45cce46d389..1282b9bd82c 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -81,6 +81,7 @@ struct rctf; #include "BIF_editarmature.h" #include "BIF_editaction.h" #include "BIF_editnla.h" +#include "BIF_keyframing.h" #include "BLI_arithb.h" #include "BLI_blenlib.h" @@ -204,6 +205,7 @@ enum obj_consts { EXPP_OBJ_ATTR_SB_INSPRING, EXPP_OBJ_ATTR_SB_INFRICT, + EXPP_OBJ_ATTR_EMPTY_DRAWTYPE }; #define EXPP_OBJECT_DRAWSIZEMIN 0.01f @@ -297,26 +299,25 @@ static PyObject *internal_makeParent(Object *parent, PyObject *py_child, int par /* In Python these will be written to the console when doing a */ /* Blender.Object.__doc__ */ /*****************************************************************************/ -char M_Object_doc[] = "The Blender Object module\n\n\ +static char M_Object_doc[] = "The Blender Object module\n\n\ This module provides access to **Object Data** in Blender.\n"; -char M_Object_New_doc[] = +static char M_Object_New_doc[] = "(type) - Add a new object of type 'type' in the current scene"; -char M_Object_Get_doc[] = +static char M_Object_Get_doc[] = "(name) - return the object with the name 'name', returns None if not\ found.\n\ If 'name' is not specified, it returns a list of all objects in the\n\ current scene."; -char M_Object_GetSelected_doc[] = +static char M_Object_GetSelected_doc[] = "() - Returns a list of selected Objects in the active layer(s)\n\ The active object is the first in the list, if visible"; -char M_Object_Duplicate_doc[] = +static char M_Object_Duplicate_doc[] = "(linked) - Duplicate all selected, visible objects in the current scene"; - /*****************************************************************************/ /* Python method structure definition for Blender.Object module: */ /*****************************************************************************/ @@ -340,9 +341,8 @@ static int setupSB(Object* ob); /*Make sure Softbody Pointer is initialized */ static int setupPI(Object* ob); static PyObject *Object_getParticleSys( BPy_Object * self ); -/* fixme Object_newParticleSys( self, default-partsys-name ) */ static PyObject *Object_addVertexGroupsFromArmature( BPy_Object * self, PyObject * args); -static PyObject *Object_newParticleSys( BPy_Object * self ); +static PyObject *Object_newParticleSys( BPy_Object * self, PyObject * args ); static PyObject *Object_buildParts( BPy_Object * self ); static PyObject *Object_clearIpo( BPy_Object * self ); static PyObject *Object_clrParent( BPy_Object * self, PyObject * args ); @@ -476,7 +476,7 @@ static PyMethodDef BPy_Object_methods[] = { /* name, method, flags, doc */ {"getParticleSystems", ( PyCFunction ) Object_getParticleSys, METH_NOARGS, "Return a list of particle systems"}, - {"newParticleSystem", ( PyCFunction ) Object_newParticleSys, METH_NOARGS, + {"newParticleSystem", ( PyCFunction ) Object_newParticleSys, METH_VARARGS, "Create and link a new particle system"}, {"addVertexGroupsFromArmature" , ( PyCFunction ) Object_addVertexGroupsFromArmature, METH_VARARGS, "Add vertex groups from armature using the bone heat method"}, @@ -1036,48 +1036,53 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused, Py_RETURN_NONE; } - /*****************************************************************************/ /* Python BPy_Object methods: */ /*****************************************************************************/ PyObject *Object_getParticleSys( BPy_Object * self ){ - ParticleSystem *blparticlesys = 0; + PyObject *list; + ParticleSystem *psys= NULL; Object *ob = self->object; - PyObject *partsyslist,*current; - - blparticlesys = ob->particlesystem.first; + int i= 0; - partsyslist = PyList_New( 0 ); - - if (!blparticlesys) - return partsyslist; - -/* fixme: for(;;) */ - current = ParticleSys_CreatePyObject( blparticlesys, ob ); - PyList_Append(partsyslist,current); - Py_DECREF(current); + list = PyList_New( BLI_countlist( &ob->particlesystem ) ); + if( !list ) + return EXPP_ReturnPyObjError( PyExc_MemoryError, + "PyList_New() failed" ); - while((blparticlesys = blparticlesys->next)){ - current = ParticleSys_CreatePyObject( blparticlesys, ob ); - PyList_Append(partsyslist,current); - Py_DECREF(current); - } + for( psys=ob->particlesystem.first; psys; psys=psys->next ) + PyList_SET_ITEM( list, i++, ParticleSys_CreatePyObject( psys, ob ) ); - return partsyslist; + return list; } -PyObject *Object_newParticleSys( BPy_Object * self ){ +PyObject *Object_newParticleSys( BPy_Object * self, PyObject * args ) { ParticleSystem *psys = 0; ParticleSystem *rpsys = 0; ModifierData *md; ParticleSystemModifierData *psmd; Object *ob = self->object; -/* char *name = NULL; optional name param */ + char *name = NULL; ID *id; - int nr; + int nr; + + if( !PyArg_ParseTuple( args, "|s", &name ) ) + return EXPP_ReturnPyObjError( PyExc_TypeError, + "expected a string or nothing" ); - id = (ID *)psys_new_settings("PSys", G.main); + if( name ) { + for( id= G.main->particle.first; id; id= id->next ) { + if( !strcmp( name, id->name + 2 ) ) + break; + } + if( !id ) + return EXPP_ReturnPyObjError( PyExc_AttributeError, + "specified particle system not found" ); + else + id->us++; + } else + id = (ID *)psys_new_settings("PSys", G.main); psys = MEM_callocN(sizeof(ParticleSystem), "particle_system"); psys->pointcache = BKE_ptcache_add(); @@ -1696,11 +1701,9 @@ static PyObject *Object_getBoundBox( BPy_Object * self, PyObject *args ) "This object isn't linked to any object data (mesh, curve, etc) yet" ); if( !self->object->bb ) { /* if no ob bbox, we look in obdata */ - Mesh *me; Curve *curve; switch ( self->object->type ) { case OB_MESH: - me = self->object->data; vec = (float*) mesh_get_bb(self->object)->vec; break; case OB_CURVE: @@ -2431,6 +2434,12 @@ static int Object_setDrawType( BPy_Object * self, PyObject * value ) OB_BOUNDBOX, OB_TEXTURE, 'b' ); } +static int Object_setEmptyShape( BPy_Object * self, PyObject * value ) +{ + return EXPP_setIValueRange( value, &self->object->empty_drawtype, + OB_ARROWS, OB_EMPTY_CONE, 'b' ); +} + static int Object_setEuler( BPy_Object * self, PyObject * args ) { float rot1, rot2, rot3; @@ -2560,7 +2569,7 @@ static int Object_setMatrix( BPy_Object * self, MatrixObject * mat ) static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; - int key = 0; + int key = 0, flag = 0; char *actname= NULL; if( !PyArg_ParseTuple( args, "i", &key ) ) @@ -2570,35 +2579,39 @@ static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args ) if(ob->ipoflag & OB_ACTION_OB) actname= "Object"; + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + if (key == IPOKEY_LOC || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, flag); } if (key == IPOKEY_ROT || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, flag); } if (key == IPOKEY_SIZE || key == IPOKEY_LOCROTSIZE ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, 0); - insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, flag); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, flag); } if (key == IPOKEY_LAYER ){ - insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, 0); + insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, flag); } if (key == IPOKEY_PI_STRENGTH ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, flag); } else if (key == IPOKEY_PI_FALLOFF ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, flag); } else if (key == IPOKEY_PI_SURFACEDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, flag); } else if (key == IPOKEY_PI_RANDOMDAMP ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, flag); } else if (key == IPOKEY_PI_PERM ){ - insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, 0); + insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, flag); } allspace(REMAKEIPO, 0); @@ -2622,6 +2635,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) BPy_Action *sourceact; char *chanName; int actframe; + int flag=0; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2640,17 +2654,21 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) /* XXX: must check chanName actually exists, otherwise segfaults! */ //achan = get_action_channel(sourceact->action, chanName); - - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; @@ -2672,6 +2690,7 @@ static PyObject *Object_insertPoseKey( BPy_Object * self, PyObject * args ) static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args ) { Object *ob= self->object; + int flag = 0; char *chanName; /* for doing the time trick, similar to editaction bake_action_with_client() */ @@ -2687,16 +2706,20 @@ static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args /* XXX: must check chanName actually exists, otherwise segfaults! */ - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0); - insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0); + /* flag should be initialised with the 'autokeying' flags like for normal keying */ + if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; + if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; + + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag); + insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag); G.scene->r.cfra = oldframe; @@ -2727,7 +2750,7 @@ static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self, "expects bonename, constraintname, influenceval" ); icu = verify_ipocurve((ID *)self->object, ID_CO, boneName, constName, NULL, - CO_ENFORCE); + CO_ENFORCE, 1); if (!icu) return EXPP_ReturnPyObjError( PyExc_RuntimeError, @@ -2980,7 +3003,7 @@ static PyObject *Object_getProperty( BPy_Object * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a string" ); - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) return Property_CreatePyObject( prop ); @@ -2996,7 +3019,7 @@ static PyObject *Object_addProperty( BPy_Object * self, PyObject * args ) char *prop_type = NULL; short type = -1; BPy_Property *py_prop = NULL; - int argslen = PyObject_Length( args ); + int argslen = PyTuple_Size( args ); if( argslen == 3 || argslen == 2 ) { if( !PyArg_ParseTuple( args, "sO|s", &prop_name, &prop_data, @@ -3107,7 +3130,7 @@ static PyObject *Object_removeProperty( BPy_Object * self, PyObject * args ) py_prop->property = NULL; } } else { - prop = get_property( self->object, prop_name ); + prop = get_ob_property( self->object, prop_name ); if( prop ) { BLI_remlink( &self->object->prop, prop ); free_property( prop ); @@ -3126,18 +3149,22 @@ static PyObject *Object_copyAllPropertiesTo( BPy_Object * self, PyObject * args ) { PyObject *dest; + Object *dest_ob; bProperty *prop = NULL; - bProperty *propn = NULL; if( !PyArg_ParseTuple( args, "O!", &Object_Type, &dest ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected an Object" ); - + + if (dest == (PyObject *)self) { + Py_RETURN_NONE; + } + dest_ob = ( ( BPy_Object * ) dest )->object; + /*make a copy of all its properties*/ prop = self->object->prop.first; while( prop ) { - propn = copy_property( prop ); - BLI_addtail( &( ( BPy_Object * ) dest )->object->prop, propn ); + set_ob_property( dest_ob, prop ); prop = prop->next; } @@ -3297,6 +3324,33 @@ static PyObject *Object_insertShapeKey(BPy_Object * self) Py_RETURN_NONE; } +static PyObject *Object_getColor( BPy_Object *self, void *type ) +{ + return Py_BuildValue( "(ffff)", self->object->col[0], self->object->col[1], self->object->col[2], self->object->col[3] ); +} + +static int Object_setColor( BPy_Object *self, PyObject *value ) +{ + int i; + float color[4]; + struct Object *object = self->object; + + value = PySequence_Tuple( value ); + + if( !value || !PyArg_ParseTuple( value, "ffff", &color[0], &color[1], &color[2], &color[3] ) ) { + Py_XDECREF( value ); + return EXPP_ReturnIntError( PyExc_TypeError, + "expected a list or tuple of 3 floats" ); + } + + Py_DECREF( value ); + + for( i = 0; i < 4; ++i ) { + object->col[i] = MAX2(MIN2(color[i], 1.0), 0); + } + return 0; +} + /* __copy__() */ static PyObject *Object_copy(BPy_Object * self) { @@ -3511,8 +3565,8 @@ static int Object_setRBMass( BPy_Object * self, PyObject * args ) /* this is too low level, possible to add helper methods */ -#define GAMEFLAG_MASK ( OB_DYNAMIC | OB_CHILD | OB_ACTOR | OB_DO_FH | \ - OB_ROT_FH | OB_ANISOTROPIC_FRICTION | OB_GHOST | OB_RIGID_BODY | \ +#define GAMEFLAG_MASK ( OB_COLLISION | OB_DYNAMIC | OB_CHILD | OB_ACTOR | OB_DO_FH | \ + OB_ROT_FH | OB_ANISOTROPIC_FRICTION | OB_GHOST | OB_RIGID_BODY | OB_SOFT_BODY | \ OB_BOUNDS | OB_COLLISION_RESPONSE | OB_SECTOR | OB_PROP | \ OB_MAINACTOR ) @@ -3758,6 +3812,9 @@ static PyObject *getIntAttr( BPy_Object *self, void *type ) case EXPP_OBJ_ATTR_DRAWTYPE: param = object->dt; break; + case EXPP_OBJ_ATTR_EMPTY_DRAWTYPE: + param = object->empty_drawtype; + break; case EXPP_OBJ_ATTR_PARENT_TYPE: param = object->partype; break; @@ -4938,6 +4995,10 @@ static PyGetSetDef BPy_Object_getseters[] = { (getter)getIntAttr, (setter)Object_setDrawType, "The object's drawing type", (void *)EXPP_OBJ_ATTR_DRAWTYPE}, + {"emptyShape", + (getter)getIntAttr, (setter)Object_setEmptyShape, + "The empty's drawing shape", + (void *)EXPP_OBJ_ATTR_EMPTY_DRAWTYPE}, {"parentType", (getter)getIntAttr, (setter)NULL, "The object's parent type", @@ -5174,7 +5235,10 @@ static PyGetSetDef BPy_Object_getseters[] = { (getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits, "Transparent materials for the active object (mesh only) enabled", (void *)OB_DRAWTRANSP}, - + {"color", + (getter)Object_getColor, (setter)Object_setColor, + "Object color used by the game engine and optionally for materials", + NULL}, {"enableNLAOverride", (getter)Object_getNLAflagBits, (setter)Object_setNLAflagBits, "Toggles Action-NLA based animation", @@ -5482,6 +5546,7 @@ static PyObject *M_Object_RBFlagsDict( void ) if( M ) { BPy_constant *d = ( BPy_constant * ) M; + PyConstant_Insert( d, "COLLISION", PyInt_FromLong( OB_COLLISION ) ); PyConstant_Insert( d, "DYNAMIC", PyInt_FromLong( OB_DYNAMIC ) ); PyConstant_Insert( d, "CHILD", PyInt_FromLong( OB_CHILD ) ); PyConstant_Insert( d, "ACTOR", PyInt_FromLong( OB_ACTOR ) ); @@ -5491,6 +5556,7 @@ static PyObject *M_Object_RBFlagsDict( void ) PyInt_FromLong( OB_ANISOTROPIC_FRICTION ) ); PyConstant_Insert( d, "GHOST", PyInt_FromLong( OB_GHOST ) ); PyConstant_Insert( d, "RIGIDBODY", PyInt_FromLong( OB_RIGID_BODY ) ); + PyConstant_Insert( d, "SOFTBODY", PyInt_FromLong( OB_SOFT_BODY ) ); PyConstant_Insert( d, "BOUNDS", PyInt_FromLong( OB_BOUNDS ) ); PyConstant_Insert( d, "COLLISION_RESPONSE", PyInt_FromLong( OB_COLLISION_RESPONSE ) ); @@ -5538,6 +5604,24 @@ static PyObject *M_Object_IpoKeyTypesDict( void ) return M; } +static PyObject *M_Object_EmptyShapesDict( void ) +{ + PyObject *M = PyConstant_New( ); + + if( M ) { + BPy_constant *d = ( BPy_constant * ) M; + PyConstant_Insert( d, "ARROWS", PyInt_FromLong( OB_ARROWS ) ); + PyConstant_Insert( d, "AXES", PyInt_FromLong( OB_PLAINAXES ) ); + PyConstant_Insert( d, "CIRCLE", PyInt_FromLong( OB_CIRCLE ) ); + PyConstant_Insert( d, "ARROW", PyInt_FromLong( OB_SINGLE_ARROW ) ); + PyConstant_Insert( d, "CUBE", PyInt_FromLong( OB_CUBE ) ); + PyConstant_Insert( d, "SPHERE", PyInt_FromLong( OB_EMPTY_SPHERE ) ); + PyConstant_Insert( d, "CONE", PyInt_FromLong( OB_EMPTY_CONE ) ); + } + return M; +} + + /*****************************************************************************/ /* Function: initObject */ /*****************************************************************************/ @@ -5552,6 +5636,7 @@ PyObject *Object_Init( void ) PyObject *RBFlagsDict = M_Object_RBFlagsDict( ); PyObject *RBShapesDict = M_Object_RBShapeBoundDict( ); PyObject *IpoKeyTypesDict = M_Object_IpoKeyTypesDict( ); + PyObject *EmptyShapesDict = M_Object_EmptyShapesDict( ); PyType_Ready( &Object_Type ) ; @@ -5596,7 +5681,9 @@ PyObject *Object_Init( void ) if( RBShapesDict ) PyModule_AddObject( module, "RBShapes", RBShapesDict ); if( IpoKeyTypesDict ) - PyModule_AddObject( module, "IpoKeyTypes", IpoKeyTypesDict ); + PyModule_AddObject( module, "IpoKeyTypes", IpoKeyTypesDict ); + if( EmptyShapesDict ) + PyModule_AddObject( module, "EmptyShapes", EmptyShapesDict ); /*Add SUBMODULES to the module*/ dict = PyModule_GetDict( module ); /*borrowed*/ |