Accessing the currently active camera in a cpp plugin

Hello,

I am currently trying to develop a small plugin that exposes some camera controls I often need.

As a starting off point I copied and compiled the SourceToolbar example. After modifying some of the buttons to get a feel for working with qt and paraview plugins I wanted to access the camera.

I found the vtkCamera, but no way to access the current instance of the currently active view. Is there any already existing code I could copy or some kind of pipeline I could follow?

Edit: I am currently working with Paraview Version 6.0

pqActiveObjects::activeView( )

https://www.paraview.org/paraview-docs/v5.13.2/cxx/classpqActiveObjects.html#a643a031a63c8cce671b203a8d1a3c580

Thank you! I have it working now

For those with similar problems, this is jow I access the camera right now:

pqView* view = pqActiveObjects::instance().activeView();

pqRenderView* renderView = qobject_cast<pqRenderView*>(view);
vtkView* clientView = renderView->getClientSideView();
vtkPVRenderView* pvRenderView = vtkPVRenderView::SafeDownCast(clientView);

vtkCamera* camera = pvRenderView->GetActiveCamera();
1 Like