You.i Engine
CYIAbstractTimeline Class Reference

Detailed Description

The base class for the timeline framework.

This class provides an interface for any timeline or timeline group. The basic operations that can be performed on any item in the timeline framework include the playback methods, as well as the ability to query duration, direction, and amount completed.

This class cannot be instantiated.

#include <animation/YiAbstractTimeline.h>

Inheritance diagram for CYIAbstractTimeline:

Public Types

enum  FrameMode : uint8_t {
  FrameMode::Absolute,
  FrameMode::Relative
}
 
enum  Status : uint8_t {
  Status::Stopped,
  Status::Playing
}
 
enum  Direction : uint8_t {
  Direction::Forward,
  Direction::Reverse
}
 

Public Member Functions

virtual ~CYIAbstractTimeline ()
 
void Start ()
 
void Finish ()
 
void Pause ()
 
void Continue ()
 
void SetDirection (Direction direction)
 
Direction GetDirection () const
 
Status GetStatus () const
 
uint64_t GetStartTime () const
 
uint64_t GetCurrentTime () const
 
float GetTimeAsPercentage () const
 
uint64_t GetTotalTime () const
 
void SeekToPercentage (float percentage)
 
void SeekToTime (uint64_t millis)
 
void Abort ()
 
void SetDisablesInput (bool disablesInput)
 
void Track ()
 
void Untrack ()
 
void StartForward ()
 
void StartReverse ()
 
void ContinueForward ()
 
void ContinueReverse ()
 
void SetDirectionForward ()
 
void SetDirectionReverse ()
 
void SetFrameModes (FrameMode startFrameMode, FrameMode endFrameMode)
 
bool SetSourcePositions (CYISceneNode *pNode, const glm::vec3 &position)
 
bool ClearSourcePositions (CYISceneNode *pNode)
 
bool SetTargetPositions (CYISceneNode *pNode, const glm::vec3 &position)
 
bool ClearTargetPositions (CYISceneNode *pNode)
 
bool SetSourceScales (CYISceneNode *pNode, const glm::vec3 &scale)
 
bool ClearSourceScales (CYISceneNode *pNode)
 
void SetLooping (bool isLooping)
 
bool GetLooping () const
 
const std::shared_ptr< CYITimelineProxy > & GetProxy () const
 
void SetRootNode (CYISceneNode *pRootNode)
 
const std::shared_ptr< CYISceneNodeProxy > & GetRootNode () const
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Public Attributes

CYISignal Playing
 called whenever the timeline starts playing (from any position) More...
 
CYISignal Paused
 called whenever the timeline stops playing, including if the timeline execution completes normally More...
 
CYISignal Aborted
 called when the timeline execution is aborted by the Abort() function More...
 
CYISignal Started
 called when playback of the timeline is initiated by one of the Start() functions More...
 
CYISignal Completed
 called when playback of the timeline completes normally (or when the Finish() function is called) More...
 
CYISignal TimelineLooped
 called whenever a loop completes and the next loop starts More...
 
CYISignal PlayingForward
 same as Playing, but triggered only when direction is forward More...
 
CYISignal PlayingReverse
 same as Playing, but triggered only when direction is reverse More...
 
CYISignal PausedForward
 same as Paused, but triggered only when direction is forward More...
 
CYISignal PausedReverse
 same as Paused, but triggered only when direction is reverse More...
 
CYISignal StartedForward
 same as Started, but triggered only when direction is forward More...
 
CYISignal StartedReverse
 same as Started, but triggered only when direction is reverse More...
 
CYISignal CompletedForward
 same as Completed, but triggered only when direction is forward More...
 
CYISignal CompletedReverse
 same as Completed, but triggered only when direction is reverse More...
 

Protected Member Functions

 CYIAbstractTimeline (std::unique_ptr< CYIAbstractTimelinePriv > pPriv)
 

Protected Attributes

std::unique_ptr< CYIAbstractTimelinePriv > m_pPriv
 

Friends

class CYITimelineGroup
 
class CYISerialTimelineGroup
 
class CYIParallelTimelineGroup
 
class CYITimelineLoop
 

Member Enumeration Documentation

◆ Direction

enum CYIAbstractTimeline::Direction : uint8_t
strong

The current direction of playback for this timeline

Enumerator
Forward 
Reverse 

◆ FrameMode

enum CYIAbstractTimeline::FrameMode : uint8_t
strong

A frame mode, which is used to indicate how a frame's value should be interpreted.

Enumerator
Absolute 

The frame's value is absolute and should be used as-is.

