I am trying to modify the Rotate() function of vtkInteractorStyleTrackballCamera in order to obtain an arcball camera instead of a trackball camera.
The advantage of arcball camera is path invariance, as described here. (I wonder why this is not already available in VTK ?)
I am using the Python vtk wrapper. (vtk version : 9.0.1)
My problem is that I cannot access the method Rotate() of vtkInteractorStyleTrackballCamera.
I tried to subclass vtkInteractorStyleTrackballCamera and making mock methods to verify that the methods are working as expected.
class subclass(vtk.vtkInteractorStyleTrackballCamera):
def aMethodFromParent(self):
print('aMethodFromParent has been called !')
(return) super().aMethodFromParent()
It works for methods like OnLeftButtonDown, OnMouseMove, GetState.
It does not for methods like Rotate, OnStartRotate, OnStartPan. (nothing happens when, for example, I rotate the view in my 3D viewport)
If I succeed to make it work, I would be happy to contribute to the C++ codebase .
However I would like to make it work first in vtk python, and the link you provided is a C++ implementation.
I tried to make the same thing but in python. In Python the overriding of Rotate seems not to be working and I cannot figure out why. In fact, Rotate method seems to be never called, even when rotating the view in the 3D viewer. (As I mentionned, I can check that methods like OnLeftButtonDown are called when left clicking on the viewer)
The wrappers don’t automatically hook virtual method overrides from C++ through to Python. In the cases where it works, it works because the method has been set as a observer for a VTK event via AddObserver(event, method).
Edit: Before the edit, I had proposed using OnRotate() since it’s associated with an event. It turns out Rotate() and OnRotate() are very different things. The OnRotate() method is for catching multi-touch events, when someone puts two fingers on a touchscreen and does a “rotate” gesture. So it’s totally unrelated to the issue at hand.