Commit 2f87cd16 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit
Browse files

ENH: ParaView no longer uses vtkAnimationScene, instead created new

vtkPVAnimationScene which is directly a subclass of vtkAnimationCue which uses
animation players (vtkAnimationPlayer) subclasses to play the animation
separating the scene playing logic from the scene.

Now the time for each tick given by the vtkPVAnimationScene is indeed the
animation time irrespective of play mode (unlike before when the
StartTime/EndTime changed based on play mode).

ParaView now uses cue proxies that define the manipulator as a subproxy making
it easier to create cues. Added a new cue for pipeline time which is added by
default to animate the time keeper's time property. This cue has a mode in which
all keframes are disabled, instead it directly uses the animation clock time to
update the animated property.

ENH: vtkAnimationCue provides information about the animation clock time in each
tick.
parent 90944d08
......@@ -17,7 +17,7 @@
#include "vtkObjectFactory.h"
#include "vtkCommand.h"
vtkCxxRevisionMacro(vtkAnimationCue, "1.7");
vtkCxxRevisionMacro(vtkAnimationCue, "1.8");
vtkStandardNewMacro(vtkAnimationCue);
//----------------------------------------------------------------------------
......@@ -28,6 +28,7 @@ vtkAnimationCue::vtkAnimationCue()
this->TimeMode = TIMEMODE_RELATIVE;
this->AnimationTime = 0;
this->DeltaTime = 0;
this->ClockTime = 0;
}
//----------------------------------------------------------------------------
......@@ -43,6 +44,7 @@ void vtkAnimationCue::StartCueInternal()
info.EndTime = this->EndTime;
info.AnimationTime = 0.0;
info.DeltaTime = 0.0;
info.ClockTime = 0.0;
this->InvokeEvent(vtkCommand::StartAnimationCueEvent, &info);
}
......@@ -54,30 +56,35 @@ void vtkAnimationCue::EndCueInternal()
info.EndTime = this->EndTime;
info.AnimationTime = this->EndTime;
info.DeltaTime = 0.0;
info.ClockTime = 0.0;
this->InvokeEvent(vtkCommand::EndAnimationCueEvent, &info);
}
//----------------------------------------------------------------------------
void vtkAnimationCue::TickInternal(double currenttime, double deltatime)
void vtkAnimationCue::TickInternal(
double currenttime, double deltatime, double clocktime)
{
vtkAnimationCue::AnimationCueInfo info;
info.StartTime = this->StartTime;
info.EndTime = this->EndTime;
info.DeltaTime = deltatime;
info.AnimationTime = currenttime;
info.ClockTime =clocktime;
this->AnimationTime = currenttime;
this->DeltaTime = deltatime;
this->ClockTime = clocktime;
this->InvokeEvent(vtkCommand::AnimationCueTickEvent, &info);
this->AnimationTime = 0;
this->DeltaTime = 0;
this->ClockTime = 0;
}
//----------------------------------------------------------------------------
void vtkAnimationCue::Tick(double currenttime, double deltatime)
void vtkAnimationCue::Tick(double currenttime, double deltatime, double clocktime)
{
// Check to see if we have crossed the Cue start.
if (currenttime >= this->StartTime &&
......@@ -93,7 +100,7 @@ void vtkAnimationCue::Tick(double currenttime, double deltatime)
{
if (currenttime <= this->EndTime)
{
this->TickInternal(currenttime, deltatime);
this->TickInternal(currenttime, deltatime, clocktime);
}
if (currenttime >= this->EndTime)
{
......@@ -135,4 +142,5 @@ void vtkAnimationCue::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "TimeMode: " << this->TimeMode << endl;
os << indent << "AnimationTime: " << this->AnimationTime << endl;
os << indent << "DeltaTime: " << this->DeltaTime << endl;
os << indent << "ClockTime: " << this->ClockTime << endl;
}
......@@ -57,8 +57,9 @@ public:
public:
double StartTime;
double EndTime;
double AnimationTime;// valid only on AnimationCueTickEvent
double DeltaTime; // valid only on AnimationCueTickEvent
double AnimationTime;// valid only in AnimationCueTickEvent handler
double DeltaTime; // valid only in AnimationCueTickEvent handler
double ClockTime; // valid only in AnimationCueTickEvent handler
};
//ETX
......@@ -111,9 +112,11 @@ public:
// deltatime is the time since last call to Tick. deltatime also can be in seconds
// relative to the start of the container Scene or normalized depending upon the
// cue's Time mode.
// clocktime is the time from the scene i.e. it does not depend on the time
// mode for the cue.
// For the first call to Tick
// after a call to Initialize(), the deltatime is 0;
virtual void Tick(double currenttime, double deltatime);
virtual void Tick(double currenttime, double deltatime, double clocktime);
// Description:
// Called when the playing of the scene begins.
......@@ -137,6 +140,14 @@ public:
// Before firing the event the animation cue sets the DeltaTime
// to the difference in time between the current tick and the last tick.
vtkGetMacro(DeltaTime, double);
// Description:
// This is valid only in a AnimationCueTickEvent handler.
// Before firing the event the animation cue sets the ClockTime to
// the time of the tick. ClockTime is directly the time from the animation
// scene neither normalized nor offsetted to the start of the scene.
vtkGetMacro(ClockTime, double);
//BTX
enum TimeCodes
{
......@@ -163,6 +174,7 @@ protected:
// the AnimationCueInfo struct in wrapped languages.
double AnimationTime;
double DeltaTime;
double ClockTime;
// Description:
// Current state of the Cue.
......@@ -173,7 +185,8 @@ protected:
// corresponding events. Subclasses can override these to
// do extra processing at start/end or on tick.
virtual void StartCueInternal();
virtual void TickInternal(double currenttime, double deltatime);
virtual void TickInternal(double currenttime, double deltatime,
double clocktime);
virtual void EndCueInternal();
private:
......
......@@ -20,7 +20,7 @@
#include "vtkObjectFactory.h"
#include "vtkTimerLog.h"
vtkCxxRevisionMacro(vtkAnimationScene, "1.14");
vtkCxxRevisionMacro(vtkAnimationScene, "1.15");
vtkStandardNewMacro(vtkAnimationScene);
//----------------------------------------------------------------------------
......@@ -179,7 +179,7 @@ void vtkAnimationScene::Play()
double deltatime = 0.0;
do
{
this->Tick(currenttime, deltatime);
this->Tick(currenttime, deltatime, currenttime);
// needed to compute delta times.
double previous_tick_time = currenttime;
......@@ -227,9 +227,11 @@ void vtkAnimationScene::Stop()
}
//----------------------------------------------------------------------------
void vtkAnimationScene::TickInternal(double currenttime, double deltatime)
void vtkAnimationScene::TickInternal(
double currenttime, double deltatime, double clocktime)
{
this->AnimationTime = currenttime;
this->ClockTime = clocktime;
vtkCollectionIterator* iter = this->AnimationCuesIterator;
for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
......@@ -241,18 +243,21 @@ void vtkAnimationScene::TickInternal(double currenttime, double deltatime)
switch(cue->GetTimeMode())
{
case vtkAnimationCue::TIMEMODE_RELATIVE:
cue->Tick(currenttime - this->StartTime, deltatime);
cue->Tick(currenttime - this->StartTime, deltatime, clocktime);
break;
case vtkAnimationCue::TIMEMODE_NORMALIZED:
cue->Tick( (currenttime - this->StartTime) / (this->EndTime - this->StartTime),
deltatime / (this->EndTime - this->StartTime));
deltatime / (this->EndTime - this->StartTime), clocktime);
break;
default:
vtkErrorMacro("Invalid cue time mode");
}
}
}
this->Superclass::TickInternal(currenttime, deltatime);
this->Superclass::TickInternal(currenttime, deltatime, clocktime);
}
//----------------------------------------------------------------------------
......@@ -278,7 +283,7 @@ void vtkAnimationScene::SetAnimationTime(double currenttime)
return;
}
this->Initialize();
this->Tick(currenttime,0.0);
this->Tick(currenttime, 0.0, currenttime);
if (this->CueState == vtkAnimationCue::INACTIVE)
{
this->Finalize();
......
......@@ -110,7 +110,7 @@ protected:
// Description:
// Called on every valid tick.
// Calls ticks on all the contained cues.
virtual void TickInternal(double currenttime, double deltatime);
virtual void TickInternal(double currenttime, double deltatime, double clocktime);
virtual void StartCueInternal();
virtual void EndCueInternal();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment