[vtkusers] How to save/restore viewpoint/camera from python - no pickler support

Mark Asbach mark.asbach at post.rwth-aachen.de
Wed Mar 3 07:51:25 EST 2004


Hi list,

the situation: we have a finite elements toolkit with embedded python 
interpreter. The interpreter logs all python commands to a file so that 
interactive work can be "replayed" later on. That works for all things 
done in the python console but now we added vtk visualization, the 
replay function can't function fully because mouse and keyboard 
interaction with the render window isn't logged.

It would be fine, if I could somehow read out at least the viewpoint / 
camera position with a python command and restore it later. The 
standard way of using the module pickle doesn't work because 
vtkWrapPython does nothing to provide __setstate__() and __reduce__() 
methods.

So I thought, vtk.vtkRenderer.GetViewpoint () would do what I want and 
indeed it returns all the information I need. The problem is now, that 
the the corresponding SetViewpoint() method doesn't affect the 
rendering seen in the render window.

My third try was to GetActiveCamera() of the vtkRenderer. But which 
part of the information held by a camera instance is affected by mouse 
interaction?

I'm a bit stuck now and would welcome any hints.

Thanks in advance,

Mark




More information about the vtkusers mailing list