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::Motion Class Reference

#include <Motion.h>

Inherits MCore::RefCounted.

Public Member Functions

AZ_CLASS_ALLOCATOR_DECL Motion (const char *name)
 
void SetName (const char *name)
 
const char * GetName () const
 
const AZStd::string & GetNameString () const
 
void SetFileName (const char *filename)
 
const char * GetFileName () const
 
const AZStd::string & GetFileNameString () const
 
void SetID (uint32 id)
 
uint32 GetID () const
 
void CalcNodeTransform (const MotionInstance *instance, Transform *outTransform, Actor *actor, Node *node, float timeValue, bool enableRetargeting)
 
MotionEventTableGetEventTable () const
 
void SetEventTable (AZStd::unique_ptr< MotionEventTable > eventTable)
 
void SetMotionFPS (float motionFPS)
 
float GetMotionFPS () const
 
void Update (const Pose *inputPose, Pose *outputPose, MotionInstance *instance)
 
void SamplePose (Pose *outputPose, const MotionDataSampleSettings &sampleSettings)
 
virtual void SetRetargetSource (Actor *actor)
 
void SetCustomData (void *dataPointer)
 
void * GetCustomData () const
 
void SetDefaultPlayBackInfo (const PlayBackInfo &playBackInfo)
 
PlayBackInfoGetDefaultPlayBackInfo ()
 
const PlayBackInfoGetDefaultPlayBackInfo () const
 
EMotionExtractionFlags GetMotionExtractionFlags () const
 
void SetMotionExtractionFlags (EMotionExtractionFlags flags)
 
void SetDirtyFlag (bool dirty)
 
bool GetDirtyFlag () const
 
void SetAutoUnregister (bool enabled)
 
bool GetAutoUnregister () const
 
void SetIsOwnedByRuntime (bool isOwnedByRuntime)
 
bool GetIsOwnedByRuntime () const
 
void SetUnitType (MCore::Distance::EUnitType unitType)
 
MCore::Distance::EUnitType GetUnitType () const
 
void SetFileUnitType (MCore::Distance::EUnitType unitType)
 
MCore::Distance::EUnitType GetFileUnitType () const
 
void Scale (float scaleFactor)
 
void ScaleToUnitType (MCore::Distance::EUnitType targetUnitType)
 
void UpdateDuration ()
 
float GetDuration () const
 
const MotionDataGetMotionData () const
 
MotionDataGetMotionData ()
 
void SetMotionData (MotionData *motionData, bool delOldFromMem=true)
 
void SetRootMotionExtractionData (AZStd::shared_ptr< RootMotionExtractionData > data)
 
const AZStd::shared_ptr< RootMotionExtractionData > & GetRootMotionExtractionData () const
 
- Public Member Functions inherited from MCore::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
void IncreaseReferenceCount ()
 
void DecreaseReferenceCount ()
 
void Destroy ()
 
uint32 GetReferenceCount () const
 

Protected Attributes

MotionDatam_motionData = nullptr
 
AZStd::shared_ptr< RootMotionExtractionDatam_rootMotionExtractionData
 
AZStd::string m_fileName
 
PlayBackInfo m_defaultPlayBackInfo
 
AZStd::unique_ptr< MotionEventTablem_eventTable
 
MCore::Distance::EUnitType m_unitType
 
MCore::Distance::EUnitType m_fileUnitType
 
void * m_customData = nullptr
 
float m_motionFps = 30.0f
 
uint32 m_nameId = MCORE_INVALIDINDEX32
 
uint32 m_id = MCORE_INVALIDINDEX32
 
EMotionExtractionFlags m_extractionFlags
 
bool m_dirtyFlag = false
 
bool m_autoUnregister = true
 

Additional Inherited Members

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

Detailed Description

The motion base class. The unified motion processing system requires all motions to have a base class. This base class is the Motion class (so this one). Different types of motions can be for example skeletal motions (body motions) or facial motions. The main function inside this base class is the method named Update, which will output the resulting transformations into a Pose object.

Member Function Documentation

◆ CalcNodeTransform()

void EMotionFX::Motion::CalcNodeTransform ( const MotionInstance instance,
Transform *  outTransform,
Actor actor,
Node node,
float  timeValue,
bool  enableRetargeting 
)

Calculates the node transformation of the given node for this motion.

Parameters
instanceThe motion instance that contains the motion links to this motion.
outTransformThe node transformation that will be the output of this function.
actorThe actor to apply the motion to.
nodeThe node to apply the motion to.
timeValueThe time value.
enableRetargetingSet to true if you like to enable motion retargeting, otherwise set to false.

