[vtk-developers] Wrapping vtkVariant and other special types in Python

David Gobbi david.gobbi at gmail.com
Sun May 2 17:21:09 EDT 2010


As suggested by Brad, I've made a fork of VTK on github and pushed my
wrapper changes to it:
http://github.com/dgobbi/VTK

This version of VTK wraps vtkVariant for Python, and should be capable
of wrapping many other special types as well.  In
Common/CMakeLists.txt you can see where I've added a "WRAP_SPECIAL"
property for vtkVariant and vtkTimeStamp.  Other classes can be given
the WRAP_SPECIAL property as well, and I encourage people to try.
Note that after adding the WRAP_SPECIAL property to a class, you'll
have to play with BTX/ETX.

I haven't started in on the vtkStdString fixes yet.  It is a separate
issue in a way, because vtkStdString and vtkUnicodeString are
"fundamental types" as far as the wrappers are concerned, while
vtkVariant is merely a "special type."  Apologies for using my own
made-up vocabulary here. In any case, if I fix the vtkStdString
wrapping, it will be fixed across all the wrapper languages, not just
python.

In addition to special type support for python and massive cleanup of
vtkWrapPython.c, I've also changed the way that overloaded functions
are resolved.  The python wrappers used to try each overload in turn
until one of them worked.  Now the python wrappers find the overload
that is the best match to the arguments.

And one more item before I head outdoors to enjoy what's left of the
weekend: I've finally pushed the WrapVTK project out to github,
http://github.com/dgobbi/WrapVTK, which can be used to generate XML
descriptions of the VTK classes.  WrapVTK will be used as the basis
for the next version of the SimVTK (Simulink/VTK) project.

Any feedback is appreciated.

   David



More information about the vtk-developers mailing list