#include <MotionEventTrack.h>
Inherited by EMotionFX::AnimGraphSyncTrack.
Public Member Functions | |
MotionEventTrack (Motion *motion) | |
MotionEventTrack (const char *name, Motion *motion) | |
MotionEventTrack (const MotionEventTrack &other) | |
MotionEventTrack & | operator= (const MotionEventTrack &other) |
void | SetName (const char *name) |
size_t | AddEvent (float timeValue, EventDataPtr &&data) |
size_t | AddEvent (float timeValue, EventDataSet &&datas) |
size_t | AddEvent (float startTimeValue, float endTimeValue, EventDataPtr &&data) |
size_t | AddEvent (float startTimeValue, float endTimeValue, EventDataSet &&data) |
void | ProcessEvents (float startTime, float endTime, const MotionInstance *motionInstance) const |
void | ExtractEvents (float startTime, float endTime, const MotionInstance *motionInstance, AnimGraphEventBuffer *outEventBuffer) const |
size_t | GetNumEvents () const |
const MotionEvent & | GetEvent (size_t eventNr) const |
MotionEvent & | GetEvent (size_t eventNr) |
void | RemoveEvent (size_t eventNr) |
void | RemoveAllEvents () |
void | Clear () |
const char * | GetName () const |
const AZStd::string & | GetNameString () const |
void | SetIsEnabled (bool enabled) |
bool | GetIsEnabled () const |
bool | GetIsDeletable () const |
void | SetIsDeletable (bool isDeletable) |
Motion * | GetMotion () const |
void | SetMotion (Motion *newMotion) |
void | CopyTo (MotionEventTrack *targetTrack) const |
void | ReserveNumEvents (size_t numEvents) |
Static Public Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
static MotionEventTrack * | Create (Motion *motion) |
static MotionEventTrack * | Create (const char *name, Motion *motion) |
Protected Attributes | |
AZStd::vector< MotionEvent > | m_events |
AZStd::string | m_name |
Motion * | m_motion |
The motion where this track belongs to. | |
bool | m_enabled = true |
Is this track enabled? | |
bool | m_deletable = true |
Friends | |
class | MotionEvent |
The motion event track, which stores all events and their data on a memory efficient way. Events have three generic properties: a time value, an event type string and a parameter string. Unique strings are only stored once in memory, so if you have for example ten events of the type "SOUND" only 1 string will be stored in memory, and the events will index into the table to retrieve the string. The event table can also figure out what events to process within a given time range. The handling of those events is done by the MotionEventHandler class that you specify to the MotionEventManager singleton.
EMotionFX::MotionEventTrack::MotionEventTrack | ( | Motion * | motion | ) |
The constructor.
motion | The motion object this track belongs to. |
EMotionFX::MotionEventTrack::MotionEventTrack | ( | const char * | name, |
Motion * | motion | ||
) |
Extended constructor.
name | The name of the track. |
motion | The motion object this track belongs to. |
size_t EMotionFX::MotionEventTrack::AddEvent | ( | float | startTimeValue, |
float | endTimeValue, | ||
EventDataPtr && | data | ||
) |
Add an event to the event table. The events can be ordered in any order on time. So you do not need to add them in a sorted order based on time. This is already done automatically. The events will internally be stored sorted on time value.
startTimeValue | The start time, in seconds, at which the event should occur. |
endTimeValue | The end time, in seconds, at which this event should stop. |
eventTypeID | The unique event ID that you wish to add. Please keep in mind that you need to have the events registered with the EMotion FX event manager before you can add them! |
parameters | The parameters of the event, which could be the filename of a sound file or anything else. |
size_t EMotionFX::MotionEventTrack::AddEvent | ( | float | timeValue, |
EventDataPtr && | data | ||
) |
Add a tick event to the event table.
A tick event is an event whose start time and end time are the same. The events can be ordered in any order on time. So you do not need to add them in a sorted order based on time. This is already done automatically. The events will internally be stored sorted on time value.
timeValue | The time, in seconds, at which the event should occur. |
eventType | The string describing the type of the event, this could for example be "SOUND" or whatever your game can process. |
parameters | The parameters of the event, which could be the filename of a sound file or anything else. |
void EMotionFX::MotionEventTrack::Clear | ( | ) |
Remove all motion events and parameters from the table.
|
static |
Extended creation.
name | The name of the track. |
motion | The motion object this track belongs to. |
|
static |
Creation method.
motion | The motion object this track belongs to. |
|
inline |
Get a given event from the table.
eventNr | The event number you wish to retrieve. This must be in range of 0..GetNumEvents() - 1. |
|
inline |
Get a given event from the table.
eventNr | The event number you wish to retrieve. This must be in range of 0..GetNumEvents() - 1. |
size_t EMotionFX::MotionEventTrack::GetNumEvents | ( | ) | const |
Get the number of events stored inside the table.
void EMotionFX::MotionEventTrack::ProcessEvents | ( | float | startTime, |
float | endTime, | ||
const MotionInstance * | motionInstance | ||
) | const |
Process all events within a given time range.
startTime | The start time of the range, in seconds. |
endTime | The end time of the range, in seconds. |
actorInstance | The actor instance on which to trigger the event. |
motionInstance | The motion instance which triggers the event. |
void EMotionFX::MotionEventTrack::RemoveAllEvents | ( | ) |
Remove all motion events from the table. Does not remove the parameters.
void EMotionFX::MotionEventTrack::RemoveEvent | ( | size_t | eventNr | ) |
Remove a given event from the table.
eventNr | The event number to remove. This must be in range of 0..GetNumEvents() - 1. |
void EMotionFX::MotionEventTrack::SetName | ( | const char * | name | ) |
Set the name of the motion event track.
name | The name of the motion event track. |