AlexLuya
(Alex Luya)
November 23, 2021, 11:10am
1
Hello,I want to recalculate the normal of all actors in the window when view port changing(rotating) by dragging or left key pressing.Below approaches have been tried:
class Callback:
def __init__(self):
pass
def __call__(self, caller, ev):
print("rotating...")
interactor.AddObserver(vtk.vtkCommand.RotateEvent, Callback())
renwin.AddObserver(vtk.vtkCommand.RotateEvent, Callback())
renderer.GetActiveCamera().AddObserver(vtk.vtkCommand.RotateEvent, Callback())
But none of them will print out “rotating”,question is
Where to register which type of event to handle rotate event?
Thanks.
1 Like
smoothumut
(umut e. senol)
August 10, 2023, 11:34am
2
I have the same problem, somehow OnRotate function is not triggered
here is my custom interactorStyle
class NoRotateStyle(vtk.vtkInteractorStyleTrackballCamera):
def __init__(self):
self.AddObserver("RotateEvent",self.onRotateEvent)
self.AddObserver("LeftButtonPressEvent", self.onLeftButtonDown)
# self.AddObserver("LeftButtonReleaseEvent", self.onLeftButtonUp)
# self.AddObserver("InteractionEvent",self.onInteract)
# self.AddObserver("RightButtonPressEvent", self.onRightButtonDown)
pass
def onLeftButtonDown(self, obj, event) -> None:
print("left clicked down custom interactor",obj)
self.OnLeftButtonDown()
return
def onRotateEvent(self, obj,event) -> None:
print("rotating")
self.OnRotate()
return
def OnRotate(self) -> None:
print("rotating")
return super().OnRotate()
def OnPan(self) -> None:
print("panning")
return super().OnPan()
OnPan, OnRotate methods which are original methods are not triggered.
Also if I addobserver for rotate or pan, the custome method “onRotateEvent” method is also not triggered
Am I missing something or is there a bug??
Thanks in advance
Best Regards
1 Like