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

#include <Importer.h>

Inherits EMotionFX::BaseObject.

Classes

struct  ActorSettings
 
struct  FileInfo
 
struct  ImportParameters
 
struct  MotionSetSettings
 
struct  MotionSettings
 
struct  NodeMapSettings
 

Public Types

enum  EFileType {
  FILETYPE_UNKNOWN = 0 , FILETYPE_ACTOR , FILETYPE_MOTION , FILETYPE_ANIMGRAPH ,
  FILETYPE_MOTIONSET , FILETYPE_NODEMAP
}
 
typedef bool(MCORE_CDECL * AttributeEndianConverter) (MCore::Attribute &attribute, MCore::Endian::EEndianType sourceEndianType)
 

Public Member Functions

AZStd::unique_ptr< ActorLoadActor (MCore::File *f, ActorSettings *settings=nullptr, const char *filename="")
 
AZStd::unique_ptr< ActorLoadActor (AZStd::string filename, ActorSettings *settings=nullptr)
 
AZStd::unique_ptr< ActorLoadActor (uint8 *memoryStart, size_t lengthInBytes, ActorSettings *settings=nullptr, const char *filename="")
 
bool ExtractActorFileInfo (FileInfo *outInfo, const char *filename) const
 
MotionLoadMotion (MCore::File *f, MotionSettings *settings=nullptr)
 
MotionLoadMotion (AZStd::string filename, MotionSettings *settings=nullptr)
 
MotionLoadMotion (uint8 *memoryStart, size_t lengthInBytes, MotionSettings *settings=nullptr)
 
bool ExtractMotionFileInfo (FileInfo *outInfo, const char *filename) const
 
AnimGraphLoadAnimGraph (AZStd::string, const AZ::ObjectStream::FilterDescriptor &loadFilter=AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES))
 
AnimGraphLoadAnimGraph (uint8 *memoryStart, size_t lengthInBytes)
 
MotionSetLoadMotionSet (AZStd::string filename, MotionSetSettings *settings=nullptr, const AZ::ObjectStream::FilterDescriptor &loadFilter=AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES))
 
MotionSetLoadMotionSet (uint8 *memoryStart, size_t lengthInBytes, MotionSetSettings *settings=nullptr)
 
NodeMapLoadNodeMap (MCore::File *f, NodeMapSettings *settings=nullptr)
 
NodeMapLoadNodeMap (AZStd::string filename, NodeMapSettings *settings=nullptr)
 
NodeMapLoadNodeMap (uint8 *memoryStart, size_t lengthInBytes, NodeMapSettings *settings=nullptr)
 
void RegisterChunkProcessor (ChunkProcessor *processorToRegister)
 
void SetLoggingEnabled (bool enabled)
 
bool GetLogging () const
 
void SetLogDetails (bool detailLoggingActive)
 
bool GetLogDetails () const
 
EFileType CheckFileType (const char *filename)
 
EFileType CheckFileType (MCore::File *file)
 
- Public Member Functions inherited from EMotionFX::BaseObject
 BaseObject ()
 
virtual ~BaseObject ()
 
- Public Member Functions inherited from MCore::MemoryObject
 MemoryObject ()
 
virtual ~MemoryObject ()
 
void IncreaseReferenceCount ()
 
void DecreaseReferenceCount ()
 
void Destroy ()
 
uint32 GetReferenceCount () const
 

Static Public Member Functions

static bool MCORE_CDECL StandardAttributeEndianConvert (MCore::Attribute &attribute, MCore::Endian::EEndianType sourceEndianType)
 
static ImporterCreate ()
 
static SharedDataFindSharedData (AZStd::vector< SharedData * > *sharedDataArray, uint32 type)
 

Friends

class Initializer
 
class EMotionFXManager
 

Additional Inherited Members

- Protected Member Functions inherited from EMotionFX::BaseObject
void Delete () override
 
virtual void Delete ()
 

Detailed Description

The EMotion FX importer, used to load actors, motions, animgraphs, motion sets and node maps and other EMotion FX related files. The files can be loaded from memory or disk.

Basic usage:

EMotionFX::Actor* actor = EMotionFX::GetImporter().LoadActor("TestActor.actor");
if (actor == nullptr)
    MCore::LogError("Failed to load the actor.");

The same applies to other types like motions, but using the LoadMotion, LoadAnimGraph and LoadMotionSet methods.

Member Typedef Documentation

◆ AttributeEndianConverter

typedef bool(MCORE_CDECL * EMotionFX::Importer::AttributeEndianConverter) (MCore::Attribute &attribute, MCore::Endian::EEndianType sourceEndianType)

The attribute data endian conversion callback. This callback is responsible for converting the endian of the data stored inside a given attribute into the currently expected endian.

Member Enumeration Documentation

◆ EFileType

The file types. This can be used to identify the file type, with the CheckFileType methods.

Enumerator
FILETYPE_UNKNOWN 

An unknown file, or something went wrong.

