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 
34 class VTKREMOTINGANIMATION_EXPORT vtkSMAnimationScene : public vtkAnimationCue
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 
138 
141  void SetLoop(int val);
142  int GetLoop();
143  void Play();
144  void Reverse();
145  void Stop();
146  void GoToNext();
147  void GoToPrevious();
148  void GoToFirst();
149  void GoToLast();
150  void SetPlayMode(int val);
151  int GetPlayMode();
152  void SetNumberOfFrames(int val);
153  void SetDuration(int val);
154  void SetFramesPerTimestep(int val);
155  void SetStride(int val);
157 
158  enum
159  {
160  // Fired whenever the vtkAnimationScene wants to request the
161  // vtkSMAnimationSceneProxy to update the start/end times.
162  // The calldata is a vtkVector2d with the suggested time-range.
163  UpdateStartEndTimesEvent = vtkCommand::UserEvent
164  };
165 
167 
172  vtkSetMacro(ForceDisableCaching, bool);
173  vtkGetMacro(ForceDisableCaching, bool);
175 
181  vtkSetMacro(OverrideStillRender, bool);
182  vtkGetMacro(OverrideStillRender, bool);
183 
185 
189  static void SetGlobalUseGeometryCache(bool);
190  static bool GetGlobalUseGeometryCache();
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  static bool GlobalUseGeometryCache;
237 };
238 
239 #endif
vtkSMAnimationScene::SceneTime
double SceneTime
Definition: vtkSMAnimationScene.h:218
vtkAnimationCue::StartCueInternal
virtual void StartCueInternal()
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkSMAnimationScene::ForceDisableCaching
bool ForceDisableCaching
Definition: vtkSMAnimationScene.h:220
vtkSMAnimationScene
animation scene for ParaView.
Definition: vtkSMAnimationScene.h:34
vtkAnimationCue::Tick
virtual void Tick(double currenttime, double deltatime, double clocktime)
vtkCompositeAnimationPlayer
Definition: vtkCompositeAnimationPlayer.h:22
vtkAnimationCue::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
time
time
vtkCommand.h
vtkSMAnimationScene::InTick
bool InTick
Definition: vtkSMAnimationScene.h:217
vtkSMProxy
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
vtkAnimationCue.h
vtkAnimationCue::EndCueInternal
virtual void EndCueInternal()
vtkIndent
vtkAnimationCue::TickInternal
virtual void TickInternal(double currenttime, double deltatime, double clocktime)
vtkAnimationCue
vtkAnimationCue::New
static vtkAnimationCue * New()
vtkSMAnimationScene::LockStartTime
bool LockStartTime
Definition: vtkSMAnimationScene.h:215
vtkSMViewProxy
Superclass for all view proxies.
Definition: vtkSMViewProxy.h:42
vtkSMAnimationScene::TimeKeeper
vtkSMProxy * TimeKeeper
Definition: vtkSMAnimationScene.h:221
vtkAnimationCue::Initialize
virtual void Initialize()
vtkSMAnimationScene::SetSceneTime
void SetSceneTime(double time)
Sets the current animation time.
Definition: vtkSMAnimationScene.h:104
vtkSMAnimationScene::Forwarder
vtkEventForwarderCommand * Forwarder
Definition: vtkSMAnimationScene.h:223
vtkEventForwarderCommand
vtkSMAnimationScene::LockEndTime
bool LockEndTime
Definition: vtkSMAnimationScene.h:216
vtkSMAnimationScene::OverrideStillRender
bool OverrideStillRender
Definition: vtkSMAnimationScene.h:225
vtkSMAnimationScene::AnimationPlayer
vtkCompositeAnimationPlayer * AnimationPlayer
Definition: vtkSMAnimationScene.h:222