Open 3D Engine EMotionFX Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
EMotionFX::EventManager Class Reference

#include <EventManager.h>

Inherits MCore::RefCounted.

Public Member Functions

void Lock ()
 
void Unlock ()
 
void AddEventHandler (EventHandler *eventHandler)
 
void RemoveEventHandler (EventHandler *eventHandler)
 
template<typename T , typename ... Args>
AZStd::shared_ptr< const T > FindOrCreateEventData (Args &&... args)
 
template<typename T >
AZStd::shared_ptr< const T > FindEventData (const AZStd::shared_ptr< const T > &data)
 
void OnEvent (const EventInfo &eventInfo)
 
void OnPlayMotion (Motion *motion, PlayBackInfo *info)
 
void OnStartMotionInstance (MotionInstance *motionInstance, PlayBackInfo *info)
 
void OnDeleteMotionInstance (MotionInstance *motionInstance)
 
void OnDeleteMotion (Motion *motion)
 
void OnStop (MotionInstance *motionInstance)
 
void OnHasLooped (MotionInstance *motionInstance)
 
void OnHasReachedMaxNumLoops (MotionInstance *motionInstance)
 
void OnHasReachedMaxPlayTime (MotionInstance *motionInstance)
 
void OnIsFrozenAtLastFrame (MotionInstance *motionInstance)
 
void OnChangedPauseState (MotionInstance *motionInstance)
 
void OnChangedActiveState (MotionInstance *motionInstance)
 
void OnStartBlending (MotionInstance *motionInstance)
 
void OnStopBlending (MotionInstance *motionInstance)
 
void OnQueueMotionInstance (MotionInstance *motionInstance, PlayBackInfo *info)
 
void OnDeleteActor (Actor *actor)
 
void OnSimulatePhysics (float timeDelta)
 
void OnCustomEvent (uint32 eventType, void *data)
 
void OnDrawTriangle (const AZ::Vector3 &posA, const AZ::Vector3 &posB, const AZ::Vector3 &posC, const AZ::Vector3 &normalA, const AZ::Vector3 &normalB, const AZ::Vector3 &normalC, uint32 color)
 
void OnDrawTriangles ()
 
void OnScaleActorData (Actor *actor, float scaleFactor)
 
void OnScaleMotionData (Motion *motion, float scaleFactor)
 
bool OnRayIntersectionTest (const AZ::Vector3 &start, const AZ::Vector3 &end, IntersectionInfo *outIntersectInfo)
 
