Panda3d -> Tcl bindings

A Swig interface for Tcl and (potentially) any other language supported by it.

Features and limitations

It's still incomplete, but good enough to open a window, load models, set up collisons and evaluate performance.

There might be memory leaks because I'm not an expert at Tcl internals and I'm unsure if and when objects are garbage collected.

Issues

Panda headers employ several advanced c++ features and some preprocessor tricks. Swig deals with almost all of those.

Except when a constructor or a method has a default parameter that invokes another constructor, like:

Camera(const string &name, Lens *lens = new PerspectiveLens());

Swig gives a syntax error. However, changing that declaration to:

Camera(const string &name); Camera(const string &name, Lens *lens);

solves the problem and it seems to be binary compatible. There doesn't seem to be many instances of that in Panda and I can only hope they don't add any more.

Another issue has to do with vectors and their use of preprocessor macros and double inclusion. Looks like Swig can't deal with preprocessor symbols that get re-defined in flight.

I got around that particular issue by wrapping the "float" version of vectors only, leaving out the "double" version.

Other languages

Dependecies on Tcl are few and concern only an handful of custom typemaps and a small additional class to enable Tcl scripts to be called as callback functions.

A Python version of the same class is already available in the main Panda3d source tree.

Links

Project page