Home - Forums - Documentation - Gallery - Bugs

Contents

Introduction

There are a number of interfaces in cs and cel which can serve as callbacks to discover things happening in engine. To be able use this functionality, one must inherit from special base classes for python.

There are two modules in csexternal repository that provide such classes, one for cs and one for cel: cscallback and celcallback.

In general for a given interface, there is a base class, with the naming convention of prefixing with py instead of i as is normal for interfaces.

Example

For example, in iMovableListener this would be pyMovableListener. And to use it just declare your class inheriting from this, and implement the needed functions in interface from python:

from cscallback import pyMovableListener

class MyMovableListener(pyMovableListener):
    # constructor
    def __init__(self):
        pyMovableListener.__init__(self,ObjectRegistry)
    # callback functions
    def MovableChanged(self,movable):
        print "movable changed"
    def MovableDestroyed(self,movable):
        print "movable destroyed"

movlistener = MyMovableListener()
Movable.AddListener(movlistener)

Note how the constructor for all callback classes requires that you pass the object registry (in the previous example, it is assumed ObjectRegistry is the object registry, and Movable a valid movable).

Supported interfaces

cscallback

iMissingLoaderDataapi
iTerrainCellHeightDataCallbackapi
iTerrainCellLoadCallbackapi
iParticleEmitterapi
iParticleEffectorapi
iSkeletonBoneUpdateCallbackapi
iSkeletonAnimationCallbackapi
iSkeletonUpdateCallbackapi
iMeshObjectDrawCallbackapi
iObjectModelListenerapi
iObjectNameChangeListenerapi
iProcTexCallbackapi
iODEFrameUpdateCallbackapi
iReporterListenerapi
iStandardReporterListenerapi
iDynamicsStepCallbackapi
iDynamicsMoveCallbackapi
iDynamicsCollisionCallbackapi
iDynamicsColliderCollisionCallbackapi
iOffscreenCanvasCallbackapi
iVisibilityCullerListenerapi
iLightCallbackapi
iPortalCallbackapi
iCameraSectorListenerapi
iEngineFrameCallbackapi
iEngineSectorCallbackapi
iSectorCallbackapi
iSectorMeshCallbackapi
iLightVisibleCallbackapi
iMeshDrawCallbackapi
iTextureCallbackapi
iMovableListenerapi
iSndSysStreamCallbackapi
iSndSysRendererCallbackapi
iSndSysListenerapi
iSndSysListenerDopplerapi

celcallback

iQuestTriggerCallbackapi
iQuestSequenceCallbackapi
iCelNewEntityCallbackapi
iCelEntityRemoveCallbackapi
iCelTimerListenerapi
iPcInventoryListenerapi
iPcTriggerListenerapi
iPcSoundListenerapi
iPcPropertyListenerapi
iPcMeshSelectListenerapi
iPcGravityCallbackapi

Back to PyCrystal

| Article | Discussion | View source | History |