FILETYPE_ACTOR 

An actor file (.actor).

FILETYPE_MOTION 

A motion file (.motion).

FILETYPE_ANIMGRAPH 

A animgraph file (.animgraph).

FILETYPE_MOTIONSET 

A motion set file (.motionSet).

FILETYPE_NODEMAP 

A node map file (.nodeMap).

Member Function Documentation

◆ CheckFileType() [1/2]

EFileType EMotionFX::Importer::CheckFileType ( const char *  filename)

Check the type of a given file on disk.

Parameters
filenameThe file on disk to check.
Returns
Returns the file type. The FILETYPE_UNKNOWN will be returned when something goes wrong or the file format is unknown.

◆ CheckFileType() [2/2]

EFileType EMotionFX::Importer::CheckFileType ( MCore::File file)

Check the type of a given file (in memory or disk). The file will be closed after executing this method!

Parameters
fileThe file object to check.
Returns
Returns the file type. The FILETYPE_UNKNOWN will be returned when something goes wrong or the file format is unknown.

◆ FindSharedData()

static SharedData * EMotionFX::Importer::FindSharedData ( AZStd::vector< SharedData * > *  sharedDataArray,
uint32  type 
)
static

Find shared data objects which have the same type as the ID passed as parameter.

Parameters
sharedDataArrayThe shared data array to search in.
typeThe shared data ID to search for.
Returns
A pointer to the shared data object, or nullptr when no shared data of this type has been found.

◆ GetLogDetails()

bool EMotionFX::Importer::GetLogDetails ( ) const

Check if detail-logging is enabled or not.

Returns
Returns true when detail-logging is enabled, otherwise false is returned.

◆ GetLogging()

bool EMotionFX::Importer::GetLogging ( ) const

Check if logging is enabled or not.

Returns
Returns true when the importer will perform logging, or false when it will be totally silent.

◆ LoadActor() [1/3]

AZStd::unique_ptr< Actor > EMotionFX::Importer::LoadActor ( AZStd::string  filename,
ActorSettings settings = nullptr 
)

Loads an actor from a file on disk.

Parameters
filenameThe name of the file on disk.
settingsThe settings to use for loading. When set to nullptr, all defaults will be used and everything will be loaded.
Returns
Returns a pointer to the loaded actor, or nullptr when something went wrong and the actor could not be loaded.

◆ LoadActor() [2/3]

AZStd::unique_ptr< Actor > EMotionFX::Importer::LoadActor ( MCore::File f,
ActorSettings settings = nullptr,
const char *  filename = "" 
)

Load an actor from a given file. A file does not have to be stored on disk, but can also be in memory or in an archive or on some network stream. Anything is possible.

Parameters
fThe file to load the actor from (after load, the file will be closed).
settingsThe settings to use for loading. When set to nullptr, all defaults will be used and everything will be loaded.
filenameThe file name to set inside the Actor object. This is not going to load the actor from the file specified to this parameter, but just updates the value returned by actor->GetFileName().
Returns
Returns a pointer to the loaded actor, or nullptr when something went wrong and the actor could not be loaded.

◆ LoadActor() [3/3]

AZStd::unique_ptr< Actor > EMotionFX::Importer::LoadActor ( uint8 *  memoryStart,
size_t  lengthInBytes,
ActorSettings settings = nullptr,
const char *  filename = "" 
)

Loads an actor from memory.

Parameters
memoryStartThe start address of the file in memory.
lengthInBytesThe length of the file, in bytes.
settingsThe settings to use for loading. When set to nullptr, all defaults will be used and everything will be loaded.
filenameThe file name to set inside the Actor object. This is not going to load the actor from the file specified to this parameter, but just updates the value returned by actor->GetFileName().
Returns
Returns a pointer to the loaded actor, or nullptr when something went wrong and the actor could not be loaded.

◆ LoadAnimGraph() [1/2]

AnimGraph * EMotionFX::Importer::LoadAnimGraph ( AZStd::string  ,
const AZ::ObjectStream::FilterDescriptor &  loadFilter = AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES) 
)

Load a anim graph file by filename.

Parameters
filenameThe filename to load from.
loadFilterThe filter descriptor for loading anim graph from file
Returns
The anim graph object, or nullptr in case loading failed.

◆ LoadAnimGraph() [2/2]

AnimGraph * EMotionFX::Importer::LoadAnimGraph ( uint8 *  memoryStart,
size_t  lengthInBytes 
)

Load a anim graph file from a memory location.

Parameters
memoryStartThe start address of the file in memory.
lengthInBytesThe length of the file, in bytes.
Returns
The anim graph object, or nullptr in case loading failed.

◆ LoadMotion() [1/3]

Motion * EMotionFX::Importer::LoadMotion ( AZStd::string  filename,
MotionSettings settings = nullptr 
)

Loads a motion from a file on disk.

Parameters
filenameThe name of the file on disk.
settingsThe settings to use during loading, or nullptr when you want to use default settings, which would load everything.
Returns
Returns a pointer to the loaded motion, or nullptr when something went wrong and the motion could not be loaded.

