Python/Ygdrasil classes
The following classes for incorporating Python
scripts into an Ygdrasil environment are available:
All of these classes use the pyInterface class
for much of their implementation.
These classes have so far been tested (at various stages) under:
- SuSE Linux 7.3, with Python 2.1.1
- RedHat Linux 7.3, with Python 2.2
- IRIX 6.5, with Python 2.2.1
A complete tar file of the source code, makefiles, pre-compiled DSOs,
and examples is here, in: pyg.tgz
Note that you will probably have to modify the PYTHONINCDIR and PYTHONLIB
settings in the Makedefs file if you wish to recompile the modules yourself.
Bugs
See the note at the end of pyInterface for
one known bug.
To Do List
Some improvements that could be worked on:
- Provide an interface to user & wand data.
- Add a pySpace class. This will require a Python implementation
of the various ygVolume classes.
- Python versions of pfMatrix and other linear-algebra classes. Possibly
the Numerical Python package could be used for this.
- A pyNavigator class, to make extending the navigator easier.
- Allow Python functions to be called in a scene file "directly",
without needing the call() message. i.e. make it possible to do
something like "wandTrigger (when(button1, myPyNode.myfunc($user))"
instead of "wandTrigger (when(button1, myPyNode.call(myfunc($user)))"
This would require delving
into Python's class data structures, to be able to find out what methods
a particular object has available.
- Move all the Python extension code from pyTransform & pySelector
(i.e. the ygtransform & ygselector modules) into pyInterface.
The Python ygTransform & ygSelector classes probably don't
need to be moved, but moving the C++ extension modules will allow any
pyNode scripts to manipulate other ygTransforms/ygSelectors (not just
Python-based ones) in the scene.
- Add other functions to ygdrasil module: className(node), isOfClass(), addChild(),
removeChild(), getTransform(), ygWorld clip/sky/fog functions, FrameNumber,
ygNodeDB::create()
- Networked versions? pyNode etc. are currently not 'networked classes'.
(The ygTransform underlying a pyTransform is still networked, of course; similarly
for pySelector.) For most cases I believe this is correct - the Python script
should only need to run on the master host and manipulate other, networked
nodes. But some cases are sure to come up where running the script on
client hosts makes sense. For these cases, a separate class ("pyNetNode")
would be needed; it would have to share the name of its script (and could possibly
share the script itself as well, through a fileserver), and presumably any
call() messages sent to it.
Last updated 14 September 2002.
home page