Emergency 20 Dokumentation  4.1.0
Public Types | Public Member Functions | Friends | List of all members
qsf::logic::Sequence Class Reference

Sequence class. More...

#include <Sequence.h>

Inheritance diagram for qsf::logic::Sequence:
Inheritance graph
[legend]
Collaboration diagram for qsf::logic::Sequence:
Collaboration graph
[legend]

Public Types

typedef std::vector< SequenceTrack * > TrackList
 
- Public Types inherited from qsf::Object
enum  PropertyOverrideState { PROPERTY_INVALID, PROPERTY_DEFAULT, PROPERTY_OVERRIDE, PROPERTY_REMOVED }
 
enum  SerializationMethod { SERIALIZE_FLAT, SERIALIZE_COMPLETE, SERIALIZE_DIFFERENTIAL, SERIALIZE_IGNORE_UNKNOWN }
 
enum  SerializationMode { MODE_MINIMAL, MODE_COMPATIBLE }
 

Public Member Functions

 Sequence (uint64 id, SequenceManager &sequenceManager)
 Constructor. More...
 
virtual ~Sequence ()
 Destructor. More...
 
uint64 getId () const
 Return the unique sequence identifier. More...
 
SequenceManagergetSequenceManager () const
 Return the sequence manager this sequence is in. More...
 
bool loadByFilename (const std::string &filename)
 Load a sequence by using a given filename. More...
 
void evaluate (float time) const
 Evaluate the sequence at the given point in time. More...
 
void evaluateTrack (uint32 trackId, float time) const
 Evaluate a particular track of the sequence at the given point in time. More...
 
void notifyTimePassed (float oldTime, float newTime) const
 Notify the sequence of passed time. More...
 
float getBeginTime () const
 Return reference "time zero" in seconds. More...
 
void setBeginTime (float newBeginTime)
 Change the reference "time zero" point in time (in seconds) to allow key times in the whole range of float. More...
 
float getDuration () const
 Return the duration of the sequence in seconds. More...
 
void setDuration (float newDuration)
 Change the duration of the sequence in seconds. More...
 
bool getShouldLoop () const
 The "should loop" flag is informative data which is provided by the creator of a sequence to hint the runtime player if the sequence should be played in a loop. More...
 
void setShouldLoop (bool shouldLoop)
 
float getSuggestedPlaybackSpeed () const
 The "suggested playback speed" is informative data provided by the creator of the sequence to hint the runtime player of the best playback speed (is a factor, like 0.5x or 2x) More...
 
void setSuggestedPlaybackSpeed (float suggestedPlaybackSpeed)
 
uint32 getFramesPerSecond () const
 
void setFramesPerSecond (uint32 newFramesPerSecond)
 
const TrackListgetTrackList () const
 Return a non-mutable list of all tracks. More...
 
SequenceTrackfindTrack (uint32 trackId) const
 Look up track instance by ID. More...
 
void removeAndDeleteTrack (uint32 trackId)
 Remove a track from the sequences and deletes its memory. More...
 
void deleteAllTracks ()
 Delete all track instances and clear the track list. More...
 
uint32 getFreeTrackId ()
 Generate a track ID which is not yet taken in this sequence. More...
 
void getFreeTrackIds (std::vector< uint32 > &freeTrackIdTargetList, uint32 count)
 Generate multiple track IDs which are not present yet in this sequence (use it to preallocate unique track IDs if you want to know how to add multiple tracks with forced IDs) More...
 
SequenceTrackEntityComponentPropertyaddTrackForEntityComponentProperty (uint64 entityId, const std::string &componentPropertyPath)
 Add a specific track for a value type, e.g. "addTrackForEntityComponentProperty(camp::classByType<glm::vec3>())". More...
 
SequenceTrackEntityComponentPropertyaddTrackForEntityComponentPropertyWithId (uint64 entityId, const std::string &componentPropertyPath, uint32 newTrackId)
 
SequenceTrackEntityComponentPropertyaddTrackForEntityComponentProperty (const camp::Property &propertyForTrack)
 
SequenceTrackEntityComponentPropertyaddTrackForEntityComponentPropertyWithId (const camp::Property &propertyForTrack, uint32 newTrackId)
 
SequenceTrackEntityComponentPropertyaddTrackForEntityComponentPropertyByTrackType (const camp::Class &trackCampClassType, uint32 newTrackId)
 
SequenceTrackEntityComponentPropertyaddTrackForEntityComponentPropertyByTrackType (const camp::Class &trackCampClassType)
 
SequenceTrackaddTrackByTrackType (const camp::Class &trackCampClassType, uint32 newTrackId)
 
