vtkSMAnimationScene.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
22 #ifndef vtkSMAnimationScene_h
23 #define vtkSMAnimationScene_h
24 
25 #include "vtkAnimationCue.h"
26 #include "vtkCommand.h" // needed for vtkCommand::UserEvent
27 #include "vtkParaViewDeprecation.h" // for deprec macros
28 #include "vtkRemotingAnimationModule.h" //needed for exports
29 
30 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_13_0
31 
34 class vtkSMProxy;
35 class vtkSMViewProxy;
36 
38 {
39 public:
40  static vtkSMAnimationScene* New();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
49  void AddCue(vtkAnimationCue* cue);
50  void RemoveCue(vtkAnimationCue* cue);
51  void RemoveAllCues();
52  int GetNumberOfCues();
54 
56 
61  void AddViewProxy(vtkSMViewProxy* proxy);
62  void RemoveViewProxy(vtkSMViewProxy* proxy);
63  void RemoveAllViewProxies();
65 
67 
70  unsigned int GetNumberOfViewProxies();
71  vtkSMViewProxy* GetViewProxy(unsigned int cc);
73 
75 
79  void SetTimeKeeper(vtkSMProxy*);
80  vtkGetObjectMacro(TimeKeeper, vtkSMProxy);
82 
84 
88  vtkSetMacro(LockStartTime, bool);
89  vtkGetMacro(LockStartTime, bool);
90  vtkBooleanMacro(LockStartTime, bool);
92 
94 
98  vtkSetMacro(LockEndTime, bool);
99  vtkGetMacro(LockEndTime, bool);
100  vtkBooleanMacro(LockEndTime, bool);
102 
104 
107  void SetSceneTime(double time)
108  {
109  if (this->InTick)
110  {
111  // Since this method can be called during a Tick() event handler.
112  return;
113  }
114  this->Initialize();
115  this->Tick(time, 0, time);
116  }
118 
119  // Get the time of the most recent tick.
120  // The only difference between this and AnimationTime (or ClockTime) defined
121  // in the superclass is that, unlike the latter this is defined even outside
122  // AnimationCueTickEvent handlers.
123  vtkGetMacro(SceneTime, double);
124 
126 
136  vtkSetVector2Macro(PlaybackTimeWindow, double);
137  vtkGetVector2Macro(PlaybackTimeWindow, double);
139 
141 
144  void SetLoop(int val);
145  int GetLoop();
146  void Play();
147  void Reverse();
148  void Stop();
149  void GoToNext();
150  void GoToPrevious();
151  void GoToFirst();
152  void GoToLast();
153  void SetPlayMode(int val);
154  int GetPlayMode();
155  void SetNumberOfFrames(int val);
156 
157  PARAVIEW_DEPRECATED_IN_5_13_0("Use `SetStride` instead`")
158  void SetDuration(int vtkNotUsed(val)) {}
159 
160  void SetFramesPerTimestep(int val);
161  void SetStride(int val);
162  bool GetInPlay();
164 
165  enum
166  {
167  // Fired whenever the vtkAnimationScene wants to request the
168  // vtkSMAnimationSceneProxy to update the start/end times.
169  // The calldata is a vtkVector2d with the suggested time-range.
170  UpdateStartEndTimesEvent = vtkCommand::UserEvent
171  };
172 
174 
179  vtkSetMacro(ForceDisableCaching, bool);
180  vtkGetMacro(ForceDisableCaching, bool);
182 
188  vtkSetMacro(OverrideStillRender, bool);
189  vtkGetMacro(OverrideStillRender, bool);
190 
192 
196  PARAVIEW_DEPRECATED_IN_6_0_0("Use vtkPVGeneralSettings::SetCacheGeometryForAnimation")
197  static void SetGlobalUseGeometryCache(bool);
198  PARAVIEW_DEPRECATED_IN_6_0_0("Use vtkPVGeneralSettings::GetCacheGeometryForAnimation")
199  static bool GetGlobalUseGeometryCache();
201 
202 protected:
204  ~vtkSMAnimationScene() override;
205 
207 
211  void StartCueInternal() override;
212  void TickInternal(double currenttime, double deltatime, double clocktime) override;
213  void EndCueInternal() override;
215 
217 
220  void TimeKeeperTimeRangeChanged();
221  void TimeKeeperTimestepsChanged();
223 
224  bool LockStartTime;
225  bool LockEndTime;
226  bool InTick;
227  double SceneTime;
228  double PlaybackTimeWindow[2];
229  bool ForceDisableCaching;
230  vtkSMProxy* TimeKeeper;
231  vtkCompositeAnimationPlayer* AnimationPlayer;
233 
234  bool OverrideStillRender;
235 
236 private:
237  vtkSMAnimationScene(const vtkSMAnimationScene&) = delete;
238  void operator=(const vtkSMAnimationScene&) = delete;
239 
240  class vtkInternals;
241  vtkInternals* Internals;
242  unsigned long TimeRangeObserverID;
243  unsigned long TimestepValuesObserverID;
244 };
245 
246 #endif
static vtkAnimationCue * New()
virtual void Tick(double currenttime, double deltatime, double clocktime)
Superclass for all view proxies.
This is composite animation player that can me made to play an animation using the active player...
#define PARAVIEW_DEPRECATED_IN_5_13_0(reason)
void SetSceneTime(double time)
Sets the current animation time.
virtual void Initialize()
animation scene for ParaView.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
#define VTKREMOTINGANIMATION_EXPORT
#define const
Definition: zconf.h:238
#define PARAVIEW_DEPRECATED_IN_6_0_0(reason)
object for general options.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE