[Paraview] Scripting the opacity property of a Time Annotation filter

Wim van der Meer wpjvandermeer at gmail.com
Sun May 31 03:10:45 EDT 2009


Hi all,

Another animation script question. I am trying to create an animation
movie with the fade-out of a Time Annotation filter using its opacity
property. I have attached a short script that shows what I am trying
to do. However , the script produces the following error:

ERROR: In /tmp/Kitware/ParaView3/Servers/ServerManager/vtkSMRampKeyFrameProxy.cxx,
line 53
vtkSMRampKeyFrameProxy (0xb33c390): Cue does not have domain or property set!

By the way, using the same method to animate the opacity of a Slice
filter works without problems (thank you Utkarsh). Am I missing
something?

Here is the script, you need to create a Annotate Time filter in
ParaView and then run this script from the built-in Python shell:

#!/usr/bin/python
# -*- coding: utf-8 -*-

# parameters
fps = 24.0 # frames/seconds
time = 6.0 #movie length in seconds

# get the view and camera, create the movie
view = servermanager.GetRenderView()
camera = view.GetActiveCamera()
camera.SetParallelProjection(True)
camera.SetViewUp(0.0, 1.0, 0.0)
movie = servermanager.animation.AnimationScene()
movie.ViewModules = [view]
movie.NumberOfFrames = fps * time

# get the annotation and its representation
pm = servermanager.ProxyManager()
anntime = pm.GetProxy("sources", "AnnotateTime1")
anntime_repr = None
for rep in view.Representations:
  if rep.Input[0].Proxy == anntime:
    anntime_repr = rep
    break

# make sure the annotation is visible
anntime_repr.Opacity = 1.0
anntime_repr.Visibility = 1
anntime_repr.Enabled = 1

# fade out the annotation
cue = servermanager.animation.KeyFrameAnimationCue()
cue.StartTime = 0.0
cue.EndTime = 1.0

cue.AnimatedProxy = anntime_repr
cue.AnimatedPropertyName = "Opacity"

keyf0 = servermanager.animation.CompositeKeyFrame();
keyf0.Type = 2 # Set keyframe interpolation type to Ramp.
keyf0.KeyTime = 0.0
keyf0.KeyValues= [1.0]

keyf1 = servermanager.animation.CompositeKeyFrame()
keyf1.KeyTime = 1.0
keyf1.KeyValues = [0.0]

cue.KeyFrames = [keyf0, keyf1]

movie.AddCueProxy(cue)

# Play the animation
movie.Play()


-- 
Wim van der Meer


More information about the ParaView mailing list