[Bf-python] 3 functions needed in each module

Michel Selten michel.s at home.nl
Sat May 17 15:49:55 CEST 2003


Hi,

For the Object module to work with other modules, I need 3 functions
from each other module. I will use the Object functions as a reference.

1) ObjectCreatePyObject
   This function creates a PyObject from a given Blender Object 
   structure. For the Lamp module, this function would look like:
   PyObject* LampCreatePyObject (struct Lamp *lamp)

2) ObjectCheckPyObject
   This function checks if a given PyObject is a Blender Object.

   The object_type thing is the PyTypeObject declared in Object.h. For
   each module there's a similar struct.

   For the Curve module, this function would look like:
   int CurveCheckPyObject (PyObject *py_obj)

3) ObjectFromPyObject
   This function returns from a given PyObject the actual Blender
   Object. No type checking is needed. The pre-condition for this
   function is that the given PyObject is indeed of the correct type.

   For the Armature module, this function would look like:
   struct bArmature* ArmatureFromPyObject (PyObject *py_obj)

If you do a cvs update, you can see the implementation for each of the
above functions in Object.c. Suggestions for improvement are always
welcome :)

With regards,
	Michel





More information about the Bf-python mailing list