SequenceTrackaddTrackByTrackType (const camp::Class &trackCampClassType)
 
- Public Member Functions inherited from qsf::Object
virtual ~Object ()
 Destructor. More...
 
const camp::Class & getCampClass () const
 Return the CAMP class. More...
 
int getPropertyIndexById (const StringHash &propertyId) const
 Return the CAMP property index by using the unique class property ID. More...
 
uint32 getPropertyIdByIndex (int index) const
 Return the unique class property ID with the given index. More...
 
std::string getPropertyNameById (const StringHash &propertyId) const
 Return the CAMP property name by using the unique class property ID. More...
 
const camp::Property * getCampPropertyById (const StringHash &propertyId) const
 Return the CAMP property by using the unique class property ID. More...
 
void setPropertyValuesByString (const std::string &values)
 Set CAMP reflection property values by using a given string. More...
 
void setPropertiesToDefaultValues ()
 Set all CAMP reflection system properties to their default values. More...
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void serializeToBoostPTree (boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
bool deserializeFromBoostPTree (const boost::property_tree::ptree &pTree, const camp::Class &campClass, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL)
 
void serializeToBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL) const
 
void deserializeFromBinarySerializer (BinarySerializer &serializer, SerializationMode mode=MODE_MINIMAL, SerializationMethod serializationMethod=SERIALIZE_DIFFERENTIAL, bool setOverrideState=true)
 
virtual camp::Value getPropertyDefaultValue (const StringHash &propertyId) const
 
virtual PropertyOverrideState getPropertyOverrideState (const StringHash &propertyId) const
 
virtual bool setPropertyOverrideState (const StringHash &propertyId, PropertyOverrideState overrideState)
 
virtual void onPreDeserialize ()
 Called right before the object is deserialized using any of the above methods. Default implementation is empty. More...
 
virtual void onPostDeserialize ()
 Called right after the object was deserialized using any of the above methods. Default implementation is empty. More...
 
virtual ScriptgetAssociatedScript () const
 Return the script instance associated with this object instance. More...
 

Friends

class SequenceManager
 

Additional Inherited Members

- Protected Member Functions inherited from qsf::Object
 Object ()
 Default constructor. More...
 

Detailed Description

Sequence class.

Note
  • Use "qsf::logic::SequencePlayer" for sequence playback

Member Typedef Documentation

Constructor & Destructor Documentation

qsf::logic::Sequence::Sequence ( uint64  id,
SequenceManager sequenceManager 
)
inline

Constructor.

Parameters
[in]idUnique sequence identifier
[in]sequenceManagerSequence manager
qsf::logic::Sequence::~Sequence ( )
inlinevirtual

Destructor.

Member Function Documentation

SequenceTrack* qsf::logic::Sequence::addTrackByTrackType ( const camp::Class &  trackCampClassType,
uint32  newTrackId 
)
SequenceTrack * qsf::logic::Sequence::addTrackByTrackType ( const camp::Class &  trackCampClassType)
inline
SequenceTrackEntityComponentProperty * qsf::logic::Sequence::addTrackForEntityComponentProperty ( uint64  entityId,
const std::string &  componentPropertyPath 
)
inline

Add a specific track for a value type, e.g. "addTrackForEntityComponentProperty(camp::classByType<glm::vec3>())".

SequenceTrackEntityComponentProperty * qsf::logic::Sequence::addTrackForEntityComponentProperty ( const camp::Property &  propertyForTrack)
inline
SequenceTrackEntityComponentProperty* qsf::logic::Sequence::addTrackForEntityComponentPropertyByTrackType ( const camp::Class &  trackCampClassType,
uint32  newTrackId 
)
SequenceTrackEntityComponentProperty * qsf::logic::Sequence::addTrackForEntityComponentPropertyByTrackType ( const camp::Class &  trackCampClassType)
inline
SequenceTrackEntityComponentProperty* qsf::logic::Sequence::addTrackForEntityComponentPropertyWithId ( uint64  entityId,
const std::string &  componentPropertyPath,
uint32  newTrackId 
)
SequenceTrackEntityComponentProperty* qsf::logic::Sequence::addTrackForEntityComponentPropertyWithId ( const camp::Property &  propertyForTrack,
uint32  newTrackId 
)
void qsf::logic::Sequence::deleteAllTracks ( )

Delete all track instances and clear the track list.

Note
  • All previously retrieved track instances become invalid after this call
void qsf::logic::Sequence::evaluate ( float  time) const

Evaluate the sequence at the given point in time.

