Restore scene to initial state

ResetCamera appears to point the camera from its current position back at the actors. I’m looking for something that restores the initial scene conditions, including restoring the initial camera location and settings.

My app creates an interactor with its window, renderer, and camera, then loads and adds a PolyData made up of a stack of quads. So the initial view is down at the top of the stack. If a user swings the camera around and pans and zooms, I’d like to provide the facility to return to the initial state, before interaction, without reloading the whole thing.

Is there a method or set of methods to call to do that? Perhaps a save/restore sequence?

Hello,

My two cents: create a 2nd vtkCamera object and do this after you init the scene:

   defaultCamera->deepCopy( theCamera );

Then, wherever you need to restore the original camera settings, do:

   theCamera->deepCopy( defaultCamera );

You can easily extend this rationale with a stack (say, with 10 camera objects) if you wish to implement an undo-list-like behavior.

take care,

Paulo

Perfect, thanks!

In C++, the method is DeepCopy. In my button handler for OnResetView, I just had to add a renderWindow->render() to update the display.

1 Like