Relative 

The frame's value is relative to another value.

◆ Status

enum CYIAbstractTimeline::Status : uint8_t
strong

The current playing status of this timeline

Enumerator
Stopped 
Playing 

Constructor & Destructor Documentation

◆ ~CYIAbstractTimeline()

virtual CYIAbstractTimeline::~CYIAbstractTimeline ( )
virtual

◆ CYIAbstractTimeline()

CYIAbstractTimeline::CYIAbstractTimeline ( std::unique_ptr< CYIAbstractTimelinePriv >  pPriv)
protected

Member Function Documentation

◆ Abort()

void CYIAbstractTimeline::Abort ( )

Pauses this timeline at its current execution point. Does not reset position. Unlike Pause(), this function does not trigger the PausedSig signals. Instead, the Aborted signal is triggered.

◆ ClearSourcePositions()

bool CYIAbstractTimeline::ClearSourcePositions ( CYISceneNode pNode)

A helper function to remove the source value of any track that uses the target node pNode and affects nodes' position. Has no effect if no track has the provided target node and affects positions.

Note
If this timeline represents a timeline group, the ClearSourcePositions function will be called recursively on all of its children.
Returns
true if any of the tracks in this timeline (or child timelines) were affected.
See also
SetSourcePositions

◆ ClearSourceScales()

bool CYIAbstractTimeline::ClearSourceScales ( CYISceneNode pNode)

A helper function to remove the source value of any track that uses the target node pNode and affects nodes' scale. Has no effect if no track has the provided target node and affects scale.

Note
If this timeline represents a timeline group, the ClearSourceScales function will be called recursively on all of its children.
Returns
true if any of the tracks in this timeline (or child timelines) were affected.
See also
SetSourceScales

◆ ClearTargetPositions()

bool CYIAbstractTimeline::ClearTargetPositions ( CYISceneNode pNode)

A helper function to remove the target value of any track that uses the target node pNode and affects nodes' position. Has no effect if no track has the provided target node and affects positions.

Note
If this timeline represents a timeline group, the ClearTargetPositions function will be called recursively on all of its children.
Returns
true if any of the tracks in this timeline (or child timelines) were affected.
See also
SetTargetPositions

◆ Continue()

void CYIAbstractTimeline::Continue ( )

Resumes playback of this timeline from the current execution point in the current direction. The PlaySig signal will be triggered, along with the PlayForwardSig or PlayReverseSig signal (depending on the current direction.)

◆ ContinueForward()

void CYIAbstractTimeline::ContinueForward ( )

Resumes playback of this timeline from the current execution point in the forward direction. This is equivalent to calling "SetDirection(Direction::Forward); Continue();". The PlaySig and PlayForwardSig signals will be triggered.

◆ ContinueReverse()

void CYIAbstractTimeline::ContinueReverse ( )

Resumes playback of this timeline from the current execution point in the reverse direction. This is equivalent to calling "SetDirection(Direction::Reverse); Continue();". The PlaySig and PlayReverseSig signals will be triggered.

◆ Finish()

void CYIAbstractTimeline::Finish ( )

Stops playback of this timeline and moves to the end of the timeline (or beginning, depending on the playback direction). The Paused and Completed signals will be triggered, along with either PausedForward and CompletedForward, or PausedReverse and CompletedReverse (depending on the current direction).

◆ GetCurrentTime()

uint64_t CYIAbstractTimeline::GetCurrentTime ( ) const

Returns the current position in this timeline, in milliseconds.

◆ GetDirection()

Direction CYIAbstractTimeline::GetDirection ( ) const

Returns the current direction of the timeline.

◆ GetLooping()

bool CYIAbstractTimeline::GetLooping ( ) const

Gets whether the timeline is set to loop indefinitely.

◆ GetProxy()

const std::shared_ptr<CYITimelineProxy>& CYIAbstractTimeline::GetProxy ( ) const

Returns a proxy object which protects the caller against deletion of the CYITimeline object. This should only be used from non-UI threads.

◆ GetRootNode()

const std::shared_ptr<CYISceneNodeProxy>& CYIAbstractTimeline::GetRootNode ( ) const

Returns the root scene node that this timeline is associated with.

See also
SetRootNode

◆ GetStartTime()

uint64_t CYIAbstractTimeline::GetStartTime ( ) const

Returns the start time for this timeline. It is important to note that the time will be in the time space of the backing store attached to this timeline.

◆ GetStatus()

Status CYIAbstractTimeline::GetStatus ( ) const

