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

#include <EventHandler.h>

Inherited by EMStudio::AnimGraphEventHandler, EMStudio::NodePaletteWidget::EventHandler, and EMotionFX::MotionLinkCache.

Public Member Functions

virtual void OnEvent (const EventInfo &eventInfo)
 
virtual const AZStd::vector< EventTypes > GetHandledEventTypes () const =0
 
virtual void OnPlayMotion (Motion *motion, PlayBackInfo *info)
 
virtual void OnStartMotionInstance (MotionInstance *motionInstance, PlayBackInfo *info)
 
virtual void OnDeleteMotionInstance (MotionInstance *motionInstance)
 
virtual void OnDeleteMotion (Motion *motion)
 
virtual void OnStop (MotionInstance *motionInstance)
 
virtual void OnHasLooped (MotionInstance *motionInstance)
 
virtual void OnHasReachedMaxNumLoops (MotionInstance *motionInstance)
 
virtual void OnHasReachedMaxPlayTime (MotionInstance *motionInstance)
 
virtual void OnIsFrozenAtLastFrame (MotionInstance *motionInstance)
 
virtual void OnChangedPauseState (MotionInstance *motionInstance)
 
virtual void OnChangedActiveState (MotionInstance *motionInstance)
 
virtual void OnStartBlending (MotionInstance *motionInstance)
 
virtual void OnStopBlending (MotionInstance *motionInstance)
 
virtual void OnQueueMotionInstance (MotionInstance *motionInstance, PlayBackInfo *info)
 
virtual void OnDeleteActor (Actor *actor)
 
virtual void OnSimulatePhysics (float timeDelta)
 
virtual void OnCustomEvent (uint32 eventType, void *data)
 
virtual 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)
 
virtual void OnDrawTriangles ()
 
virtual void OnCreateAnimGraph (AnimGraph *animGraph)
 
virtual void OnCreateAnimGraphInstance (AnimGraphInstance *animGraphInstance)
 
virtual void OnCreateMotion (Motion *motion)
 
virtual void OnCreateMotionSet (MotionSet *motionSet)
 
virtual void OnCreateMotionInstance (MotionInstance *motionInstance)
 
virtual void OnCreateMotionSystem (MotionSystem *motionSystem)
 
virtual void OnCreateActor (Actor *actor)
 
virtual void OnPostCreateActor (Actor *actor)
 
virtual void OnDeleteAnimGraph (AnimGraph *animGraph)
 
virtual void OnDeleteAnimGraphInstance (AnimGraphInstance *animGraphInstance)
 
virtual void OnDeleteMotionSet (MotionSet *motionSet)
 
virtual void OnDeleteMotionSystem (MotionSystem *motionSystem)
 
virtual bool OnRayIntersectionTest (const AZ::Vector3 &start, const AZ::Vector3 &end, IntersectionInfo *outIntersectInfo)
 
virtual void OnStateEnter (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
virtual void OnStateEntering (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
virtual void OnStateExit (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
virtual void OnStateEnd (AnimGraphInstance *animGraphInstance, AnimGraphNode *state)
 
virtual void OnStartTransition (AnimGraphInstance *animGraphInstance, AnimGraphStateTransition *transition)
 
virtual void OnEndTransition (AnimGraphInstance *animGraphInstance, AnimGraphStateTransition *transition)
 
virtual void OnSetVisualManipulatorOffset (AnimGraphInstance *animGraphInstance, size_t paramIndex, const AZ::Vector3 &offset)
 
virtual void OnInputPortsChanged (AnimGraphNode *node, const AZStd::vector< AZStd::string > &newInputPorts, const AZStd::string &memberName, const AZStd::vector< AZStd::string > &memberValue)
 
virtual void OnOutputPortsChanged (AnimGraphNode *node, const AZStd::vector< AZStd::string > &newOutputPorts, const AZStd::string &memberName, const AZStd::vector< AZStd::string > &memberValue)
 
virtual void OnRenamedNode (AnimGraph *animGraph, AnimGraphNode *node, const AZStd::string &oldName)
 
virtual void OnCreatedNode (AnimGraph *animGraph, AnimGraphNode *node)
 
virtual void OnRemoveNode (AnimGraph *animGraph, AnimGraphNode *nodeToRemove)
 
virtual void OnRemovedChildNode (AnimGraph *animGraph, AnimGraphNode *parentNode)
 
virtual void OnProgressStart ()
 
virtual void OnProgressEnd ()
 
virtual void OnProgressText (const char *text)
 
virtual void OnProgressValue (float percentage)
 
virtual void OnSubProgressText (const char *text)
 
virtual void OnSubProgressValue (float percentage)
 
virtual void OnScaleActorData (Actor *actor, float scaleFactor)
 
virtual void OnScaleMotionData (Motion *motion, float scaleFactor)
 

Detailed Description

The event handler, which is responsible for processing the events. This class contains several methods which you can overload to perform custom things event comes up. You can inherit your own event handler from this base class and add it to the event manager using EMFX_EVENTMGR.AddEventHandler(...) method to make it use your custom event handler. Every event your derived class handles has to be returned by the GetHandledEventTypes method. This helps filtering the event dispatching to only the handlers that are interested about such event.

Member Function Documentation

◆ GetHandledEventTypes()

virtual const AZStd::vector< EventTypes > EMotionFX::EventHandler::GetHandledEventTypes ( ) const
pure virtual

Event handlers need to overload this function and return the list of events they are interested about

Implemented in EMStudio::AnimGraphEventHandler, and EMStudio::NodePaletteWidget::EventHandler.

◆ OnChangedActiveState()

virtual void EMotionFX::EventHandler::OnChangedActiveState ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnChangedPauseState ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnDeleteActor ( Actor actor)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnDeleteMotion ( Motion motion)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnDeleteMotionInstance ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnEvent ( const EventInfo eventInfo)
inlinevirtual

The main method that processes a event.

Parameters
eventInfoThe struct holding the information about the triggered event.

◆ OnHasLooped()

virtual void EMotionFX::EventHandler::OnHasLooped ( MotionInstance motionInstance)
inlinevirtual

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

Parameters
motionInstanceThe motion instance that got looped.

◆ OnHasReachedMaxNumLoops()

virtual void EMotionFX::EventHandler::OnHasReachedMaxNumLoops ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnHasReachedMaxPlayTime ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnIsFrozenAtLastFrame ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnPlayMotion ( Motion motion,
PlayBackInfo info 
)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnQueueMotionInstance ( MotionInstance motionInstance,
PlayBackInfo info 
)
inlinevirtual

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()

virtual bool EMotionFX::EventHandler::OnRayIntersectionTest ( const AZ::Vector3 &  start,
const AZ::Vector3 &  end,
IntersectionInfo outIntersectInfo 
)
inlinevirtual

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.

Reimplemented in EMStudio::AnimGraphEventHandler.

◆ OnStartBlending()

virtual void EMotionFX::EventHandler::OnStartBlending ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnStartMotionInstance ( MotionInstance motionInstance,
PlayBackInfo info 
)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnStop ( MotionInstance motionInstance)
inlinevirtual

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()

virtual void EMotionFX::EventHandler::OnStopBlending ( MotionInstance motionInstance)
inlinevirtual

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.

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