NAP
Public Member Functions | Public Attributes | List of all members
SequenceEditor Class Reference

#include <sequenceeditor.h>

Public Member Functions

 SequenceEditor (SequenceService &service)
 
bool init (utility::ErrorState &errorState) override
 
void save (const std::string &file)
 
void load (const std::string &file)
 
void changeSequenceDuration (double newDuration)
 
SequenceControllergetControllerWithTrackType (rtti::TypeInfo trackType)
 
SequenceControllergetControllerWithTrackID (const std::string &trackID)
 
template<typename T >
T & getController ()
 
void insertMarker (double time, const std::string &message)
 
void changeMarkerTime (const std::string &markerID, double time)
 
void deleteMarker (const std::string &markerID)
 
void changeMarkerMessage (const std::string &markerID, const std::string &markerMessage)
 
void takeSnapshot (rtti::TypeInfo actionType)
 
void undo ()
 
void redo ()
 
void jumpToHistoryPointIndex (int index)
 
void clearHistory ()
 
const std::deque< std::unique_ptr< SequenceEditorHistoryPoint > > & getHistory () const
 
size_t getHistoryIndex () const
 
size_t getHistorySize () const
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

ResourcePtr< SequencePlayermSequencePlayer = nullptr
 Property: 'Sequence Player' ResourcePtr to the sequence player. More...
 
int mUndoSteps = 100
 Property: 'Undo Steps' number of undo steps to store. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

The SequenceEditor is responsible for editing the sequence (model) and makes sure the model stays valid during editing. It also holds a resource ptr to a player, to make sure that editing the sequence stays thread safe.

Inheritance diagram for SequenceEditor:
[legend]
Collaboration diagram for SequenceEditor:
[legend]

Constructor & Destructor Documentation

◆ SequenceEditor()

Member Function Documentation

◆ changeMarkerMessage()

void changeMarkerMessage ( const std::string &  markerID,
const std::string &  markerMessage 
)

changes marker message of specified marker id, asserts when marker not found

Parameters
markerIDthe id of the marker to edit
markerMessageconst reference to string value of marker message

◆ changeMarkerTime()

void changeMarkerTime ( const std::string &  markerID,
double  time 
)

changes marker time, assert when markerID not found

Parameters
markerIDthe id of the marker
timethe new time in seconds for the marker

◆ changeSequenceDuration()

void changeSequenceDuration ( double  newDuration)

changes sequence duration

Parameters
newDurationnew duration of sequence

◆ clearHistory()

void clearHistory ( )

Clears all stored history points

◆ deleteMarker()

void deleteMarker ( const std::string &  markerID)

deletes marker with specified id, assert when markerID not found

Parameters
markerIDthe id of the marker to delete

◆ getController()

T& getController ( )

Gets reference the controller for a type, performs static cast

Template Parameters
Ttype of controller
Returns
reference to controller type

◆ getControllerWithTrackID()

SequenceController* getControllerWithTrackID ( const std::string &  trackID)

Returns pointer to base class of controller type that is used for specified track type of track id Return null when track is not found, or controller is not found

Parameters
trackIDthe track id of the track to find controller for
Returns
ptr to controller base class, null ptr when not found

◆ getControllerWithTrackType()

SequenceController* getControllerWithTrackType ( rtti::TypeInfo  trackType)

Returns pointer to base class of controller type, asserts when type not found

Parameters
trackTyperttr::type information of controller type to be returned
Returns
ptr to controller base class, null ptr when not found

◆ getHistory()

const std::deque<std::unique_ptr<SequenceEditorHistoryPoint> >& getHistory ( ) const

Returns const reference to history

Returns
const reference to history

◆ getHistoryIndex()

size_t getHistoryIndex ( ) const

Returns current history index

Returns
current history index

◆ getHistorySize()

size_t getHistorySize ( ) const

Returns history size

Returns
history size

◆ init()

bool init ( utility::ErrorState errorState)
overridevirtual

initializes editor

Parameters
errorStatecontains any errors
Returns
returns true on successful initialization

Reimplemented from Object.

◆ insertMarker()

void insertMarker ( double  time,
const std::string &  message 
)

inserts marker at given time in seconds

Parameters
timethe time at where to insert the new marker in seconds
messageconst reference to the message that the new marker should contain

◆ jumpToHistoryPointIndex()

void jumpToHistoryPointIndex ( int  index)

Jumps to given index of history. If index is not valid, does nothing

Parameters
index

◆ load()

void load ( const std::string &  file)

loads sequence of file

Parameters
filefilename

◆ redo()

void redo ( )

Loads next history point and deserializes the binary sequence

◆ save()

void save ( const std::string &  file)

saves sequence of player to file

Parameters
filefilename

◆ takeSnapshot()

void takeSnapshot ( rtti::TypeInfo  actionType)

Serializes current sequence into binary format. Creates history point with current date and time and takes type info and stores it.

Parameters
actionTypeaction that calls the method

◆ undo()

void undo ( )

Loads previous history point and deserializes the binary sequence

Member Data Documentation

◆ mSequencePlayer

ResourcePtr<SequencePlayer> mSequencePlayer = nullptr

Property: 'Sequence Player' ResourcePtr to the sequence player.

◆ mUndoSteps

int mUndoSteps = 100

Property: 'Undo Steps' number of undo steps to store.