Filter animation using Keyframes

Dear all,

I am trying to render an animation in a HPC and for this reason I need to do everything by python scripts. I am able to generate a camera movement using Keyframes with a code that looks like this:

Step 1 ) Generate the Camera Animation
cameraAnimationCue1 = GetCameraTrack(view=renderView1)
Step 2 ) Define keyFrames
keyFrame_1 = CameraKeyFrame()
keyFrame_1.KeyTime = 0.0
Step 3 ) Assign the keyFrames to the camera animation
cameraAnimationCue1.KeyFrames = [keyFrame_1,keyFrame_2,keyFrame_3, …]

I was able to do this because I could trace the python code for generating the aforementioned camera motion. However, when I try to apply this to a filter from the “Animation View” menu, I cannot trace the python code that would generate this :

Is is possible to generate an animation of a filter variable (i.e. opacity, visibility, origin…) with keyframes as the Camera movement from a python code? Can someone provide an example of this? I couldn’t find more info about this kind of post-processing using pvbatch.

Thank you in advance!

You should use GetAnimationTrack to create (or retrieve if already existing) an animation track.
Then you can create some KeyFrame objects to add them to your track.

This is a known bug, see here.

Hi Nicolas!

Thank you for your answer! It worked perfectly. In case someone runs into the same issue, I leave here an example to get the opacity of a given filter (slice1 in this case) and generate an animation with 5 keyframes

opacityTrack = GetAnimationTrack("Opacity", 0, slice1)

keyf0 = CompositeKeyFrame()
keyf0.Interpolation = 'Ramp'
keyf0.KeyTime = 0
keyf1 = CompositeKeyFrame()
keyf1.Interpolation = 'Ramp'
keyf2 = CompositeKeyFrame()
keyf2.Interpolation = 'Ramp'
keyf3 = CompositeKeyFrame()
keyf3.Interpolation = 'Ramp'
keyf4 = CompositeKeyFrame()
keyf4.Interpolation = 'Ramp'


Regards :slight_smile:

1 Like