◆ GetAutoUnregister()

bool EMotionFX::Motion::GetAutoUnregister ( ) const

Check if this motion is automatically being unregistered from the motion manager when this motion gets deleted or not.

Returns
Returns true when it will get automatically deleted, otherwise false is returned.

◆ GetCustomData()

void* EMotionFX::Motion::GetCustomData ( ) const

Get the pointer to some custom data that you'd like to associate with this motion object. Please keep in mind you are responsible yourself for deleting any allocations you might do inside this custom data object. You can use the motion event system to detect when a motion gets deleted to help you find out when to delete allocated custom data.

Returns
A pointer to the custom data linked with this motion object, or nullptr when it has not been set.

◆ GetDefaultPlayBackInfo()

PlayBackInfo* EMotionFX::Motion::GetDefaultPlayBackInfo ( )

Get the default playback info of this motion.

◆ GetDirtyFlag()

bool EMotionFX::Motion::GetDirtyFlag ( ) const

Get the dirty flag which indicates whether the user has made changes to the motion. This indicator is set to true when the user changed something like adding a motion event. When the user saves the motion, the indicator is usually set to false.

Returns
The dirty flag.

◆ GetEventTable()

MotionEventTable* EMotionFX::Motion::GetEventTable ( ) const

Get the event table. This event table stores all motion events and can execute them as well.

Returns
The event table, which stores the motion events.

◆ GetFileName()

const char* EMotionFX::Motion::GetFileName ( ) const

Get the filename of the motion.

Returns
The filename of the motion.

◆ GetFileNameString()

const AZStd::string& EMotionFX::Motion::GetFileNameString ( ) const

Returns the filename of the motion, as a AZStd::string object.

Returns
The filename of the motion.

◆ GetID()

uint32 EMotionFX::Motion::GetID ( ) const

Get the unique identification number for the motion.

Returns
The unique identification number.

◆ GetMotionExtractionFlags()

EMotionExtractionFlags EMotionFX::Motion::GetMotionExtractionFlags ( ) const

Get the motion extraction flags.

Returns
The motion extraction flags, which can be a combination of the values inside the specific enum.

◆ GetMotionFPS()

float EMotionFX::Motion::GetMotionFPS ( ) const

Get the motion framerate.

Returns
The number of keyframes per second.

◆ GetName()

const char* EMotionFX::Motion::GetName ( ) const

Returns the name of the motion.

Returns
The name of the motion.

◆ GetNameString()

const AZStd::string& EMotionFX::Motion::GetNameString ( ) const

Returns the name of the motion, as a AZStd::string object.

Returns
The name of the motion.

◆ Scale()

void EMotionFX::Motion::Scale ( float  scaleFactor)

Scale all motion data. This is a very slow operation and is used to convert between different unit systems (cm, meters, etc).

Parameters
scaleFactorThe scale factor to scale the current data by.

◆ ScaleToUnitType()

void EMotionFX::Motion::ScaleToUnitType ( MCore::Distance::EUnitType  targetUnitType)

Scale to a given unit type. This method does nothing if the motion is already in this unit type. You can check what the current unit type is with the GetUnitType() method.

Parameters
targetUnitTypeThe unit type to scale into (meters, centimeters, etc).

◆ SetAutoUnregister()

void EMotionFX::Motion::SetAutoUnregister ( bool  enabled)

Set if we want to automatically unregister this motion from the motion manager when we delete this motion. On default this is set to true.

Parameters
enabledSet to true when you wish to automatically have the motion unregistered, otherwise set it to false.

◆ SetCustomData()

void EMotionFX::Motion::SetCustomData ( void *  dataPointer)

Set the pointer to some custom data that you'd like to associate with this motion object. Please keep in mind you are responsible yourself for deleting any allocations you might do inside this custom data object. You can use the motion event system to detect when a motion gets deleted to help you find out when to delete allocated custom data.

Parameters
dataPointerThe pointer to your custom data. This can also be nullptr.

◆ SetDefaultPlayBackInfo()

void EMotionFX::Motion::SetDefaultPlayBackInfo ( const PlayBackInfo playBackInfo)

Set the default playback info to the given playback info. In case the default playback info hasn't been created yet this function will automatically take care of that.

Parameters
playBackInfoThe new playback info which will be copied over to this motion's default playback info.

◆ SetDirtyFlag()

void EMotionFX::Motion::SetDirtyFlag ( bool  dirty)