Returns the current status of the timeline.

◆ GetTimeAsPercentage()

float CYIAbstractTimeline::GetTimeAsPercentage ( ) const

Calculates and returns the percentage of the current position of the timeline. Returns values between 0.0 and 1.0 inclusively.

◆ GetTotalTime()

uint64_t CYIAbstractTimeline::GetTotalTime ( ) const

Returns the length of this timeline in milliseconds.

◆ Pause()

void CYIAbstractTimeline::Pause ( )

Pauses this timeline at its current execution point. Does not reset position. The Paused signal will be triggered, along with the PausedForward or PausedReverse signal (depending on the current direction.)

◆ SeekToPercentage()

void CYIAbstractTimeline::SeekToPercentage ( float  percentage)

Seeks to the given percentage within the timeline. Values of percentage must be between 0.0 and 1.0.

Warning
This function ignores the playback direction of the timeline.

◆ SeekToTime()

void CYIAbstractTimeline::SeekToTime ( uint64_t  millis)

Seeks to the given time within the timeline. Values of millis < 0 will be interpreted as 0. Values of millis > total time will be interpreted as total time.

Warning
This function ignores the playback direction of the timeline.

◆ SetDirection()

void CYIAbstractTimeline::SetDirection ( Direction  direction)

Sets the playback direction to the provided direction. Changing the playback direction of a currently-playing timeline may result in unexpected behaviours.

◆ SetDirectionForward()

void CYIAbstractTimeline::SetDirectionForward ( )

Sets the playback direction to Forward. Changing the playback direction of a currently-playing timeline may result in unexpected behaviours.

◆ SetDirectionReverse()

void CYIAbstractTimeline::SetDirectionReverse ( )

Sets the playback direction to Reverse. Changing the playback direction of a currently-playing timeline may result in unexpected behaviours.

◆ SetDisablesInput()

void CYIAbstractTimeline::SetDisablesInput ( bool  disablesInput)

Set disables input setting

◆ SetFrameModes()

void CYIAbstractTimeline::SetFrameModes ( FrameMode  startFrameMode,
FrameMode  endFrameMode 
)

Sets the frame modes for the start and end frames of this timeline to startFrameMode and endFrameMode.

Note
If this timeline represents a timeline group, the SetFrameModes function will be called recursively on all of its children.
Warning
Setting both startFrameMode and endFrameMode to CYIAbstractTimeline::FrameMode::Relative is not supported and will result in undefined behaviour.
See also
CYIAbstractTimeline::FrameMode
CYITimeline

◆ SetLooping()

void CYIAbstractTimeline::SetLooping ( bool  isLooping)

Sets the timeline to loop indefinitely.

◆ SetRootNode()

void CYIAbstractTimeline::SetRootNode ( CYISceneNode pRootNode)

Sets the root scene node that this timeline is associated with. This is typically the owner of the timeline.

See also
GetRootNode
CYISceneView::GetTimeline(CYIStringView, CYISceneView::TimelineGetMode)
CYITimelineTrack::GetTargetID

◆ SetSourcePositions()

bool CYIAbstractTimeline::SetSourcePositions ( CYISceneNode pNode,
const glm::vec3 &  position 
)

A helper function to set the source value of any track that uses the target node pNode and affects nodes' position to position. Has no effect if no track has the provided target node and affects positions.

Note
If this timeline represents a timeline group, the SetSourcePositions function will be called recursively on all of its children.
Calling this function is equivalent to calling CYITimeline::SetTrackSource on each of the child CYITimeline instances which have the attribute types CYITimelineTrack::AttributeType::Position, CYITimelineTrack::AttributeType::SeparatedPositionX, CYITimelineTrack::AttributeType::SeparatedPositionY and CYITimelineTrack::AttributeType::SeparatedPositionZ.
Returns
true if any of the tracks in this timeline (or child timelines) were affected.
See also
CYITimeline::SetTrackSource(CYISceneNode *pNode, CYITimelineTrack::AttributeType type, const CYIVariant &source)

◆ SetSourceScales()

bool CYIAbstractTimeline::SetSourceScales ( CYISceneNode pNode,
const glm::vec3 &  scale 
)

A helper function to set the source value of any track that uses the target node pNode and affects nodes' scale to scale. Has no effect if no track has the provided target node and affects scale.

Note
If this timeline represents a timeline group, the SetSourceScales function will be called recursively on all of its children.
Returns
true if any of the tracks in this timeline (or child timelines) were affected.

◆ SetTargetPositions()

