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::MotionInstanceEventHandler Class Referenceabstract

#include <EventHandler.h>

Public Member Functions

virtual const AZStd::vector< EventTypes > GetHandledEventTypes () const =0
 
void SetMotionInstance (MotionInstance *motionInstance)
 
MCORE_INLINE MotionInstanceGetMotionInstance ()
 
virtual void OnEvent (const EventInfo &eventInfo)
 
virtual void OnStartMotionInstance (PlayBackInfo *info)
 
virtual void OnDeleteMotionInstance ()
 
virtual void OnStop ()
 
virtual void OnHasLooped ()
 
virtual void OnHasReachedMaxNumLoops ()
 
virtual void OnHasReachedMaxPlayTime ()
 
virtual void OnIsFrozenAtLastFrame ()
 
virtual void OnChangedPauseState ()
 
virtual void OnChangedActiveState ()
 
virtual void OnStartBlending ()
 
virtual void OnStopBlending ()
 
virtual void OnQueueMotionInstance (PlayBackInfo *info)
 

Protected Attributes

MotionInstancem_motionInstance = nullptr
 

Detailed Description

The per motion instance event handlers. This allows you to capture events triggered on a specific motion instance, rather than globally.

Member Function Documentation

◆ GetHandledEventTypes()

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

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

◆ OnChangedActiveState()

virtual void EMotionFX::MotionInstanceEventHandler::OnChangedActiveState ( )
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.

◆ OnChangedPauseState()

virtual void EMotionFX::MotionInstanceEventHandler::OnChangedPauseState ( )
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.

◆ OnDeleteMotionInstance()

virtual void EMotionFX::MotionInstanceEventHandler::OnDeleteMotionInstance ( )
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.

◆ OnEvent()

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

The method that processes an event.

Parameters
eventInfoThe struct holding the information about the triggered event.

◆ OnHasLooped()

virtual void EMotionFX::MotionInstanceEventHandler::OnHasLooped ( )
inlinevirtual

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

◆ OnHasReachedMaxNumLoops()

virtual void EMotionFX::MotionInstanceEventHandler::OnHasReachedMaxNumLoops ( )
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.

◆ OnHasReachedMaxPlayTime()

virtual void EMotionFX::MotionInstanceEventHandler::OnHasReachedMaxPlayTime ( )
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.

◆ OnIsFrozenAtLastFrame()

virtual void EMotionFX::MotionInstanceEventHandler::OnIsFrozenAtLastFrame ( )
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.

◆ OnQueueMotionInstance()

virtual void EMotionFX::MotionInstanceEventHandler::OnQueueMotionInstance ( 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
infoThe playback information used to play this motion instance.

◆ OnStartBlending()

virtual void EMotionFX::MotionInstanceEventHandler::OnStartBlending ( )
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.

◆ OnStartMotionInstance()

virtual void EMotionFX::MotionInstanceEventHandler::OnStartMotionInstance ( 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
infoThe playback info used to play the motion.

◆ OnStop()

virtual void EMotionFX::MotionInstanceEventHandler::OnStop ( )
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.

◆ OnStopBlending()

virtual void EMotionFX::MotionInstanceEventHandler::OnStopBlending ( )
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.


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