A description of a set of parameters and values that is sent when an event is dispatched. More...
#include <EventData.h>
Inherited by EMotionFX::EventDataFloatArray, EMotionFX::EventDataFootIK, and EMotionFX::EventDataSyncable.
Public Member Functions | |
AZ_RTTI (EventData, "{F6AFCD3B-D58E-4821-9E7C-D1F437304E5D}") | |
virtual bool | operator== (const EventData &rhs) const |
virtual bool | Equal (const EventData &rhs, bool ignoreEmptyFields=false) const =0 |
Test if two EventData instances are equal. | |
virtual AZStd::string | ToString () const |
Static Public Member Functions | |
static void | Reflect (AZ::ReflectContext *context) |
A description of a set of parameters and values that is sent when an event is dispatched.
This is the base class of all event data types. General-purpose parameters should subclass this type. For parameter types that are designed to be placed on the Sync track, use EventDataSyncable instead.
Subclasses of this type should implement Reflect() to reflect the type to the Serialization and Edit contexts, and should implement Equal(). For the type to be visible in the EMotionFX Editor, the "Creatable" attribute should be added to the class's ClassElement in the EditContext. Without this attribute, the type will not show up in the QComboBox that allows users to select the EventData type in the EMotionFX's Motion Events tab. Here's an example:
|
pure virtual |
Test if two EventData instances are equal.
This method is used by EMotionFX to deduplicate instances of EventData subclasses, and by the AnimGraphMotionCondition's Motion Event matching logic.
When loading a .motion file and deserializing the MotionEvents on the event tracks, each EventData instance is run through EventManager::FindOrCreateEventData. The EventManager stores a list of all EventData instances in use, and attempts to find one where Equal(loadedEventData) returns true. If it finds one that is equal, the duplicate data is discarded. So this method is essential in saving memory of the duplicated EventData instances.
When an AnimGraphMotionCondition is used to test against a Motion Event, this method is called by AnimGraphMotionCondition::TestCondition. In this case, ignoreEmptyFields
is true. This allows the condition to match against parts of the EventData and not others. For example, if one of the fields is a string, and that string value is empty in the condition, it can act as a wildcard match for that field.
This method is not used by the AnimGraphSyncTrack to determine if events are the same for syncing (that method is EventDataSyncable::HashForSyncing).
Implemented in EMotionFX::EventDataFloatArray, EMotionFX::EventDataFootIK, and EMotionFX::TwoStringEventData.