bool CYIAbstractTimeline::SetTargetPositions ( CYISceneNode pNode,
const glm::vec3 &  position 
)

A helper function to set the target value of any track that uses the target node pNode and affects nodes' position to position. Has no effect if no track has the provided target node and affects positions.

Note
If this timeline represents a timeline group, the SetTargetPositions function will be called recursively on all of its children.
Calling this function is equivalent to calling CYITimeline::SetTrackTarget on each of the child CYITimeline instances which have the attribute types CYITimelineTrack::AttributeType::Position, CYITimelineTrack::AttributeType::SeparatedPositionX, CYITimelineTrack::AttributeType::SeparatedPositionY and CYITimelineTrack::AttributeType::SeparatedPositionZ.
Returns
true if any of the tracks in this timeline (or child timelines) were affected.
See also
CYITimeline::SetTrackTarget(CYISceneNode *pNode, CYITimelineTrack::AttributeType type, const CYIVariant &target)

◆ Start()

void CYIAbstractTimeline::Start ( )

Starts playback of this timeline from the beginning (or from the end if the current direction is Reverse). The Playing and Started signals will be triggered, along with either PlayingForward and StartedForward, or PlayingReverse and StartedReverse (depending on the current direction). Paused signals will NOT be triggered.

◆ StartForward()

void CYIAbstractTimeline::StartForward ( )

Start playback of this timeline from the beginning in the forward direction. The PlaySig, PlayForwardSig, Started and StartedForward signals will be triggered. This is equivalent to calling "SetDirection(Direction::Forward); Start();".

◆ StartReverse()

void CYIAbstractTimeline::StartReverse ( )

Start playback of this timeline from the beginning in the reverse direction. The PlaySig, PlayReverseSig, Started and StartedReverse signals will be triggered. This is equivalent to calling "SetDirection(Direction::Reverse); Start();".

◆ Track()

void CYIAbstractTimeline::Track ( )

Starts tracking a timeline and all its updates. A log message will be printed on the console You can use Untrack() to stop tracking a timeline.

Note: The following attributes will not be tracked:

◆ Untrack()

void CYIAbstractTimeline::Untrack ( )

Friends And Related Function Documentation

◆ CYIParallelTimelineGroup

friend class CYIParallelTimelineGroup
friend

◆ CYISerialTimelineGroup

friend class CYISerialTimelineGroup
friend

◆ CYITimelineGroup

friend class CYITimelineGroup
friend

◆ CYITimelineLoop

friend class CYITimelineLoop
friend

Member Data Documentation

◆ Aborted

CYISignal CYIAbstractTimeline::Aborted

called when the timeline execution is aborted by the Abort() function

◆ Completed

CYISignal CYIAbstractTimeline::Completed

called when playback of the timeline completes normally (or when the Finish() function is called)

◆ CompletedForward

CYISignal CYIAbstractTimeline::CompletedForward

same as Completed, but triggered only when direction is forward

◆ CompletedReverse

CYISignal CYIAbstractTimeline::CompletedReverse

same as Completed, but triggered only when direction is reverse

◆ m_pPriv

std::unique_ptr<CYIAbstractTimelinePriv> CYIAbstractTimeline::m_pPriv
protected

◆ Paused

CYISignal CYIAbstractTimeline::Paused

called whenever the timeline stops playing, including if the timeline execution completes normally

◆ PausedForward

CYISignal CYIAbstractTimeline::PausedForward

same as Paused, but triggered only when direction is forward

◆ PausedReverse

CYISignal CYIAbstractTimeline::PausedReverse

same as Paused, but triggered only when direction is reverse

◆ Playing

CYISignal CYIAbstractTimeline::Playing

called whenever the timeline starts playing (from any position)

◆ PlayingForward

CYISignal CYIAbstractTimeline::PlayingForward

same as Playing, but triggered only when direction is forward

◆ PlayingReverse

CYISignal CYIAbstractTimeline::PlayingReverse

same as Playing, but triggered only when direction is reverse

◆ Started

CYISignal CYIAbstractTimeline::Started

called when playback of the timeline is initiated by one of the Start() functions

◆ StartedForward

CYISignal CYIAbstractTimeline::StartedForward

same as Started, but triggered only when direction is forward

◆ StartedReverse

CYISignal CYIAbstractTimeline::StartedReverse

same as Started, but triggered only when direction is reverse

◆ TimelineLooped

CYISignal CYIAbstractTimeline::TimelineLooped

called whenever a loop completes and the next loop starts


The documentation for this class was generated from the following file: