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

Classes

class  MotionEntry
 

Public Types

typedef AZStd::unordered_map< AZStd::string, MotionSet::MotionEntry * > MotionEntries
 

Public Member Functions

 MotionSet ()
 
 MotionSet (const char *name, MotionSet *parent=nullptr)
 
virtual ~MotionSet ()
 
void SetID (uint32 id)
 
uint32 GetID () const
 
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
 
AZStd::string ConstructMotionFilename (const MotionEntry *motionEntry)
 
void AddMotionEntry (MotionEntry *motionEntry)
 
MCORE_INLINE size_t GetNumMotionEntries () const
 
const MotionEntriesGetMotionEntries () const
 
void RecursiveGetMotions (AZStd::unordered_set< Motion * > &childMotions) const
 
void ReserveMotionEntries (size_t numMotionEntries)
 
void Clear ()
 
void RemoveMotionEntry (MotionEntry *motionEntry)
 
MotionEntryFindMotionEntry (const Motion *motion) const
 
MotionEntryFindMotionEntryById (const AZStd::string &motionId) const
 
MotionEntryRecursiveFindMotionEntryById (const AZStd::string &motionId) const
 
MotionRecursiveFindMotionById (const AZStd::string &motionId, bool loadOnDemand=true) const
 
MotionSetRecursiveFindMotionSetByName (const AZStd::string &motionSetName, bool isOwnedByRuntime=false) const
 
void SetMotionEntryId (MotionEntry *motionEntry, const AZStd::string &newMotionId)
 
MotionLoadMotion (MotionEntry *entry) const
 
void Preload ()
 
void Reload ()
 
void AddChildSet (MotionSet *motionSet)
 
size_t GetNumChildSets () const
 
MotionSetGetChildSet (size_t index) const
 
void RecursiveGetMotionSets (AZStd::vector< const MotionSet * > &childMotionSets, bool isOwnedByRuntime=false) const
 
void RemoveChildSetByID (uint32 childSetID)
 
MotionSetGetParentSet () const
 
void BuildIdStringList (AZStd::vector< AZStd::string > &idStrings) const
 
MotionSetFindRootMotionSet () const
 
void SetDirtyFlag (bool dirty)
 
bool GetDirtyFlag () const
 
void SetAutoUnregister (bool enabled)
 
bool GetAutoUnregister () const
 
void SetIsOwnedByRuntime (bool isOwnedByRuntime)
 
bool GetIsOwnedByRuntime () const
 
void SetIsOwnedByAsset (bool isOwnedByAsset)
 
bool GetIsOwnedByAsset () const
 
void SetCallback (MotionSetCallback *callback, bool delExistingOneFromMem=true)
 
MotionSetCallbackGetCallback () const
 
bool SaveToFile (const AZStd::string &filename, AZ::SerializeContext *context) const
 
void Log ()
 
size_t GetNumMorphMotions () const
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 
static MotionSetLoadFromFile (const AZStd::string &filename, AZ::SerializeContext *context, const AZ::ObjectStream::FilterDescriptor &loadFilter=AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES))
 
static MotionSetLoadFromBuffer (const void *buffer, const AZStd::size_t length, AZ::SerializeContext *context)
 

Member Typedef Documentation

◆ MotionEntries

typedef AZStd::unordered_map<AZStd::string, MotionSet::MotionEntry*> EMotionFX::MotionSet::MotionEntries

Get the container holding the motion entries for entry traversal.

Returns
The motion entry hashmap.

Constructor & Destructor Documentation

◆ MotionSet() [1/2]

EMotionFX::MotionSet::MotionSet ( )

Default constructor.

◆ MotionSet() [2/2]

EMotionFX::MotionSet::MotionSet ( const char *  name,
MotionSet parent = nullptr 
)

Constructor.

Parameters
[in]nameThe name of the motion set.
[in]parentThe parent motion set. This parameter is optional.

◆ ~MotionSet()

virtual EMotionFX::MotionSet::~MotionSet ( )
virtual

Destructor.

Member Function Documentation

◆ AddChildSet()

void EMotionFX::MotionSet::AddChildSet ( MotionSet motionSet)

Add the given motion set as a child set.

Parameters
[in]motionSetA pointer to the motion set that will be added as child set.

◆ AddMotionEntry()

void EMotionFX::MotionSet::AddMotionEntry ( MotionEntry motionEntry)

Add a motion entry to the motion set.

Parameters
[in]motionEntryA pointer to the motion entry to add.

◆ BuildIdStringList()

void EMotionFX::MotionSet::BuildIdStringList ( AZStd::vector< AZStd::string > &  idStrings) const

Generate a list of motion identifications strings. This will walk over all motions and get their id strings.

Parameters
[out]idStringsA list of motion identification strings from the motions inside the motion set. Make sure the array is empty before calling this function.

◆ Clear()

void EMotionFX::MotionSet::Clear ( )

Remove all motion entries from the motion set.

◆ FindMotionEntry()

MotionEntry* EMotionFX::MotionSet::FindMotionEntry ( const Motion motion) const

Find motion entry by motion pointer.

Parameters
[in]motionA pointer to the motion.
Returns
A pointer to the motion entry for the given motion. nullptr in case no motion entry has been found.

◆ FindRootMotionSet()

MotionSet* EMotionFX::MotionSet::FindRootMotionSet ( ) const

Recursively find the root motion set. This will return a pointer to itself when this is a root motion set already.

Returns
A pointer to the root motion set.

◆ GetAutoUnregister()

bool EMotionFX::MotionSet::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.

◆ GetChildSet()

MotionSet* EMotionFX::MotionSet::GetChildSet ( size_t  index) const

Get the given child motion set.

Parameters
[in]indexThe index of the child set to get. The index must be in range [0, GetNumChildSets()].
Returns
A pointer to the child set at the given index.

◆ GetDirtyFlag()

bool EMotionFX::MotionSet::GetDirtyFlag ( ) const

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

Returns
The dirty flag.

◆ GetFilename()

const char* EMotionFX::MotionSet::GetFilename ( ) const

Get the filename of the motion set.

Returns
The filename of the motion set.

◆ GetFilenameString()

const AZStd::string& EMotionFX::MotionSet::GetFilenameString ( ) const

Returns the filename of the motion set, as a string object.

Returns
The filename of the motion set.

◆ GetID()

uint32 EMotionFX::MotionSet::GetID ( ) const

Get the unique identification number for the motion set.

Returns
The unique identification number.

◆ GetName()

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

Returns the name of the motion set.

Returns
The name of the motion set.

◆ GetNameString()

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

Returns the name of the motion set, as a string object.

Returns
The name of the motion set.

◆ GetNumChildSets()

size_t EMotionFX::MotionSet::GetNumChildSets ( ) const

Get the number of child motion sets.

Returns
The number of child sets.

◆ GetNumMorphMotions()

size_t EMotionFX::MotionSet::GetNumMorphMotions ( ) const

Get the number of motion entries that contain morph data.

Returns
The number of motion entries that contain morph data.

◆ GetNumMotionEntries()

MCORE_INLINE size_t EMotionFX::MotionSet::GetNumMotionEntries ( ) const
inline

Get the number of motion entries.

Returns
The number of motion entries.

◆ GetParentSet()

MotionSet* EMotionFX::MotionSet::GetParentSet ( ) const

Get a pointer to the parent motion set. nullptr if this is a root set.

Returns
A pointer to the parent motion set. In case this is a root set nullptr will be returned.

◆ LoadMotion()

Motion* EMotionFX::MotionSet::LoadMotion ( MotionEntry entry) const

Load the motion for a given entry.

Parameters
[in]entryThe entry to load the motion for.
Returns
The motion object.

◆ Preload()

void EMotionFX::MotionSet::Preload ( )

Pre-load all motions inside the set and all its child sets. This prevents them from loading on demand only, in case loading performance is an issue.

◆ RecursiveGetMotions()

void EMotionFX::MotionSet::RecursiveGetMotions ( AZStd::unordered_set< Motion * > &  childMotions) const

Gets child motions recursively. Every Motion* returned in childMotions will have directly or indirectly this MotionSet as a parent

Parameters
[out]childMotionsset where the child motions are returned.

◆ RecursiveGetMotionSets()

void EMotionFX::MotionSet::RecursiveGetMotionSets ( AZStd::vector< const MotionSet * > &  childMotionSets,
bool  isOwnedByRuntime = false 
) const

Gets child motion sets recursively. Every MotionSet* returned in childMotionSets will have directly or indirectly this MotionSet as a parent

Parameters
[out]childMotionSetsset where the child motion sets are returned.

◆ Reload()

void EMotionFX::MotionSet::Reload ( )

Resets all motion entries and pre-loads them once again using the latest media root folder path.

◆ RemoveChildSetByID()

void EMotionFX::MotionSet::RemoveChildSetByID ( uint32  childSetID)

Remove the child set with the given id.

Parameters
[in]childSetIDThe id of the child set which will be removed.

◆ RemoveMotionEntry()

void EMotionFX::MotionSet::RemoveMotionEntry ( MotionEntry motionEntry)

Remove the given motion entry from the motion set.

Parameters
[in]motionEntryA pointer to the motion entry to remove.

◆ ReserveMotionEntries()

void EMotionFX::MotionSet::ReserveMotionEntries ( size_t  numMotionEntries)

Preallocate the array of motion entries. This will NOT grow the motion entries array as reported by GetNumMotionEntries(). However, it internally pre-allocates memory to make the AddMotionEntry() calls faster.

Parameters
[in]numMotionEntriesThe number of motion entries to peallocate

◆ SetAutoUnregister()

void EMotionFX::MotionSet::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.

◆ SetDirtyFlag()

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

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

Parameters
dirtyThe dirty flag.

◆ SetFilename()

void EMotionFX::MotionSet::SetFilename ( const char *  filename)

Set the filename of the motion set.

Parameters
[in]filenameThe filename of the motion set.

◆ SetID()

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

Set the unique identification number for the motion set.

Parameters
[in]idThe unique identification number.

◆ SetIsOwnedByAsset()

void EMotionFX::MotionSet::SetIsOwnedByAsset ( bool  isOwnedByAsset)

Marks the object as owned by an asset, as opposed to the tool suite.

◆ SetIsOwnedByRuntime()

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

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

◆ SetMotionEntryId()

void EMotionFX::MotionSet::SetMotionEntryId ( MotionEntry motionEntry,
const AZStd::string &  newMotionId 
)

Set a new motion id for the given motion entry. This will adjust the actual motion entry as well as update the hashmap.

Parameters
[in]motionEntryThe motion entry to change the id for.
[in]newMotionIdThe new motion id.

◆ SetName()

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

Set the name of the motion set.

Parameters
nameThe name of the motion set.

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