Improvements to Wrapping in VTK

July 2, 2010

I have been working with David Gobbi, a long-standing member of the VTK developer community, and some Kitware developers, on integrating some large changes to the wrapping code used by VTK to generate the Python, Tcl and Java bindings. The majority of these changes were authored by David, who has continued to push in more improvements after we merged the main patch series. Keith Fieldhouse spent quite some time gathering all of the unique commits into a topic branch that we could review, and test internally, before merging into VTK.

I am very pleased with the improvements, making things such as vtkStdString, vtkUnicodeString and vtkVariant wrappable. The ultimate aim, which is drawing closer, is to remove the requirement for surrounding code that cannot be wrapped inside BTX/ETX blocks. The wrapping code has been significantly refactored, and as far as we are aware we have addressed all issues that showed up on the dashboards of VTK and related projects. Significant enhancements have been made to the C++ parser used by the wrapping code, enabling it to understand more of the C++ language, such as namespaces, constants, functions, templates, operators and enums. This opens up the possibility of adding support for these constructs in our wrapped languages.

I would like to thank David for the work he has put into pushing our wrapping forward. This is something I will be using to great effect in my work, and I think it was a much needed step forward for the wrapping code that has been struggling to wrap parts of our C++ API adequately. Support for enums is in the works, and it is now much easier for us to wrap classes that are not derived from vtkObject (although there is a limit on the number of types we can wrap in the current implementation). This effort has trickled down into other projects using the wrapping such as ParaView and Titan.

If your project uses the VTK wrapping code I encourage you to test the new code in VTK’s Git repository, and report any issues you encounter.

Leave a Reply