Skip to content

Python fixes relating to VTK's GetClassName for templated classes

David Gobbi requested to merge dgobbi/vtk:pythonname-fixes into master

Previously, it was impossible to subclass a templated base class in any module except for the one the base class was defined in. This change fixes that problem by using typeid(type).name() to correctly retrieve the base class from the other module. This use of typeid() is necessary because that's how ClassName() is defined in vtkSetGet.h for the templated classes.

This MR also contains a closely related fix for overload resolution on templated objects. Previously, for overloaded methods, if one of the overloads accepted an instance of a templated VTK class (such as vtkSOADataArrayTemplate<float>*), method calls from Python would never resolve to that overload. This fixes that issue by ensuring that the type object used for type checking is correctly retrieved, based on the VTK's typeid()-based class name.

Edited by David Gobbi

Merge request reports