Changes between Version 6 and Version 7 of Examples/ParaviewAnimating
- Timestamp:
- 06/14/18 13:18:04 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Examples/ParaviewAnimating
v6 v7 7 7 8 8 == ParaView Gui: Animation View == 9 As usual, when you want to write a Python script for ParaView from scratch, and have no idea where to start, it make sense to open theParaView GUI, start a Python trace, and prototype the desired setup in the GUI interactively. When you want to generate an animation, you have to deal with the Animation View, obviously.9 As usual, when you want to write a Python script for !ParaView from scratch, and have no idea where to start, it make sense to open the !ParaView GUI, start a Python trace, and prototype the desired setup in the GUI interactively. When you want to generate an animation, you have to deal with the Animation View, obviously. 10 10 11 11 [[Image(ParaView_AnimationView.jpg, margin=10)]]\\ 12 12 13 Unfortunately, ParaView is not willing to include all interactive settings in the trace. Some are just skipped, e.g. settings regarding the "TimeKeeper1 - Time" are NOT reflected in the trace. For this reason it makes sense to take a more closer look at the mechanisms and Python classes working behind the scene.13 Unfortunately, !ParaView is not willing to include all interactive settings in the trace. Some are just skipped, e.g. settings regarding the "TimeKeeper1 - Time" are NOT reflected in the trace. For this reason it makes sense to take a more closer look at the mechanisms and Python classes working behind the scene. 14 14 15 15 == Basic Concept == 16 The basic concept of how to animate "something", in this case the rendered ParaView scene, is quite easy to understand. The central element of any animation is a timeline with a start and end time and, as we work with discrete timesteps, a number of frames. This is implemented in the Python class paraview.simple.AnimationScene.16 The basic concept of how to animate "something", in this case the rendered !ParaView scene, is quite easy to understand. The central element of any animation is a timeline with a start and end time and a mechanism to determine a number of descrete timesteps (frames). All this is implemented in the Python class paraview.simple.!AnimationScene. 17 17 Within the time interval defined in the timeline, properties of the scene can be changed. 18 In the ParaView GUI this concept is reflected by so called "tracks" (or "cues") in the Animation View. Basically, each track defines the temporal change of one (or more) properties of the scene.18 In the !ParaView GUI this concept is reflected by so called "tracks" (or "cues") in the Animation View. Basically, each track defines the temporal change of one (or more) properties of the scene. 19 19 20 In ParaView-Python, different kinds (classes) of tracks/cues are available. Here we will try to explain four of them, which are implemented in the following Python classes:21 * paraview.simple. KeyFrameAnimationCue: basic cue to animate general properties of objects (readers, sources, filters) in the render pipeline22 * paraview.simple. CameraAnimationCue: cue to change camera parameters (e.g. position, focal point, up direction, view angle)23 * paraview.simple. PythonAnimationCue: cue to execute a Python script at a certain point in time24 * paraview.simple. TimeAnimationCue: cue to determine what data timesteps are loaded depending on the animation clock time20 In !ParaView-Python, different kinds (classes) of tracks/cues are available. We will try to explain four of them, which are implemented in the following Python classes: 21 * paraview.simple.!KeyFrameAnimationCue: basic cue to animate general properties of objects (readers, sources, filters) in the render pipeline 22 * paraview.simple.!CameraAnimationCue: cue to change camera parameters (e.g. position, focal point, up direction, view angle) 23 * paraview.simple.!PythonAnimationCue: cue to execute a Python script at a certain point in time 24 * paraview.simple.!TimeAnimationCue: cue to determine what data timesteps are loaded depending on the animation clock time 25 25 26 The (change of the) values of the properties in the timeline are defined by one or more keyframes included in each track. The key elements :) of a keyframe are keytime and keyvalues. The value(s) of the referred property is set to the keyvalues at the specified keytime. Some types of keyframes also have the ability to interpolate keyvalues from one keyframe to the next. Specifically these are paraview.simple. CameraKeyFrame, paraview.simple.CompositeKeyFrame, paraview.simple.ExponentialKeyFrame, paraview.simple.RampKeyFrame and paraview.simple.SinusoidKeyFrame.26 The (change of the) values of the properties in the timeline are defined by one or more keyframes included in each track. The key elements :) of a keyframe are keytime and keyvalues. The value(s) of the referred property is set to the keyvalues at the specified keytime. Some types of keyframes also have the ability to interpolate keyvalues from one keyframe to the next. Specifically these are paraview.simple.!CameraKeyFrame, paraview.simple.!CompositeKeyFrame, paraview.simple.!ExponentialKeyFrame, paraview.simple.!RampKeyFrame and paraview.simple.!SinusoidKeyFrame. 27 27 28 28 In the next paragraphs we are going to explain the basic mechanisms of the relevat Python classes and we give some examples of typical use cases. … … 88 88 89 89 == !KeyFrameAnimationCue == 90 As already mentioned, a !KeyFrameAnimationCue is connected to a property of a pipeline object.90 As already mentioned, a !KeyFrameAnimationCue connects the property of a pipeline object to the cue. 91 91 This connection is defined via the attributes !AnimatedProxy (proxy of the pipeline object) and !AnimatedPropertyName (name of the connected property), though typically you do not have to set these attributes on your own. Instead they are set when constructing a !KeyFrameAnimationCue by calling !GetAnimationTrack(...) (see use case below). 92 Similar to the !AnimationScene, every cue also has the properties !StartTime and !EndTime. Typically these properties do not have the same values as the corresponding ones of !AnimationScene. When !TimeMode is set to 'Normalize', the start and end time of the animation scene is linearly interpolated to the interval [0,1]. These values are the default ones.92 Similar to the !AnimationScene, every cue also has the properties !StartTime and !EndTime. Typically these properties do not have the same values as the corresponding ones of !AnimationScene. When !TimeMode is set to 'Normalize', the start and end time of the animation scene is linearly interpolated to the interval ![0,1]. But don't care, these values are the default ones anyhow. 93 93 94 94 === !KeyFrameAnimationCue Use Case === … … 99 99 sphere = Sphere() 100 100 Show(sphere) 101 track 3= GetAnimationTrack("Visibility") # property of active source102 track 1= GetAnimationTrack("Center", 0, sphere)103 track 2= GetAnimationTrack(sphere.GetProperty("Radius"))101 track1 = GetAnimationTrack("Visibility") # property of active source 102 track2 = GetAnimationTrack("Center", 0, sphere) 103 track3 = GetAnimationTrack(sphere.GetProperty("Radius")) 104 104 }}} 105 105