◆ LoadMotion() [2/3]

Motion * EMotionFX::Importer::LoadMotion ( MCore::File f,
MotionSettings settings = nullptr 
)

Load a motion from a given file. A file does not have to be stored on disk, but can also be in memory or in an archive or on some network stream. Anything is possible.

Parameters
fThe file to load the motion from (after load, the file will be closed).
settingsThe settings to use during loading, or nullptr when you want to use default settings, which would load everything.
Returns
Returns a pointer to the loaded motion, or nullptr when something went wrong and the motion could not be loaded.

◆ LoadMotion() [3/3]

Motion * EMotionFX::Importer::LoadMotion ( uint8 *  memoryStart,
size_t  lengthInBytes,
MotionSettings settings = nullptr 
)

Loads a motion from memory.

Parameters
memoryStartThe start address of the file in memory.
lengthInBytesThe length of the file, in bytes.
settingsThe settings to use during loading, or nullptr when you want to use default settings, which would load everything.
Returns
Returns a pointer to the loaded motion, or nullptr when something went wrong and the motion could not be loaded.

◆ LoadMotionSet() [1/2]

MotionSet * EMotionFX::Importer::LoadMotionSet ( AZStd::string  filename,
MotionSetSettings settings = nullptr,
const AZ::ObjectStream::FilterDescriptor &  loadFilter = AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES) 
)

Loads a motion set from a file on disk.

Parameters
filenameThe name of the file on disk.
settingsThe motion set importer settings, or nullptr to use default settings.
loadFilterThe filter descriptor for loading motion set from file
Returns
The motion set object, or nullptr in case loading failed.

◆ LoadMotionSet() [2/2]

MotionSet * EMotionFX::Importer::LoadMotionSet ( uint8 *  memoryStart,
size_t  lengthInBytes,
MotionSetSettings settings = nullptr 
)

Loads a motion set from memory.

Parameters
memoryStartThe start address of the file in memory.
lengthInBytesThe length of the file, in bytes.
settingsThe motion set importer settings, or nullptr to use default settings.
Returns
The motion set object, or nullptr in case loading failed.

◆ LoadNodeMap() [1/3]

NodeMap * EMotionFX::Importer::LoadNodeMap ( AZStd::string  filename,
NodeMapSettings settings = nullptr 
)

Loads a node map from a file on disk.

Parameters
filenameThe name of the file on disk.
settingsThe node map importer settings, or nullptr to use default settings.
Returns
The node map object, or nullptr in case loading failed.

◆ LoadNodeMap() [2/3]

NodeMap * EMotionFX::Importer::LoadNodeMap ( MCore::File f,
NodeMapSettings settings = nullptr 
)

Load a node map from a given file. A file does not have to be stored on disk, but can also be in memory or in an archive or on some network stream. Anything is possible.

Parameters
fThe file to load the motion set from (after load, the file will be closed).
settingsThe node map importer settings, or nullptr to use default settings.
Returns
The node map object, or nullptr in case loading failed.

◆ LoadNodeMap() [3/3]

NodeMap * EMotionFX::Importer::LoadNodeMap ( uint8 *  memoryStart,
size_t  lengthInBytes,
NodeMapSettings settings = nullptr 
)

Loads a node map from memory.

Parameters
memoryStartThe start address of the file in memory.
lengthInBytesThe length of the file, in bytes.
settingsThe node map importer settings, or nullptr to use default settings.
Returns
The motion set object, or nullptr in case loading failed.

◆ RegisterChunkProcessor()

void EMotionFX::Importer::RegisterChunkProcessor ( ChunkProcessor processorToRegister)

Register a new chunk processor. It can either be a new version of a chunk processor to extend the current file format or a complete new chunk processor. It will be added to the processor database and will then be executable.

Parameters
processorToRegisterThe processor to register to the importer.

◆ SetLogDetails()

void EMotionFX::Importer::SetLogDetails ( bool  detailLoggingActive)

Set if the importer should log the processor details or not.

Parameters
detailLoggingActiveSet to true when you want to enable this feature, otherwise set it to false.

◆ SetLoggingEnabled()

void EMotionFX::Importer::SetLoggingEnabled ( bool  enabled)

Enable or disable logging.

Parameters
enabledSet to true if you want to enable logging, or false when you want to disable it.

◆ StandardAttributeEndianConvert()

static bool MCORE_CDECL EMotionFX::Importer::StandardAttributeEndianConvert ( MCore::Attribute attribute,
MCore::Endian::EEndianType  sourceEndianType 
)
static

The standard endian conversion callback which converts endian for attribute data. This automatically handles the default types of the attributes.

Parameters
attributeThe attribute to convert the endian for.
sourceEndianTypeThe endian type the data is stored in before conversion.
Returns
Returns true when conversion was successful or false when the attribute uses an unknown data type, which we don't know how to convert.

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