void OnStateEnter (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
void OnStateEntering (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
void OnStateExit (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
void OnStateEnd (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
void OnStartTransition (AnimGraphInstance *animGraphInstance, AnimGraphStateTransition *transition)
 
void OnEndTransition (AnimGraphInstance *animGraphInstance, AnimGraphStateTransition *transition)
 
void OnSetVisualManipulatorOffset (AnimGraphInstance *animGraphInstance, uint32 paramIndex, const AZ::Vector3 &offset)
 
void OnInputPortsChanged (AnimGraphNode *node, const AZStd::vector< AZStd::string > &newInputPorts, const AZStd::string &memberName, const AZStd::vector< AZStd::string > &memberValue)
 
void OnOutputPortsChanged (AnimGraphNode *node, const AZStd::vector< AZStd::string > &newOutputPorts, const AZStd::string &memberName, const AZStd::vector< AZStd::string > &memberValue)
 
void OnRenamedNode (AnimGraph *animGraph, AnimGraphNode *node, const AZStd::string &oldName)
 
void OnCreatedNode (AnimGraph *animGraph, AnimGraphNode *node)
 
void OnRemoveNode (AnimGraph *animGraph, AnimGraphNode *nodeToRemove)
 
void OnRemovedChildNode (AnimGraph *animGraph, AnimGraphNode *parentNode)
 
void OnProgressStart ()
 
void OnProgressEnd ()
 
void OnProgressText (const char *text)
 
void OnProgressValue (float percentage)
 
void OnSubProgressText (const char *text)
 
void OnSubProgressValue (float percentage)
 
void OnCreateAnimGraph (AnimGraph *animGraph)
 
void OnCreateAnimGraphInstance (AnimGraphInstance *animGraphInstance)
 
void OnCreateMotion (Motion *motion)
 
void OnCreateMotionSet (MotionSet *motionSet)
 
void OnCreateMotionInstance (MotionInstance *motionInstance)
 
void OnCreateMotionSystem (MotionSystem *motionSystem)
 
void OnCreateActor (Actor *actor)
 
void OnPostCreateActor (Actor *actor)
 
void OnDeleteAnimGraph (AnimGraph *animGraph)
 
void OnDeleteAnimGraphInstance (AnimGraphInstance *animGraphInstance)
 
void OnDeleteMotionSet (MotionSet *motionSet)
 
void OnDeleteMotionSystem (MotionSystem *motionSystem)
 
- Public Member Functions inherited from MCore::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
void IncreaseReferenceCount ()
 
void DecreaseReferenceCount ()
 
void Destroy ()
 
uint32 GetReferenceCount () const
 

Static Public Member Functions

static EventManagerCreate ()
 

Friends

class Initializer
 
class EMotionFXManager
 

Additional Inherited Members

- Protected Member Functions inherited from MCore::RefCounted
virtual void Delete ()
 

Detailed Description

The event manager, which is used to specify which event handler to use. You can use the macro named GetEventManager() to quickly access this singleton class. If you want to override the way events are processed, you have to create your own class inherited from the EventHandler base class.

See also
EventHandler.
MotionEvent.
MotionEventTable.

Member Function Documentation

◆ AddEventHandler()

void EMotionFX::EventManager::AddEventHandler ( EventHandler eventHandler)

Add event handler to the manager.

Parameters
eventHandlerThe new event handler to register, this must not be nullptr.

◆ OnChangedActiveState()

void EMotionFX::EventManager::OnChangedActiveState ( MotionInstance motionInstance)

This event gets triggered once the motion active state changes. For example when the motion is active but gets set to inactive using the MotionInstance::SetActive(...) method, then this even twill be triggered. Inactive motions don't get processed at all. They will not update their playback times, blending, nor will they take part in any blending calculations of the final node transforms. In other words, it will just be like the motion instance does not exist at all.

Parameters
motionInstanceThe motion instance that changed its active state.

◆ OnChangedPauseState()

void EMotionFX::EventManager::OnChangedPauseState ( MotionInstance motionInstance)

This event gets triggered once the motion pause state changes. For example when the motion is unpaused but gets paused, then this even twill be triggered. Paused motions don't get their playback times updated. They do however still perform blending, so it is still possible to fade them in or out.

Parameters
motionInstanceThe motion instance that changed its paused state.

◆ OnDeleteActor()

void EMotionFX::EventManager::OnDeleteActor ( Actor actor)

The event that gets triggered once an Actor object is being deleted. You could for example use this event to delete any allocations you have done inside the custom user data object linked with the Actor object. You can get and set this data object with the Actor::GetCustomData() and Actor::SetCustomData(...) methods.

Parameters
actorThe actor that is being deleted.

◆ OnDeleteMotion()

void EMotionFX::EventManager::OnDeleteMotion ( Motion motion)

The event that gets triggered once a Motion object is being deleted. You could for example use this event to delete any allocations you have done inside the custom user data object linked with the Motion object. You can get and set this data object with the Motion::GetCustomData() and Motion::SetCustomData(...) methods.

Parameters
motionThe motion that is being deleted.

◆ OnDeleteMotionInstance()

void EMotionFX::EventManager::OnDeleteMotionInstance ( MotionInstance motionInstance)

The event that gets triggered once a MotionInstance object is being deleted. This can happen when calling the MotionSystem::RemoveMotionInstance() method manually, or when EMotion FX internally removes the motion instance because it has no visual influence anymore. The destructor of the MotionInstance class automatically triggers this event.

Parameters
motionInstanceThe motion instance that is being deleted.

◆ OnEvent()

void EMotionFX::EventManager::OnEvent ( const EventInfo eventInfo)

The main method that processes an event.

Parameters
eventInfoThe struct holding the information about the triggered event.

◆ OnHasLooped()

void EMotionFX::EventManager::OnHasLooped ( MotionInstance motionInstance)

This event gets triggered once a given motion instance has looped.

Parameters
motionInstanceThe motion instance that got looped.

◆ OnHasReachedMaxNumLoops()

void EMotionFX::EventManager::OnHasReachedMaxNumLoops ( MotionInstance motionInstance)

This event gets triggered once a given motion instance has reached its maximum number of allowed loops. In this case the motion instance will also be stopped automatically afterwards.

Parameters
motionInstanceThe motion instance that reached its maximum number of allowed loops.

◆ OnHasReachedMaxPlayTime()

void EMotionFX::EventManager::OnHasReachedMaxPlayTime ( MotionInstance motionInstance)

This event gets triggered once a given motion instance has reached its maximum playback time. For example if this motion instance is only allowed to play for 2 seconds, and the total playback time reaches two seconds, then this event will be triggered.

Parameters
motionInstanceThe motion instance that reached its maximum playback time.

◆ OnIsFrozenAtLastFrame()

void EMotionFX::EventManager::OnIsFrozenAtLastFrame ( MotionInstance motionInstance)

This event gets triggered once the motion instance is set to freeze at the last frame once the motion reached its end (when it reached its maximum number of loops or playtime). In this case this event will be triggered once.

Parameters
motionInstanceThe motion instance that got into a frozen state.

◆ OnPlayMotion()

void EMotionFX::EventManager::OnPlayMotion ( Motion motion,
PlayBackInfo info 
)

The event that gets triggered when a MotionSystem::PlayMotion(...) is being executed. The difference between OnStartMotionInstance() and this OnPlayMotion() is that the OnPlayMotion doesn't guarantee that the motion is being played yet, as it can also be added to the motion queue. The OnStartMotionInstance() method will be called once the motion is really being played.

Parameters
motionThe motion that is being played.
infoThe playback info used to play the motion.

◆ OnQueueMotionInstance()

void EMotionFX::EventManager::OnQueueMotionInstance ( MotionInstance motionInstance,
PlayBackInfo info 
)

This event gets triggered once the given motion instance gets added to the motion queue. This happens when you set the PlayBackInfo::m_playNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) will not directly start playing the motion (OnStartMotionInstance), but will add it to the motion queue instead. The motion queue will then start playing the motion instance once it should.

Parameters
motionInstanceThe motion instance that gets added to the motion queue.
infoThe playback information used to play this motion instance.

◆ OnRayIntersectionTest()

bool EMotionFX::EventManager::OnRayIntersectionTest ( const AZ::Vector3 &  start,
const AZ::Vector3 &  end,
IntersectionInfo outIntersectInfo 
)

Perform a ray intersection test and return the intersection info. The first event handler registered that sets the IntersectionInfo::m_isValid to true will be outputting to the outIntersectInfo parameter.

Parameters
startThe start point, in world space.
endThe end point, in world space.
outIntersectInfoThe resulting intersection info.
Returns
Returns true when an intersection occurred and false when no intersection occurred.

◆ OnStartBlending()

void EMotionFX::EventManager::OnStartBlending ( MotionInstance motionInstance)

This event gets triggered once a motion instance is automatically changing its weight value over time. For example when a motion is automatically being faded in from weight 0 to a given target weight in half a second, then once this blending starts, this event is being triggered. Once the the MotionInstance::SetWeight(...) method is being called with a blend time bigger than zero, and if the motion instance isn't currently already blending, then this event will be triggered. This event most likely will get triggered when using the MotionSystem::PlayMotion() and MotionInstance::Stop() methods.

Parameters
motionInstanceThe motion instance which is changing its weight value over time.

◆ OnStartMotionInstance()

void EMotionFX::EventManager::OnStartMotionInstance ( MotionInstance motionInstance,
PlayBackInfo info 
)

The event that gets triggered when a motion instance is really being played. This can be a manual call through MotionInstance::PlayMotion or when the MotionQueue class will start playing a motion that was on the queue. The difference between OnStartMotionInstance() and this OnPlayMotion() is that the OnPlayMotion doesn't guarantee that the motion is being played yet, as it can also be added to the motion queue. The OnStartMotionInstance() method will be called once the motion is really being played.

Parameters
motionInstanceThe motion instance that is being played.
infoThe playback info used to play the motion.

◆ OnStop()

void EMotionFX::EventManager::OnStop ( MotionInstance motionInstance)

The event that gets triggered when a motion instance is being stopped using one of the MotionInstance::Stop() methods. EMotion FX will internally stop the motion automatically when the motion instance reached its maximum playback time or its maximum number of loops.

Parameters
motionInstanceThe motion instance that is being stopped.

◆ OnStopBlending()

void EMotionFX::EventManager::OnStopBlending ( MotionInstance motionInstance)

This event gets triggered once a motion instance stops it automatic changing of its weight value over time. For example when a motion is automatically being faded in from weight 0 to a given target weight in half a second, and once the target weight is reached after half a second, will cause this event to be triggered. Once the the MotionInstance::SetWeight(...) method is being called with a blend time equal to zero and the motion instance is currently blending its weight value, then this event will be triggered. This event most likely will get triggered when using the MotionSystem::PlayMotion() and MotionInstance::Stop() methods.

Parameters
motionInstanceThe motion instance for which the automatic weight blending just stopped.

◆ RemoveEventHandler()

void EMotionFX::EventManager::RemoveEventHandler ( EventHandler eventHandler)

Remove the given event handler.

Parameters
eventHandlerA pointer to the event handler to remove.

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