Changes between Version 4 and Version 5 of Examples/ParaviewAnimating


Ignore:
Timestamp:
06/14/18 12:32:36 (6 years ago)
Author:
Herwig Zilken
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Examples/ParaviewAnimating

    v4 v5  
    44https://www.paraview.org/ParaView3/Doc/Nightly/www/py-doc/paraview.servermanager_proxies.html
    55
    6 On this page, we would like to share our own experience with you.
     6On this page, we would like to share our own experience with you. DISCLAIMER: our knowlegde about all this is not complete and maybe incorrect. So believe everything found on this page on your own risk.
    77
    88== ParaView Gui: Animation View ==
     
    1414
    1515== 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 key 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.
     16The 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.
    1717Within 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) property of the scene.
     18In 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.
    1919
    2020In 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:
     
    2626The (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.
    2727
     28In 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.
    2829
     30== Class !AnimationScene ==
     31The !AnimationScene is responsible for steering the animation clock time.
     32For 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 different Modes are avilable:
     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.
     36
     37Important properties of !AnimationScene:
     38* !StartTime: the start time of the animation
     39* !EndTime: the end time of the animation
     40* !PlayMode: either 'Sequence', 'Snap To !TimeSteps' or '!RealTime'
     41* !NumberOfFrames: number of frames, only used when !PlayMode is set to 'Sequence'
     42* !AnimationTime: the actual animation clock time. Can be get or set.
     43* !TimeKeeper: the !TimeKeeper-object
     44
     45Important methods of !AnimationScene:
     46* !GoToFirst(): goto first frame
     47* !GoToLast(): goto last frame
     48* !GoToNext(): goto next frame
     49* !GoToPrevious(): goto previous frame
     50
     51=== Use Case ===
     52Get the animation scene and play a sequence of 100 timesteps:
     53{{{
     54#!python
     55animationScene = GetAnimationScene()
     56animationScene.StartTime = 0
     57animationScene.EndTime = 1
     58animationScene.NumberOfFrames = 100
     59animationScene.PlayMode = 'Sequence'
     60animationScene.GoToFirst()
     61while True:
     62   # render scene
     63   # safe image
     64   if animationScene.AnimationTime == animationScene.EndTime:
     65      break
     66   anmationScene.GoToNext()
     67}}}
     68
     69Get the animation scene and play all available timesteps of the time dependent data:
     70{{{
     71#!python
     72animationScene = GetAnimationScene()
     73animationScene.PlayMode = 'Snap To TimeSteps'
     74animationScene.GoToFirst()
     75while True:
     76   # render scene
     77   # safe image
     78   if animationScene.AnimationTime == animationScene.EndTime:
     79      break
     80   anmationScene.GoToNext()
     81}}}
     82
     83
     84
     85