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 "vtkRemotingAnimationModule.h" // needed for exports
28 
31 class vtkSMProxy;
32 class vtkSMViewProxy;
33 
35 {
36 public:
37  static vtkSMAnimationScene* New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42 
46  void AddCue(vtkAnimationCue* cue);
47  void RemoveCue(vtkAnimationCue* cue);
48  void RemoveAllCues();
49  int GetNumberOfCues();
51 
53 
58  void AddViewProxy(vtkSMViewProxy* proxy);
59  void RemoveViewProxy(vtkSMViewProxy* proxy);
60  void RemoveAllViewProxies();
62 
64 
67  unsigned int GetNumberOfViewProxies();
68  vtkSMViewProxy* GetViewProxy(unsigned int cc);
70 
72 
76  void SetTimeKeeper(vtkSMProxy*);
77  vtkGetObjectMacro(TimeKeeper, vtkSMProxy);
79 
81 
85  vtkSetMacro(LockStartTime, bool);
86  vtkGetMacro(LockStartTime, bool);
87  vtkBooleanMacro(LockStartTime, bool);
89 
91 
95  vtkSetMacro(LockEndTime, bool);
96  vtkGetMacro(LockEndTime, bool);
97  vtkBooleanMacro(LockEndTime, bool);
99 
101 
104  void SetSceneTime(double time)
105  {
106  if (this->InTick)
107  {
108  // Since this method can be called during a Tick() event handler.
109  return;
110  }
111  this->Initialize();
112  this->Tick(time, 0, time);
113  }
115 
116  // Get the time of the most recent tick.
117  // The only difference between this and AnimationTime (or ClockTime) defined
118  // in the superclass is that, unlike the latter this is defined even outside
119  // AnimationCueTickEvent handlers.
120  vtkGetMacro(SceneTime, double);
121 
123 
133  vtkSetVector2Macro(PlaybackTimeWindow, double);
134  vtkGetVector2Macro(PlaybackTimeWindow, double);
136 
141  void SanitizeFrameWindow(int frameWindow[2], double timeWindow[2]);
142 
144 
147  void SetLoop(int val);
148  int GetLoop();
149  void Play();
150  void Reverse();
151  void Stop();
152  void GoToNext();
153  void GoToPrevious();
154  void GoToFirst();
155  void GoToLast();
156  void SetPlayMode(int val);
157  int GetPlayMode();
158  void SetNumberOfFrames(int val);
159  int GetNumberOfFrames();
160 
161  void SetFramesPerTimestep(int val);
162  void SetStride(int val);
163  int GetStride();
164  bool GetInPlay();
166 
167  enum
168  {
169  // Fired whenever the vtkAnimationScene wants to request the
170  // vtkSMAnimationSceneProxy to update the start/end times.
171  // The calldata is a vtkVector2d with the suggested time-range.
172  UpdateStartEndTimesEvent = vtkCommand::UserEvent
173  };
174 
176 
181  vtkSetMacro(ForceDisableCaching, bool);
182  vtkGetMacro(ForceDisableCaching, bool);
184 
190  vtkSetMacro(OverrideStillRender, bool);
191  vtkGetMacro(OverrideStillRender, bool);
192 
193 protected:
195  ~vtkSMAnimationScene() override;
196 
198 
202  void StartCueInternal() override;
203  void TickInternal(double currenttime, double deltatime, double clocktime) override;
204  void EndCueInternal() override;
206 
208 
211  void TimeKeeperTimeRangeChanged();
212  void TimeKeeperTimestepsChanged();
214 
217  bool InTick;
218  double SceneTime;
219  double PlaybackTimeWindow[2];
224 
226 
227 private:
228  vtkSMAnimationScene(const vtkSMAnimationScene&) = delete;
229  void operator=(const vtkSMAnimationScene&) = delete;
230 
231  class vtkInternals;
232  vtkInternals* Internals;
233  unsigned long TimeRangeObserverID;
234  unsigned long TimestepValuesObserverID;
235 };
236 
237 #endif
virtual void EndCueInternal()
static vtkAnimationCue * New()
virtual void Tick(double currenttime, double deltatime, double clocktime)
vtkEventForwarderCommand * Forwarder
Superclass for all view proxies.
vtkCompositeAnimationPlayer * AnimationPlayer
This is composite animation player that can me made to play an animation using the active player...
virtual void TickInternal(double currenttime, double deltatime, double clocktime)
virtual void StartCueInternal()
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
void operator=(const vtkObjectBase &)
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE