Writing breve-Complient Python Objects
There are a couple of requirements when creating Python objects which can be added to the breve engine.
All Python files to be loaded into breve should import the breve module to gain access to important breve engine functionality. In order for a Python object to be compatible with the breve engine, it must be a subclass of the breve Python module class breve.object. If an object is not a subclass of breve.object, it will not be visible to the breve engine. The __init__ method of the class must execute the breve.object.__init__ method before any breve bridge functionality is used.
The following example illustrates a basic Python file with a simple breve-compatible class defined:
import breve
class PythonBridgeObject( breve.Object ):
def __init__( self ):
breve.Object.__init__( self )
print "Inited Python bridge object"
def iterate( self ):
print "Iterating Python bridge object"
This simple Python object will be visible to the breve engine and will have its iterate method called at each iteration of the breve engine.