Parameters
[in]timePoint in time where to evaluate (given as seconds) in the range [0, duration]
Note
  • This might set component properties of the entities stored in the sequence
  • The same interface is provided by "notifyTimePassed()". So don't call "notifyTimePassed()" and evaluate in the same frame, it will duplicate work.
void qsf::logic::Sequence::evaluateTrack ( uint32  trackId,
float  time 
) const

Evaluate a particular track of the sequence at the given point in time.

Parameters
[in]trackIdTrack reference which should be evaluated
[in]timePoint in time where to evaluate (given as seconds) in the range [0, duration]
Note
  • This might set component properties of the entities stored in the sequence
  • The same interface is provided by "notifyTimePassed()". So don't call "notifyTimePassed()" and evaluate in the same frame, it will duplicate work.
SequenceTrack* qsf::logic::Sequence::findTrack ( uint32  trackId) const

Look up track instance by ID.

Parameters
[in]trackIdTrack reference which should be returned
Returns
Will return a null pointer if track is not found
float qsf::logic::Sequence::getBeginTime ( ) const
inline

Return reference "time zero" in seconds.

float qsf::logic::Sequence::getDuration ( ) const
inline

Return the duration of the sequence in seconds.

uint32 qsf::logic::Sequence::getFramesPerSecond ( ) const
inline
uint32 qsf::logic::Sequence::getFreeTrackId ( )

Generate a track ID which is not yet taken in this sequence.

void qsf::logic::Sequence::getFreeTrackIds ( std::vector< uint32 > &  freeTrackIdTargetList,
uint32  count 
)

Generate multiple track IDs which are not present yet in this sequence (use it to preallocate unique track IDs if you want to know how to add multiple tracks with forced IDs)

uint64 qsf::logic::Sequence::getId ( ) const
inline

Return the unique sequence identifier.

Returns
The unique sequence identifier
Note
  • Connected to the CAMP reflection system
SequenceManager & qsf::logic::Sequence::getSequenceManager ( ) const
inline

Return the sequence manager this sequence is in.

Returns
The sequence manager this sequence is in, do no destroy the returned instance
bool qsf::logic::Sequence::getShouldLoop ( ) const
inline

The "should loop" flag is informative data which is provided by the creator of a sequence to hint the runtime player if the sequence should be played in a loop.

Todo:
  • TODO(oi) Maybe this would be more appropriately treated as metadata of a "sequence playback" component which can be controlled by the designer in maps etc.
float qsf::logic::Sequence::getSuggestedPlaybackSpeed ( ) const
inline

The "suggested playback speed" is informative data provided by the creator of the sequence to hint the runtime player of the best playback speed (is a factor, like 0.5x or 2x)

const Sequence::TrackList & qsf::logic::Sequence::getTrackList ( ) const
inline

Return a non-mutable list of all tracks.

bool qsf::logic::Sequence::loadByFilename ( const std::string &  filename)

Load a sequence by using a given filename.

Parameters
[in]filenameUTF-8 filename in platform-independent notation of the sequence to load
Returns
"true" if all went fine, else "false" (file not found?)
Note
  • The data of this sequence instance is lost when loading a new one
Todo:
  • TODO(oi) For now, we only support JSON
void qsf::logic::Sequence::notifyTimePassed ( float  oldTime,
float  newTime 
) const

Notify the sequence of passed time.

Parameters
[in]oldTimePoint in time where the sequence was previously evaluated (given as seconds) in the range [0, duration]
[in]newTimeCurrent point in time where the sequence should be evaluated (given as seconds) in the range [0, duration]
Remarks
This is the preferred interface for run-time as some tracks only work when they know the exact time which has passed and a simple evaluate-at-this-point-in-time would not suffice (e.g. game logic signaling). This might set component properties of the entities stored in the sequence.
void qsf::logic::Sequence::removeAndDeleteTrack ( uint32  trackId)

Remove a track from the sequences and deletes its memory.

Parameters
[in]trackIdTrack reference which should be deleted
Note
  • All references to this track are invalid after this call
void qsf::logic::Sequence::setBeginTime ( float  newBeginTime)
inline

Change the reference "time zero" point in time (in seconds) to allow key times in the whole range of float.

void qsf::logic::Sequence::setDuration ( float  newDuration)
inline

Change the duration of the sequence in seconds.

void qsf::logic::Sequence::setFramesPerSecond ( uint32  newFramesPerSecond)
inline
void qsf::logic::Sequence::setShouldLoop ( bool  shouldLoop)
inline
void qsf::logic::Sequence::setSuggestedPlaybackSpeed ( float  suggestedPlaybackSpeed)
inline

Friends And Related Function Documentation

friend class SequenceManager
friend

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