Create camera movement for animations in Python

Hello,

I use the “interpolate cameras” feature and manually set 6 positions for the camera path in the GUI. However, the camera movements don’t show up in the python state file nor can I trace them. (I know this is to prevent bloated python scripts)

Is there any workaround or working code snipped about interpolating cameras in python? I would love to make changes in the python code and pvbatch animations…

I am using 5.11.0 and couldn’t find a way to resolve this. The camera placements get tracked and look like this:

# current camera placement for renderView1
renderView1.CameraPosition = [0.0102328, 0.00547051, 0.0435503]
renderView1.CameraFocalPoint = [0.01, -0.00125, 0.003125]
renderView1.CameraViewUp = [-0.01612050092440396, 0.9863480565605282, -0.16388300939760517]
renderView1.CameraParallelScale = 0.0106066
# Adjust camera

# current camera placement for renderView1
renderView1.CameraPosition = [0.03077353164932608, -0.0004529731381457592, 0.0098734333057557]
renderView1.CameraFocalPoint = [0.01208594227197795, -0.0017499687200504962, 0.0001676446387540233]
renderView1.CameraViewUp = [0.0011748186223604893, 0.9904167730136751, -0.13810588522717943]
renderView1.CameraParallelScale = 0.0106066
# Adjust camera
...

Thank you very much

You should manually create the camera track and then add some keyframes:

# get or create track for current view
track = GetCameraTrack()
track.Mode = 'Interpolate Cameras' # should be the default
keyframe = CameraKeyFrame()
# setup keyframe properties, like KeyTime, Position, FocalPoint and so on
keyframe.KeyTime = time
# add it to the track
track.KeyFrames.append(keyframe)