trace recorder and camera

The trace recorder does not record camera positions. Is this an oversight, or by design? How can a user find the camera position in a script?

Thanks,

Alan

We probably don’t record camera positions because even a moderate amount of interaction would spew many camera position changes and renders, and there wouldn’t be much point playing all of them back in a script. You can access the camera with

cam = GetActiveCamera()

and then query it’s position, focal plane, view up direction, etc.

position = cam.GetPosition()
focalPoint = cam.GetFocalPoint()
viewUp = cam.GetViewUp()

Use the equivalent setters to adjust these camera parameters in the script:

cam.SetPosition(position)
cam.SetFocalPoint(focalPoint)
cam.SetViewUp(viewUp)

Thanks, exactly what I needed.

I think I would prefer that we add the option to write the camera position into the trace, default off. Then, we would only save the camera position on a still render. Would that be doable?

I think that may be reasonable. It still may produced bloated traces, but since it would be off by default, it might not be too bad.

Written up here. https://gitlab.kitware.com/paraview/paraview/issues/18546

1 Like

I also want all explicit camera motions recorded. i wrote it up here: https://gitlab.kitware.com/paraview/paraview/issues/19543

Hi Cory and Everyone,

I want to set camera position in the script by checking the numbers (after changing camera angles in the view) but I could not access it in Python Shell.

cam = GetActiveCamera()
position = cam.GetPosition()
focalPoint = cam.GetFocalPoint()
viewUp = cam.GetViewUp()

How can I view the values after interacting with the view and running this script in Python Shell? Print() function is not available, and my pvpython is not working atm. In this case camera tracing would be great…

Thanks guys

Actually I was able to get info on the camera by starting trace, moving the view and then stopping trace. The trace did not update just from moving the view, and rightfully so.

Here is the output:
"# current camera placement for renderView1

renderView1.CameraPosition = [397.29119154962495, -98.19057934751415, 72.92565616277386]
renderView1.CameraFocalPoint = [161.37200552532937, 99.19566278018993, -125.17297051758995]
renderView1.CameraViewUp = [-0.3601033886339963, 0.41041040520919386, 0.8377880691382149]
renderView1.CameraParallelScale = 94.69461918292063
"