Set the dirty flag which indicates whether the user has made changes to the motion. This indicator should be set to true when the user changed something like adding a motion event. When the user saves the motion, the indicator is usually set to false.

Parameters
dirtyThe dirty flag.

◆ SetEventTable()

void EMotionFX::Motion::SetEventTable ( AZStd::unique_ptr< MotionEventTable eventTable)

Set the event table.

Parameters
newTableThe new motion event table for the Motion to use.

◆ SetFileName()

void EMotionFX::Motion::SetFileName ( const char *  filename)

Set the filename of the motion.

Parameters
[in]filenameThe filename of the motion.

◆ SetID()

void EMotionFX::Motion::SetID ( uint32  id)

Set the unique identification number for the motion.

Parameters
[in]idThe unique identification number.

◆ SetIsOwnedByRuntime()

void EMotionFX::Motion::SetIsOwnedByRuntime ( bool  isOwnedByRuntime)

Marks the object as used by the engine runtime, as opposed to the tool suite.

◆ SetMotionExtractionFlags()

void EMotionFX::Motion::SetMotionExtractionFlags ( EMotionExtractionFlags  flags)

Set the motion extraction flags.

Parameters
maskThe motion extraction flags to set.

◆ SetMotionFPS()

void EMotionFX::Motion::SetMotionFPS ( float  motionFPS)

Set the motion framerate.

Parameters
motionFPSThe number of keyframes per second.

◆ SetName()

void EMotionFX::Motion::SetName ( const char *  name)

Set the name of the motion.

Parameters
nameThe name of the motion.

◆ SetRetargetSource()

virtual void EMotionFX::Motion::SetRetargetSource ( Actor actor)
inlinevirtual

Specify the actor to use as retargeting source. This would be the actor from which the motion was originally exported. So if you would play a human motion on a dwarf, you would pass the actor that represents the human as parameter.

Parameters
actorThe actor to use as retarget source.

◆ Update()

void EMotionFX::Motion::Update ( const Pose inputPose,
Pose outputPose,
MotionInstance instance 
)

The main update method, which outputs the result for a given motion instance into a given output local pose.

Parameters
inputPoseThe current pose, as it is currently in the blending pipeline.
outputPoseThe output pose, which this motion will modify and write its output into.
instanceThe motion instance to calculate the pose for.

Member Data Documentation

◆ m_autoUnregister

bool EMotionFX::Motion::m_autoUnregister = true
protected

Automatically unregister the motion from the motion manager when this motion gets deleted? Default is true.

◆ m_customData

void* EMotionFX::Motion::m_customData = nullptr
protected

A pointer to custom user data that is linked with this motion object.

◆ m_defaultPlayBackInfo

PlayBackInfo EMotionFX::Motion::m_defaultPlayBackInfo
protected

The default/fallback motion playback info which will be used when no playback info is passed to the Play() function.

◆ m_dirtyFlag

bool EMotionFX::Motion::m_dirtyFlag = false
protected

The dirty flag which indicates whether the user has made changes to the motion since the last file save operation.

◆ m_eventTable

AZStd::unique_ptr<MotionEventTable> EMotionFX::Motion::m_eventTable
protected

The event table, which contains all events, and will make sure events get executed.

◆ m_extractionFlags

EMotionExtractionFlags EMotionFX::Motion::m_extractionFlags
protected

The motion extraction flags, which define behavior of the motion extraction system when applied to this motion.

◆ m_fileName

AZStd::string EMotionFX::Motion::m_fileName
protected

The filename of the motion.

◆ m_fileUnitType

MCore::Distance::EUnitType EMotionFX::Motion::m_fileUnitType
protected

The type of units used, inside the file that got loaded.

◆ m_id

uint32 EMotionFX::Motion::m_id = MCORE_INVALIDINDEX32
protected

The unique identification number for the motion.

◆ m_motionData

MotionData* EMotionFX::Motion::m_motionData = nullptr
protected

The motion data, which can in theory be any data representation/compression.

◆ m_motionFps

float EMotionFX::Motion::m_motionFps = 30.0f
protected

The number of keyframes per second.

◆ m_nameId

uint32 EMotionFX::Motion::m_nameId = MCORE_INVALIDINDEX32
protected

The ID represention the name or description of this motion.

◆ m_rootMotionExtractionData

AZStd::shared_ptr<RootMotionExtractionData> EMotionFX::Motion::m_rootMotionExtractionData
protected

Root motion extraction settings

◆ m_unitType

MCore::Distance::EUnitType EMotionFX::Motion::m_unitType
protected

The type of units used.


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