I am having issues with the clipping animation track KeyTime values?

I am trying to use the clipping tool with python and I feel like I have the correct set up for this, however every time I run my script the times for the animation track of the clip are off. this is what I want:

     # get animation scene
     animationScene1 = GetAnimationScene()

    # get animation track
    clip1ClipTypeOriginTrack = GetAnimationTrack('Origin', 0, proxy=clip1.ClipType)

    # create keyframes for this animation track

    # create a key frame
    keyframe1 = CompositeKeyFrame()
    keyframe1.Interpolation = 'Ramp'
    keyframe1.KeyTime = [-.62] #start time of clip 
    keyframe1.KeyValues = [0] # starting pt. of clip
    # create a key frame
    keyframe2 = CompositeKeyFrame()
    keyframe2.Interpolation = 'Ramp'
    keyframe2.KeyTime = [0.0]  #end time of clip in sec.
    keyframe2.KeyValues = [float(a[j-1][7])] 

    # initialize the animation track
    clip1ClipTypeOriginTrack.KeyFrames = [keyframe1, keyframe2]
    # get display properties
    clip1Display = GetDisplayProperties(clip1, view=renderView1)

but when it loads on Paraview, I get this:

It is not giving me the correct values that I assigned for the KeyTimes and when I change the start time to -.62, it assigns that value to the KeyValue of [float(a[j-1][7])] instead of 0 like I would like.

If anyone knows what might be going on, any help is greatly appreciated.
The key times change to different values when I manually change the start time on the animation view.

the animation track by default is setup to use normalized time in the range [0, 1] where 0 is start of the animation and 1 is the end. keyframe1.KeyTime = [0] and keyframe2.KeyTime = [1.0], I believe, should do the trick.

1 Like

Thank you, I guess I need to make the start time of the animation the same as the time of the clipping. I guess what I was trying to do is have a different start time in my animation and at a different time I wanted the clipping to start. Is this possible to do with python? I am able to set this up manually on Paraview but when I tried to do this with python I end up with the same issue.

The KeyTime is specified as a normalized value where 0 is the start of the animation and 1 is the end of it. To start half way in, for example, set the KeyTime to 0.5.

1 Like