Changes between Version 8 and Version 9 of Examples/ParaviewAnimating
- Timestamp:
- 06/14/18 16:53:39 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Examples/ParaviewAnimating
v8 v9 18 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. We will try to explainfour of them, which are implemented in the following Python classes:20 In !ParaView-Python, different kinds (classes) of tracks/cues are available. We will deal with four of them, which are implemented in the following Python classes: 21 21 * paraview.simple.!KeyFrameAnimationCue: basic cue to animate general properties of objects (readers, sources, filters) in the render pipeline 22 22 * paraview.simple.!CameraAnimationCue: cue to change camera parameters (e.g. position, focal point, up direction, view angle) … … 24 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 In general, each cue is connected to one or more properties of a ParaView object and has a number of keyframes attached to it, each defining certain values for a specific point in time. Therefore 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 In the next paragraphs we are going to explain the basic mechanisms of the relevat Python classes and we give someexamples of typical use cases.28 In the next paragraphs we are going to explain the basic mechanisms of the relevat Python classes and we give examples of typical use cases. 29 29 30 == Class!AnimationScene ==31 The !AnimationScene is responsible for steeringthe animation clock time.32 For this purpose, the !AnimationScene has a !StartTime, an !EndTime, and a mechanism to determine the discrete time steps it will generate between !StartTime and !EndTime. The descrete timesteps are determined by the Mode (called !PlayMode in Python) of the !AnimationScene. Three differentModes are avilable:30 == !AnimationScene == 31 The !AnimationScene is responsible to steer the animation clock time. 32 For this purpose, the !AnimationScene has a !StartTime, an !EndTime, and a mechanism to determine the discrete points in time it will generate between !StartTime and !EndTime. These descrete timesteps are determined by the Mode (called !PlayMode in Python) of the !AnimationScene. Three different PlayModes are avilable: 33 33 * 'Sequence': the timesteps are defined by the property !NumberOfFrames 34 * 'Snap To !TimeSteps': the descrete timesteps are defined by the timesteps available in the (time dependend)data. The !AnimationScene has knowledge about the available data timesteps by the help of a seperate object, the !TimeKeeper.35 * '!RealTime': the timesteps are calculated on the fly (while rendering) to achieve a certain duration of the rendering. This mode is not useful for typical Python scripting, though.34 * 'Snap To !TimeSteps': only useful if you have time dependent data. The descrete timesteps are determind by the timesteps of the data. The !AnimationScene has knowledge about the available data timesteps by the help of a seperate object, the !TimeKeeper. 35 * '!RealTime': given a specified duration, the timesteps are calculated on the fly (while rendering) in order to achieve that the animated sequence will take this duration. This mode is not useful for typical Python scripting, though. 36 36 37 37 Important properties of !AnimationScene: … … 72 72 }}} 73 73 74 Get the animation scene and play all available timesteps of t he time dependent data:74 Get the animation scene and play all available timesteps of time dependent data: 75 75 {{{ 76 76 #!python … … 88 88 89 89 == Key Frames == 90 Before we start our explantion of cues, we give an overview about keyframes, as keyframes are an integral part of cues. Keyframes define what value(s) a cue hasat a give point in time.90 Before we start our explantion of cues, we give an overview about keyframes, as keyframes are an integral part of cues. Keyframes define what value(s) a cue passes to the property of the connected pipeline object at a give point in time. 91 91 Without keyframes, a cue is more or less useless (with the exception of the !TimeAnimationCue, see below). A cue stores the list of attached keyframes in its KeyFrame property. 92 92 … … 96 96 These two keyframes have only two intersting properties: !KeyTime and !KeyValues (which is a Python-list of values). 97 97 98 The keyframes used to interpolate values are:98 Keyframes used to interpolate values are: 99 99 * paraview.simple.!RampKeyFrame: linear interpolation 100 100 * paraview.simple.!SinusoidKeyFrame: sinusoidal interpolation … … 108 108 As already mentioned, a !KeyFrameAnimationCue connects the property of a pipeline object to the cue. 109 109 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). 110 Similar to the !AnimationScene, every cue also has the properties !StartTime and !EndTime. Typically these properties do not have the identical 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 anyhow.110 Similar to the !AnimationScene, every cue also has the properties !StartTime and !EndTime. Typically these properties do not have the identical 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 defaults anyhow. 111 111 112 112 === !KeyFrameAnimationCue Use Case === … … 120 120 track2 = GetAnimationTrack("Center", 0, sphere) 121 121 track3 = GetAnimationTrack(sphere.GetProperty("Radius")) 122 # set keyframes, in this example only for track1: 123 kf0 = CompositeKeyFrame() 124 kf0.Interpolation = 'Ramp' 125 # At time = 0, value = 0 126 kf0.KeyTime = 0 127 kf0.KeyValues = [0] 128 kf1 = CompositeKeyFrame() 129 # At time = 1.0, value = 200 130 kf1.KeyTime = 1.0 131 kf1.KeyValues = [200] 132 # attach keyframes to track1 133 track1.KeyFrames = [kf0, kf1] 122 134 }}} 123 135 124 136 125 137 == !TimeAnimationCue == 126 This type of cue is a very special one: while all other kind of cues are absolutely useless without attached keyframes, this one can fullfill a special task without having any: it can directly hand over the animation clock time (coming from !AnimationScene) to the property of a connected object. The typical use case within !ParaView is as follows: the !AnimationScene sets the value of the !TimeAnimationCue directly to its clock time. The !TimeAnimationCue is connected to the Time property of the !TimeKeeper object, which in turn requests all data objects to load the correcttime step of the data. This way the clock time of the animation scene can be kept in sync with the data timsteps.127 But one can override this behaviour by attaching keyframes to this cue and setting "!UseAnimationTime" to 0. This way one can control what data timesteps are loaded/rendered at whatanimation clock time.138 This type of cue is very special somehow: while all other kind of cues are absolutely useless without attached keyframes, this one can fullfill a special task without any: it can directly hand over the animation clock time (coming from !AnimationScene) to the property of a connected object. The typical use case within !ParaView is as follows: the !AnimationScene sets the value of the !TimeAnimationCue directly to its clock time. The !TimeAnimationCue is connected to the Time property of the !TimeKeeper object, which in turn requests all data objects to load just this time step of the data. This way the clock time of the animation scene can be kept in sync with the data timsteps. 139 Nevertheless you can override this behaviour by attaching keyframes to this cue and setting "!UseAnimationTime=0". This way you can control what data timesteps are loaded/rendered independent from the animation clock time. 128 140 129 141 === !TimeAnimationCue Use Cases === 130 Whatever the AnimationScene clock time is, set the time of the timetrack to 100.142 Whatever the !AnimationScene clock time is, set the time of the timetrack to 100. 131 143 This setup can be useful e.g. to generate an animated camera flight from one single data timestep (100 in this example). 132 144 {{{ … … 151 163 152 164 == !CameraAnimationCue == 153 To be done 165 The !CameraAnimationCue controls severals parameters of the camera, like position, focal point, up vector and view angle. 166 It's main purpose is to generate camera flights by controlling the position and focal point of the camera depending on the animation time. 167 The behaviour of the camera can be set to three different modes by the property Mode: 168 169 Mode: 170 * 'Interpolate Camera': each keyframe of the !CameraAnimationCue stores one camera position. These positions are interpolated in the animation. 171 * 'Path-based': the first keyframe of the !CameraAnimationCue stores a list of camera positions (!PositionPathPoints) and focal points (!FocalPathPoints). These values are interpolated in the animation. The pathes may be closed to generate seamless camera rides (!ClosedPositionPath, !ClosedFocalPath). 172 * 'Follow-data': The !CameraAnimationCue is connected to a visible pipeline object and the focal point of the camera is adjusted to point at the center of this (potentially moving) object. 173 174 === !CameraAnimationCue Use Cases === 175 {{{ 176 #!python 177 renderView = GetActiveView() 178 cameraTrack = GetCameraAnimationCue(view=renderView) 179 cameraTrack.Mode = 'Interpolate Camera' 180 }}} 154 181 155 182 == !PythonAnimationCue ==