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.
|
#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) |
MotionEventTable * | GetEventTable () 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) |
PlayBackInfo * | GetDefaultPlayBackInfo () |
const PlayBackInfo * | GetDefaultPlayBackInfo () 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 MotionData * | GetMotionData () const |
MotionData * | GetMotionData () |
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 | |
MotionData * | m_motionData = nullptr |
AZStd::shared_ptr< RootMotionExtractionData > | m_rootMotionExtractionData |
AZStd::string | m_fileName |
PlayBackInfo | m_defaultPlayBackInfo |
AZStd::unique_ptr< MotionEventTable > | m_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 () |
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.
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.
instance | The motion instance that contains the motion links to this motion. |
outTransform | The node transformation that will be the output of this function. |
actor | The actor to apply the motion to. |
node | The node to apply the motion to. |
timeValue | The time value. |
enableRetargeting | Set to true if you like to enable motion retargeting, otherwise set to false. |
bool EMotionFX::Motion::GetAutoUnregister | ( | ) | const |
Check if this motion is automatically being unregistered from the motion manager when this motion gets deleted or not.
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.
PlayBackInfo* EMotionFX::Motion::GetDefaultPlayBackInfo | ( | ) |
Get the default playback info of this motion.
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.
MotionEventTable* EMotionFX::Motion::GetEventTable | ( | ) | const |
Get the event table. This event table stores all motion events and can execute them as well.
const char* EMotionFX::Motion::GetFileName | ( | ) | const |
Get the filename of the motion.
const AZStd::string& EMotionFX::Motion::GetFileNameString | ( | ) | const |
Returns the filename of the motion, as a AZStd::string object.
uint32 EMotionFX::Motion::GetID | ( | ) | const |
Get the unique identification number for the motion.
EMotionExtractionFlags EMotionFX::Motion::GetMotionExtractionFlags | ( | ) | const |
Get the motion extraction flags.
float EMotionFX::Motion::GetMotionFPS | ( | ) | const |
Get the motion framerate.
const char* EMotionFX::Motion::GetName | ( | ) | const |
Returns the name of the motion.
const AZStd::string& EMotionFX::Motion::GetNameString | ( | ) | const |
Returns the name of the motion, as a AZStd::string object.
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).
scaleFactor | The scale factor to scale the current data by. |
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.
targetUnitType | The unit type to scale into (meters, centimeters, etc). |
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.
enabled | Set to true when you wish to automatically have the motion unregistered, otherwise set it to false. |
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.
dataPointer | The pointer to your custom data. This can also be nullptr. |
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.
playBackInfo | The new playback info which will be copied over to this motion's default playback info. |
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.
dirty | The dirty flag. |
void EMotionFX::Motion::SetEventTable | ( | AZStd::unique_ptr< MotionEventTable > | eventTable | ) |
Set the event table.
newTable | The new motion event table for the Motion to use. |
void EMotionFX::Motion::SetFileName | ( | const char * | filename | ) |
Set the filename of the motion.
[in] | filename | The filename of the motion. |
void EMotionFX::Motion::SetID | ( | uint32 | id | ) |
Set the unique identification number for the motion.
[in] | id | The unique identification number. |
void EMotionFX::Motion::SetIsOwnedByRuntime | ( | bool | isOwnedByRuntime | ) |
Marks the object as used by the engine runtime, as opposed to the tool suite.
void EMotionFX::Motion::SetMotionExtractionFlags | ( | EMotionExtractionFlags | flags | ) |
Set the motion extraction flags.
mask | The motion extraction flags to set. |
void EMotionFX::Motion::SetMotionFPS | ( | float | motionFPS | ) |
Set the motion framerate.
motionFPS | The number of keyframes per second. |
void EMotionFX::Motion::SetName | ( | const char * | name | ) |
Set the name of the motion.
name | The name of the motion. |
|
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.
actor | The actor to use as retarget source. |
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.
inputPose | The current pose, as it is currently in the blending pipeline. |
outputPose | The output pose, which this motion will modify and write its output into. |
instance | The motion instance to calculate the pose for. |
|
protected |
Automatically unregister the motion from the motion manager when this motion gets deleted? Default is true.
|
protected |
A pointer to custom user data that is linked with this motion object.
|
protected |
The default/fallback motion playback info which will be used when no playback info is passed to the Play() function.
|
protected |
The dirty flag which indicates whether the user has made changes to the motion since the last file save operation.
|
protected |
The event table, which contains all events, and will make sure events get executed.
|
protected |
The motion extraction flags, which define behavior of the motion extraction system when applied to this motion.
|
protected |
The filename of the motion.
|
protected |
The type of units used, inside the file that got loaded.
|
protected |
The unique identification number for the motion.
|
protected |
The motion data, which can in theory be any data representation/compression.
|
protected |
The number of keyframes per second.
|
protected |
The ID represention the name or description of this motion.
|
protected |
Root motion extraction settings
|
protected |
The type of units used.