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 a number of interfaces in cs and cel which can serve as callbacks to discover things happening in engine. To be able to use this functionality, one must inherit from special python base classes.

-

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

+

There are two modules in [https://b2cs.delcorp.org/svn/csexternal/trunk 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.

+

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.

+

+

In the cscallback module there are also a couple classes (see tables below) that can be inherited from, these don't need any name change.

== Example ==

== 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:

+

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

Current revision

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 to use this functionality, one must inherit from special python base classes.

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.

In the cscallback module there are also a couple classes (see tables below) that can be inherited from, these don't need any name change.

Example

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

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).