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

#include <Actor.h>

Classes

struct  Dependency
 
struct  NodeMirrorInfo
 

Public Types

enum  { MIRRORFLAG_INVERT_X = 1 << 0 , MIRRORFLAG_INVERT_Y = 1 << 1 , MIRRORFLAG_INVERT_Z = 1 << 2 }
 
enum  EAxis : uint8 { AXIS_X = 0 , AXIS_Y = 1 , AXIS_Z = 2 }
 
enum class  LoadRequirement : bool { RequireBlockingLoad , AllowAsyncLoad }
 

Public Member Functions

 Actor (const char *name)
 
MCORE_INLINE uint32 GetID () const
 
MCORE_INLINE void SetID (uint32 id)
 
void AddNode (Node *node)
 
NodeAddNode (size_t nodeIndex, const char *name, size_t parentIndex=InvalidIndex)
 
void RemoveNode (size_t nr, bool delMem=true)
 
void DeleteAllNodes ()
 
AZStd::unique_ptr< ActorClone () const
 
void Scale (float scaleFactor)
 
void ScaleToUnitType (MCore::Distance::EUnitType targetUnitType)
 
NodeFindBestMotionExtractionNode () const
 
void AutoSetMotionExtractionNode ()
 
void GenerateUpdatePathToRoot (size_t endNodeIndex, AZStd::vector< size_t > &outPath) const
 
void SetMotionExtractionNode (Node *node)
 
void SetMotionExtractionNodeIndex (size_t nodeIndex)
 
NodeGetMotionExtractionNode () const
 
MCORE_INLINE size_t GetMotionExtractionNodeIndex () const
 
bool CheckIfHasMeshes (size_t lodLevel) const
 
bool CheckIfHasSkinnedMeshes (size_t lodLevel) const
 
void ExtractBoneList (size_t lodLevel, AZStd::vector< size_t > *outBoneList) const
 
void SetPhysicsSetup (const AZStd::shared_ptr< PhysicsSetup > &physicsSetup)
 
const AZStd::shared_ptr< PhysicsSetup > & GetPhysicsSetup () const
 
void SetSimulatedObjectSetup (const AZStd::shared_ptr< SimulatedObjectSetup > &setup)
 
const AZStd::shared_ptr< SimulatedObjectSetup > & GetSimulatedObjectSetup () const
 
void AddLODLevel (bool copyFromLastLODLevel=true)
 
void CopyLODLevel (Actor *copyActor, size_t copyLODLevel, size_t replaceLODLevel, bool copySkeletalLODFlags)
 
void InsertLODLevel (size_t insertAt)
 
void SetNumLODLevels (size_t numLODs, bool adjustMorphSetup=true)
 
size_t GetNumLODLevels () const
 
void RemoveAllNodeMeshes ()
 
void CalcMeshTotals (size_t lodLevel, uint32 *outNumPolygons, uint32 *outNumVertices, uint32 *outNumIndices) const
 
void CalcStaticMeshTotals (size_t lodLevel, uint32 *outNumVertices, uint32 *outNumIndices)
 
void CalcDeformableMeshTotals (size_t lodLevel, uint32 *outNumVertices, uint32 *outNumIndices)
 
size_t CalcMaxNumInfluences (size_t lodLevel) const
 
size_t CalcMaxNumInfluences (size_t lodLevel, AZStd::vector< size_t > &outVertexCounts) const
 
void VerifySkinning (AZStd::vector< uint8 > &conflictNodeFlags, size_t skeletalLODLevel, size_t geometryLODLevel)
 
void * GetCustomData () const
 
void SetCustomData (void *dataPointer)
 
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 AddDependency (const Dependency &dependency)
 
MCORE_INLINE size_t GetNumDependencies () const
 
MCORE_INLINE DependencyGetDependency (size_t nr)
 
MCORE_INLINE const DependencyGetDependency (size_t nr) const
 
void RecursiveAddDependencies (const Actor *actor)
 
MCORE_INLINE MorphSetupGetMorphSetup (size_t geomLODLevel) const
 
void RemoveAllMorphSetups (bool deleteMeshDeformers=true)
 
void SetMorphSetup (size_t lodLevel, MorphSetup *setup)
 
size_t GetNumNodeGroups () const
 
NodeGroupGetNodeGroup (size_t index) const
 
void AddNodeGroup (NodeGroup *newGroup)
 
void RemoveNodeGroup (size_t index, bool delFromMem=true)
 
void RemoveNodeGroup (NodeGroup *group, bool delFromMem=true)
 
size_t FindNodeGroupIndexByName (const char *groupName) const
 
size_t FindNodeGroupIndexByNameNoCase (const char *groupName) const
 
NodeGroupFindNodeGroupByName (const char *groupName) const
 
NodeGroupFindNodeGroupByNameNoCase (const char *groupName) const
 
void RemoveAllNodeGroups ()
 
void AllocateNodeMirrorInfos ()
 
void RemoveNodeMirrorInfos ()
 
MCORE_INLINE NodeMirrorInfoGetNodeMirrorInfo (size_t nodeIndex)
 
MCORE_INLINE const NodeMirrorInfoGetNodeMirrorInfo (size_t nodeIndex) const
 
MCORE_INLINE bool GetHasMirrorInfo () const
 
void MatchNodeMotionSources (const char *subStringA, const char *subStringB)
 
bool MapNodeMotionSource (const char *sourceNodeName, const char *destNodeName)
 
bool MapNodeMotionSource (uint16 sourceNodeIndex, uint16 targetNodeIndex)
 
uint16 FindBestMatchForNode (const char *nodeName, const char *subStringA, const char *subStringB, bool firstPass=true) const
 
void MatchNodeMotionSourcesGeometrical ()
 
uint16 FindBestMirrorMatchForNode (uint16 nodeIndex, Pose &pose) const
 
void SetDirtyFlag (bool dirty)
 
bool GetDirtyFlag () const
 
void SetIsUsedForVisualization (bool flag)
 
bool GetIsUsedForVisualization () const
 
size_t FindFirstActiveParentBone (size_t skeletalLOD, size_t startNodeIndex) const
 
void MakeGeomLODsCompatibleWithSkeletalLODs ()
 
void ReinitializeMeshDeformers ()
 
void PostCreateInit (bool makeGeomLodsCompatibleWithSkeletalLODs=true, bool convertUnitType=true)
 
void AutoDetectMirrorAxes ()
 
const AZStd::vector< NodeMirrorInfo > & GetNodeMirrorInfos () const
 
AZStd::vector< NodeMirrorInfo > & GetNodeMirrorInfos ()
 
void SetNodeMirrorInfos (const AZStd::vector< NodeMirrorInfo > &mirrorInfos)
 
bool GetHasMirrorAxesDetected () const
 
MCORE_INLINE const AZStd::vector< Transform > & GetInverseBindPoseTransforms () const
 
MCORE_INLINE PoseGetBindPose ()
 
MCORE_INLINE const PoseGetBindPose () const
 
MCORE_INLINE const Transform & GetInverseBindPoseTransform (size_t nodeIndex) const
 
void ReleaseTransformData ()
 
void ResizeTransformData ()
 
void CopyTransformsFrom (const Actor *other)
 
const AZ::Aabb & GetStaticAabb () const
 
void SetStaticAabb (const AZ::Aabb &aabb)
 
void UpdateStaticAabb ()
 
void SetThreadIndex (uint32 index)
 
uint32 GetThreadIndex () const
 
MeshGetMesh (size_t lodLevel, size_t nodeIndex) const
 
MeshDeformerStackGetMeshDeformerStack (size_t lodLevel, size_t nodeIndex) const
 
void FindMostInfluencedMeshPoints (const Node *node, AZStd::vector< AZ::Vector3 > &outPoints) const
 
MCORE_INLINE SkeletonGetSkeleton () const
 
MCORE_INLINE size_t GetNumNodes () const
 
void SetMesh (size_t lodLevel, size_t nodeIndex, Mesh *mesh)
 
void SetMeshDeformerStack (size_t lodLevel, size_t nodeIndex, MeshDeformerStack *stack)
 
bool CheckIfHasMorphDeformer (size_t lodLevel, size_t nodeIndex) const
 
bool CheckIfHasSkinningDeformer (size_t lodLevel, size_t nodeIndex) const
 
void RemoveNodeMeshForLOD (size_t lodLevel, size_t nodeIndex, bool destroyMesh=true)
 
void SetNumNodes (size_t numNodes)
 
void SetUnitType (MCore::Distance::EUnitType unitType)
 
MCore::Distance::EUnitType GetUnitType () const
 
void SetFileUnitType (MCore::Distance::EUnitType unitType)
 
MCore::Distance::EUnitType GetFileUnitType () const
 
EAxis FindBestMatchingMotionExtractionAxis () const
 
MCORE_INLINE size_t GetRetargetRootNodeIndex () const
 
MCORE_INLINE NodeGetRetargetRootNode () const
 
void SetRetargetRootNodeIndex (size_t nodeIndex)
 
void SetRetargetRootNode (Node *node)
 
void AutoSetupSkeletalLODsBasedOnSkinningData (const AZStd::vector< AZStd::string > &alwaysIncludeJoints)
 
void PrintSkeletonLODs ()
 
void GenerateOptimizedSkeleton ()
 
void SetOptimizeSkeleton (bool optimizeSkeleton)
 
bool GetOptimizeSkeleton () const
 
void SetMeshAssetId (const AZ::Data::AssetId &assetId)
 
AZ::Data::AssetId GetMeshAssetId () const
 
const AZ::Data::Asset< AZ::RPI::ModelAsset > & GetMeshAsset () const
 
const AZ::Data::Asset< AZ::RPI::SkinMetaAsset > & GetSkinMetaAsset () const
 
const AZ::Data::Asset< AZ::RPI::MorphTargetMetaAsset > & GetMorphTargetMetaAsset () const
 
const AZStd::unordered_map< AZ::u16, AZ::u16 > & GetSkinToSkeletonIndexMap () const
 
bool IsReady () const
 
void Finalize (LoadRequirement loadReq=LoadRequirement::AllowAsyncLoad)
 

Detailed Description

The actor is the representation of a completely animatable object, like a human character or an animal. It represents a (read only) shared data object, from which ActorInstance objects can be created. The actor instance objects are used as characters in the game and can all be controlled individually, while they still share the same data from the Actor class. The Actor contains information about the hierarchy/structure of the characters.

Constructor & Destructor Documentation

◆ Actor()

EMotionFX::Actor::Actor ( const char *  name)
explicit
Parameters
nameThe name of the actor.

Member Function Documentation

◆ AddDependency()

void EMotionFX::Actor::AddDependency ( const Dependency dependency)

Add a dependency to the actor. Dependencies are used to identify on what other actor objects this actor relies. This can be because this actor uses meshes or transforms that are stored inside the other actor.

Parameters
dependencyThe dependency to add.

◆ AddLODLevel()

void EMotionFX::Actor::AddLODLevel ( bool  copyFromLastLODLevel = true)

Add a LOD level.

Parameters
[in]copyFromLastLevelLODTrue in case the new LOD level should contain the same meshes as the last LOD level. In case of false the meshes and everything won't be copied over.

◆ AddNode() [1/2]

void EMotionFX::Actor::AddNode ( Node node)

Add a node to this actor.

Parameters
nodeThe node to add.

◆ AddNode() [2/2]

Node* EMotionFX::Actor::AddNode ( size_t  nodeIndex,
const char *  name,
size_t  parentIndex = InvalidIndex 
)

Add a node to this actor.

◆ AddNodeGroup()

void EMotionFX::Actor::AddNodeGroup ( NodeGroup newGroup)

Add a node group.

Parameters
newGroupThe new node group to add.

◆ AllocateNodeMirrorInfos()

void EMotionFX::Actor::AllocateNodeMirrorInfos ( )

Allocate data for the node motion mirror info. This resizes the array of node motion infos and initializes it on default values.

◆ AutoSetMotionExtractionNode()

void EMotionFX::Actor::AutoSetMotionExtractionNode ( )

Automatically find the best motion extraction node, using FindBestMotionExtractionNode and set it as current motion extraction node.

◆ CalcDeformableMeshTotals()

void EMotionFX::Actor::CalcDeformableMeshTotals ( size_t  lodLevel,
uint32 *  outNumVertices,
uint32 *  outNumIndices 
)

Calculates the total number of vertices and indices of all DEFORMABLE node meshes for the given LOD. With deformable we mean meshes that are being modified by mesh deformers, such as skinning or morphing deformers. The number of faces can be calculated by dividing the resulting number of indices by 3.

Parameters
lodLevelThe LOD level, where 0 is the highest detail LOD level. This value must be in range of [0..GetNumLODLevels()-1].
outNumVerticesThe integer to write the number of vertices in.
outNumIndicesThe integer to write the number of indices in.

◆ CalcMaxNumInfluences() [1/2]

size_t EMotionFX::Actor::CalcMaxNumInfluences ( size_t  lodLevel) const

Calculates the maximum number of bone influences. This is calculated by for each vertex checking the number of bone influences, and take the maximum of that amount.

Parameters
lodLevelThe LOD level, where 0 is the highest detail LOD level. This value must be in range of [0..GetNumLODLevels()-1].
Returns
The maximum number of influences. This will be 0 for non-softskinned objects.

◆ CalcMaxNumInfluences() [2/2]

size_t EMotionFX::Actor::CalcMaxNumInfluences ( size_t  lodLevel,
AZStd::vector< size_t > &  outVertexCounts 
) const

Calculates the maximum number of bone influences. Also provides an array containing the number of vertices for each number of influences.

Parameters
lodLevelThe LOD level, where 0 is the highest detail LOD level. This value must be in range of [0..GetNumLODLevels()-1].
vertexCountsAn output array, which will contain for each number of influences, the number of vertices with this number of influences. In other words, the first element of the array will contain the number of vertices, which have 0 influences. The next element in the array will contain the number of vertices, which are influenced by exactly 1 bone, etc.
lodLevelThe detail level to calculate the results for. A value of 0 is the highest detail.
Returns
The maximum number of vertex/bone influences. This will be 0 for rigid, non-skinned objects.

◆ CalcMeshTotals()

void EMotionFX::Actor::CalcMeshTotals ( size_t  lodLevel,
uint32 *  outNumPolygons,
uint32 *  outNumVertices,
uint32 *  outNumIndices 
) const

Calculates the total number of vertices and indices of all node meshes for the given LOD.

Parameters
lodLevelThe LOD level, where 0 is the highest detail LOD level. This value must be in range of [0..GetNumLODLevels()-1].
outNumPolygonsThe integer to write the number of polygons in.
outNumVerticesThe integer to write the number of vertices in.
outNumIndicesThe integer to write the number of indices in.

◆ CalcStaticMeshTotals()

void EMotionFX::Actor::CalcStaticMeshTotals ( size_t  lodLevel,
uint32 *  outNumVertices,
uint32 *  outNumIndices 
)

Calculates the total number of vertices and indices of all STATIC node meshes for the given LOD. With static we mean the meshes that are NOT effected by any deformers, so which are completely rigid.

Parameters
lodLevelThe LOD level, where 0 is the highest detail LOD level. This value must be in range of [0..GetNumLODLevels()-1].
outNumVerticesThe integer to write the number of vertices in.
outNumIndicesThe integer to write the number of indices in.

◆ CheckIfHasMeshes()

bool EMotionFX::Actor::CheckIfHasMeshes ( size_t  lodLevel) const

Check if this actor contains any nodes that have meshes.

Parameters
lodLevelThe LOD level to check for.
Returns
Returns true when this actor contains nodes that have meshes in the given LOD, otherwise false is returned.

◆ CheckIfHasSkinnedMeshes()

bool EMotionFX::Actor::CheckIfHasSkinnedMeshes ( size_t  lodLevel) const

Check if we have skinned meshes.

Parameters
lodLevelThe LOD level to check for.
Returns
Returns true when skinned meshes are present in the specified LOD level, otherwise false is returned.

◆ Clone()

AZStd::unique_ptr<Actor> EMotionFX::Actor::Clone ( ) const

Clones this actor.

Returns
A pointer to the duplicated clone.

◆ CopyLODLevel()

void EMotionFX::Actor::CopyLODLevel ( Actor copyActor,
size_t  copyLODLevel,
size_t  replaceLODLevel,
bool  copySkeletalLODFlags 
)

Copy data from a given LOD level to another one. This will copy the skeletal LOD flag for the nodes, copy over the meshes and their deformer stacks, the materials as well as the whole morph setup.

Parameters
[in]copyActorThe actor to copy the LOD level from.
[in]copyLODLevelThe LOD level from which we get the data from.
[in]replaceLODLevelThe LOD level to which we copy the data to.
[in]copySkeletalLODFlagsCopy over the skeletal LOD flags in case of true, skip them in case of false.
[in]delLODActorFromMemWhen set to true, the method will automatically delete the given copyActor from memory.

◆ DeleteAllNodes()

void EMotionFX::Actor::DeleteAllNodes ( )

Remove all nodes from memory.

◆ ExtractBoneList()

void EMotionFX::Actor::ExtractBoneList ( size_t  lodLevel,
AZStd::vector< size_t > *  outBoneList 
) const

Extract a list with nodes that represent bones. Not all nodes inside an actor have to be bones. With bones we mean nodes that appear inside the skinning information of the meshes. So nodes that have vertices linked to them. Extracting this information is not fast, so shouldn't be done inside a loop.

Parameters
lodLevelThe LOD level, which must be in range of 0..GetNumLODLevels().
outBoneListThe array of indices to nodes that will be filled with the nodes that are bones. When the outBoneList array already contains items, the array will first be cleared, so all existing contents will be lost.

◆ Finalize()

void EMotionFX::Actor::Finalize ( LoadRequirement  loadReq = LoadRequirement::AllowAsyncLoad)

Finalize the actor with preload assets (mesh, skinmeta and morph target assets). LoadRequirement - We won't need a blocking load if the actor is part of the actor asset, as that will trigger the preload assets to load and get ready before finalize has been reached. However, if we are calling this on an actor that bypassed the asset system (e.g loading the actor directly from disk), it will require a blocking load. This option is now being used because emfx editor does not fully integrate with the asset system.

◆ FindBestMatchForNode()

uint16 EMotionFX::Actor::FindBestMatchForNode ( const char *  nodeName,
const char *  subStringA,
const char *  subStringB,
bool  firstPass = true 
) const

Find the best match for a given node, using two substrings. For example, if you use the node name "Right Leg" and you use as subStringA "Right" and as subStringB "Left", then it will result most likely (asssuming that node exists) in the node with the name "Left Leg". You can use this to guess the most most likely match for a given node, when using motion mirroring. Please note that artists can all setup this already. If you want to do it manually you might also want to use the MatchNodeMotionSources function instead.

Parameters
nodeNameThe name of the node to find the counter-mirror-node for.
subStringAThe first substring, for example "Left".
subStringBThe second substring, for example "Right".
firstPassBasically just set this to true always, which is also its default.
Returns
The node index for the node that matches best, or MCORE_INVALIDINDEX16 (please note the 16 and NOT 32) when no good match has been found.

◆ FindBestMotionExtractionNode()

Node* EMotionFX::Actor::FindBestMotionExtractionNode ( ) const

Try to find the best motion extraction node automatically. It picks the node with the most number of child nodes down the hierarchy below that node.

Returns
A pointer to the best suitable motion extraction node, or nullptr when no node could be found.

◆ FindFirstActiveParentBone()

size_t EMotionFX::Actor::FindFirstActiveParentBone ( size_t  skeletalLOD,
size_t  startNodeIndex 
) const

Recursively find the parent bone that is enabled in a given LOD, starting from a given node. For example if you have a finger bone, while the finger bones are disabled in the skeletal LOD, this function will return the index to the hand bone. This is because the hand bone will most likely be the first active bone in that LOD, when moving up the hierarchy.

Parameters
skeletalLODThe skeletal LOD level to search in.
startNodeIndexThe node to start looking at, for example the node index of the finger bone.
Returns
Returns the index of the first active node, when moving up the hierarchy towards the root node. Returns MCORE_INVALIDINDEX32 when not found.

◆ FindMostInfluencedMeshPoints()

void EMotionFX::Actor::FindMostInfluencedMeshPoints ( const Node node,
AZStd::vector< AZ::Vector3 > &  outPoints 
) const

Finds the mesh points for which the specified node is the node with the highest influence. This is a pretty expensive function which is only intended for use in the editor. The resulting points will be given in model space.

Parameters
nodeThe node for which the most heavily influenced mesh points are sought.
[out]outPointsContainer which will be filled with the points for which the node is the heaviest influence.

◆ FindNodeGroupByName()

NodeGroup* EMotionFX::Actor::FindNodeGroupByName ( const char *  groupName) const

Find a node group by its name.

Parameters
groupNameThe name of the group to search for. This is case sensitive.
Returns
A pointer to the node group, or nullptr when it cannot be found.

◆ FindNodeGroupByNameNoCase()

NodeGroup* EMotionFX::Actor::FindNodeGroupByNameNoCase ( const char *  groupName) const

Find a node group by its name, but without case sensitivity.

Parameters
groupNameThe name of the group to search for. This is NOT case sensitive.
Returns
A pointer to the node group, or nullptr when it cannot be found.

◆ FindNodeGroupIndexByName()

size_t EMotionFX::Actor::FindNodeGroupIndexByName ( const char *  groupName) const

Find a node group index by its name.

Parameters
groupNameThe name of the group to search for. This is case sensitive.
Returns
The group number, or MCORE_INVALIDINDEX32 when it cannot be found.

◆ FindNodeGroupIndexByNameNoCase()

size_t EMotionFX::Actor::FindNodeGroupIndexByNameNoCase ( const char *  groupName) const

Find a group index by its name, on a non-case sensitive way.

Parameters
groupNameThe name of the group to search for. This is NOT case sensitive.
Returns
The group number, or MCORE_INVALIDINDEX32 when it cannot be found.

◆ GenerateUpdatePathToRoot()

void EMotionFX::Actor::GenerateUpdatePathToRoot ( size_t  endNodeIndex,
AZStd::vector< size_t > &  outPath 
) const

Generate an update path from a given node towards the root. The first element in the array will be the end node index, the next node will be its parent node, etc. So the last node will be the root node.

Parameters
endNodeIndexThe node index to generate the path to.
outPaththe array that will contain the path.

◆ GetCustomData()

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

Get a pointer to the custom data you stored. Custom data can for example link a game or engine object with this EMotion FX actor object. An example is when EMotion FX triggers a motion event. You know the actor that triggered the event, but you don't know directly what game or engine object is linked to this actor. By using the custom data methods GetCustomData and SetCustomData you can set a pointer to your game or engine object in each actor. The pointer that you specify will not be deleted when the actor object is being destructed.

Returns
A void pointer to the custom data you have specified.

◆ GetDependency()

MCORE_INLINE Dependency* EMotionFX::Actor::GetDependency ( size_t  nr)
inline

Get a given dependency.

Parameters
nrThe dependency number, which must be in range of [0..GetNumDependencies()-1].
Returns
A pointer to the dependency.

◆ GetDirtyFlag()

bool EMotionFX::Actor::GetDirtyFlag ( ) const

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

Returns
The dirty flag.

◆ GetFileName()

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

Get the filename of the actor.

Returns
The filename of the actor.

◆ GetFileNameString()

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

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

Returns
The filename of the actor.

◆ GetID()

MCORE_INLINE uint32 EMotionFX::Actor::GetID ( ) const
inline

Get the unique identification number for the actor.

Returns
The unique identification number.

◆ GetInverseBindPoseTransform()

MCORE_INLINE const Transform& EMotionFX::Actor::GetInverseBindPoseTransform ( size_t  nodeIndex) const
inline

Get the inverse bind pose (in world space) transform of a given joint.

Parameters
jointIndexThe joint number, which must be in range of [0..GetNumNodes()-1].
Returns
The inverse of the bind pose transform.

◆ GetMorphSetup()

MCORE_INLINE MorphSetup* EMotionFX::Actor::GetMorphSetup ( size_t  geomLODLevel) const
inline

Get the morph setup at a given geometry LOD level.

Parameters
geomLODLevelThe geometry LOD level, which must be in range of [0..GetNumLODLevels()].
Returns
A smart pointer object to the morph setup. Use the MCore::Pointer<MorphSetup>::GetPointer() to get the actual pointer. That GetPointer() method will return nullptr when there is no morph setup for the given LOD level.

◆ GetMotionExtractionNode()

Node* EMotionFX::Actor::GetMotionExtractionNode ( ) const

Get the motion extraction node.

Returns
The motion extraction node, or nullptr when it has not been set.

◆ GetMotionExtractionNodeIndex()

MCORE_INLINE size_t EMotionFX::Actor::GetMotionExtractionNodeIndex ( ) const
inline

Get the motion extraction node index.

Returns
The motion extraction node index, or MCORE_INVALIDINDEX32 when it has not been set.

◆ GetName()

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

Get the name of the actor.

Returns
The name of the actor.

◆ GetNameString()

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

Get the name of the actor as a Core string object.

Returns
The string containing the name of the actor.

◆ GetNodeGroup()

NodeGroup* EMotionFX::Actor::GetNodeGroup ( size_t  index) const

Get a pointer to a given node group.

Parameters
indexThe node group index, which must be in range of [0..GetNumNodeGroups()-1].

◆ GetNodeMirrorInfo() [1/2]

MCORE_INLINE NodeMirrorInfo& EMotionFX::Actor::GetNodeMirrorInfo ( size_t  nodeIndex)
inline

Get the mirror info for a given node.

Parameters
nodeIndexThe node index to get the info for.
Returns
A reference to the mirror info.

◆ GetNodeMirrorInfo() [2/2]

MCORE_INLINE const NodeMirrorInfo& EMotionFX::Actor::GetNodeMirrorInfo ( size_t  nodeIndex) const
inline

Get the mirror info for a given node.

Parameters
nodeIndexThe node index to get the info for.
Returns
A reference to the mirror info.

◆ GetNumDependencies()

MCORE_INLINE size_t EMotionFX::Actor::GetNumDependencies ( ) const
inline

Get the number of dependencies.

Returns
The number of dependencies that this actor has on other actors.

◆ GetNumLODLevels()

size_t EMotionFX::Actor::GetNumLODLevels ( ) const

Get the number of LOD levels inside this actor.

Returns
The number of LOD levels. This value is at least 1, since the full detail LOD is always there.

◆ GetNumNodeGroups()

size_t EMotionFX::Actor::GetNumNodeGroups ( ) const

Get the number of node groups inside this actor object.

Returns
The number of node groups.

◆ InsertLODLevel()

void EMotionFX::Actor::InsertLODLevel ( size_t  insertAt)

Insert LOD level at the given position. This function will not copy any meshes, deformer, morph targets or materials but just insert an empty LOD level.

Parameters
[in]insertAtThe position to insert the new LOD level.

◆ IsReady()

bool EMotionFX::Actor::IsReady ( ) const
inline

Is the actor fully ready?

Returns
True in case the actor as well as its dependent files (e.g. mesh, skin, morph targets) are fully loaded and initialized.

◆ MakeGeomLODsCompatibleWithSkeletalLODs()

void EMotionFX::Actor::MakeGeomLODsCompatibleWithSkeletalLODs ( )

Make the geometry LOD levels compatible with the skinning LOD levels. This means that it modifies the skinning information so that disabled bones are not used by the meshes anymore. Instead, the skinning influences are remapped to the first enabled parent bone. So if you disable all finger bones in a given LOD, it will adjust the skinning influences so that the vertices of the fingers are linked to the hand bone instead.

◆ MapNodeMotionSource()

bool EMotionFX::Actor::MapNodeMotionSource ( const char *  sourceNodeName,
const char *  destNodeName 
)

Map two nodes to eachother for motion mirroring. This could be used to tell to play the motion for the right arm on the left arm. The parameters you would give would be like: "Left Arm" and "Right Arm" in that case.

Parameters
sourceNodeNameThe name of the first node, for example "Left Hand".
destNodeNameThe name of the second node, for example "Right Hand".
Returns
Returns true when the mapping was successful, or false when one of the nodes cannot be found.

◆ MatchNodeMotionSources()

void EMotionFX::Actor::MatchNodeMotionSources ( const char *  subStringA,
const char *  subStringB 
)

Match and map the motion sources of given nodes, based on two substrings. This is used for motion mirroring, where we want to play the motion of the left arm on the right arm for example. If you have nodes named like "Left Leg", "Left Arm" "My Left Foot" and "My Right Foot", "Right Leg" and "Right Arm", then you can use the following substrings as parameters to match everything automatically: subStringA="Left" and subStringB="Right". Nodes that have no mirrored match (for example the spine bones) will mirror their own transforms when mirroring is enabled. It doesn't matter if you put the "left" or "right" substring inside subStringA or subStringB. The order of them doesn't matter. Also please note that artists can already setup all this, so your model is probably already prepared for mirroring once loaded if you are planning to use motion mirroring.

Parameters
subStringAThe first substring, which could be something like "Left" or "Bip01 " or " L ".
subStringBThe second substring, which could be something like "Right" or "Bip01 R" or " R ".

◆ RecursiveAddDependencies()

void EMotionFX::Actor::RecursiveAddDependencies ( const Actor actor)

Recursively add dependencies that this actor has on other actors. This adds the dependencies of the actors on which we currently have dependencies, and that recursively. So after executing this, the current actor contains all dependencies of all the actors it is dependent on.

Parameters
actorThe actor to create the dependencies for.

◆ RemoveAllMorphSetups()

void EMotionFX::Actor::RemoveAllMorphSetups ( bool  deleteMeshDeformers = true)

Remove all morph setups. Morph setups contain all morph targtets.

Parameters
deleteMeshDeformersWhen set to true (default), mesh deformers, such as the morphing deformer, will be deleted from all nodes.

◆ RemoveAllNodeGroups()

void EMotionFX::Actor::RemoveAllNodeGroups ( )

Remove all node groups from this actor. This also deletes the groups from memory.

◆ RemoveAllNodeMeshes()

void EMotionFX::Actor::RemoveAllNodeMeshes ( )

Removes all meshes from all nodes inside this actor. This means all memory will be released and pointers to the meshes will not be valid anymore. Also all mesh deformer stacks will be removed.

◆ RemoveNode()

void EMotionFX::Actor::RemoveNode ( size_t  nr,
bool  delMem = true 
)

Remove a given node.

Parameters
nrThe node to remove.
delMemIf true the allocated memory of the node will be deleted.

◆ RemoveNodeGroup() [1/2]

void EMotionFX::Actor::RemoveNodeGroup ( NodeGroup group,
bool  delFromMem = true 
)

Remove a given node group by its pointer.

Parameters
groupThe node group to remove. Please keep in mind that this group should really be part of this actor.
delFromMemSet to true (default) when you wish to also delete the specified group from memory. Even if this group is not part of this actor and delFromMem is set to true, the group will be deleted from memory.

◆ RemoveNodeGroup() [2/2]

void EMotionFX::Actor::RemoveNodeGroup ( size_t  index,
bool  delFromMem = true 
)

Remove a given node group by its index.

Parameters
indexThe node group number to remove. This value must be in range of [0..GetNumNodeGroups()-1].
delFromMemSet to true (default) when you wish to also delete the specified group from memory.

◆ RemoveNodeMirrorInfos()

void EMotionFX::Actor::RemoveNodeMirrorInfos ( )

Remove memory for the motion node source array. If the motion node source array has not been allocated before it will do nothing at all.

◆ Scale()

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

Scale all transform and mesh positional 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::Actor::ScaleToUnitType ( MCore::Distance::EUnitType  targetUnitType)

Scale to a given unit type. This method does nothing if the actor 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).

◆ SetCustomData()

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

Get a pointer to the custom data you stored. Custom data can for example link a game or engine object with this EMotion FX actor object. An example is when EMotion FX triggers a motion event. You know the actor that triggered the event, but you don't know directly what game or engine object is linked to this actor. By using the custom data methods GetCustomData and SetCustomData you can set a pointer to your game or engine object in each actor. The pointer that you specify will not be deleted when the actor object is being destructed.

Parameters
dataPointerA void pointer to the custom data, which could for example be your engine or game object that is linked to this actor.

◆ SetDirtyFlag()

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

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

Parameters
dirtyThe dirty flag.

◆ SetFileName()

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

Set the filename of the actor.

Parameters
[in]filenameThe filename of the actor.

◆ SetID()

MCORE_INLINE void EMotionFX::Actor::SetID ( uint32  id)
inline

Set the unique identification number for the actor instance.

Parameters
[in]idThe unique identification number.

◆ SetMorphSetup()

void EMotionFX::Actor::SetMorphSetup ( size_t  lodLevel,
MorphSetup setup 
)

Set the morph setup for a given geometry LOD level. It is possible to set the setup for a given LOD level to nullptr. If the setup is nullptr, no morphing is being processed for the given LOD.

Parameters
lodLevelThe LOD level, which must be in range of [0..GetNumLODLevels()-1].
setupThe morph setup for this LOD.

◆ SetMotionExtractionNode()

void EMotionFX::Actor::SetMotionExtractionNode ( Node node)

Set the motion extraction node. This is the node from which we filter the motion. Most likely the hips node. The filtered motion of this node is applied to the actor instance. You can set the node to nullptr in case you want to disable motion extraction.

Parameters
nodeThe motion extraction node, or nullptr to disable it.

◆ SetMotionExtractionNodeIndex()

void EMotionFX::Actor::SetMotionExtractionNodeIndex ( size_t  nodeIndex)

Set the motion extraction node index. This is the node from which we filter the motion. Most likely the hips node. The filtered motion of this node is applied to the actor instance. You can set the node to MCORE_INVALIDINDEX32 in case you want to disable motion extraction.

Parameters
nodeIndexThe motion extraction node, or MCORE_INVALIDINDEX32 to disable it.

◆ SetName()

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

Set the name of the actor.

Parameters
nameThe name of the actor.

◆ SetNumLODLevels()

void EMotionFX::Actor::SetNumLODLevels ( size_t  numLODs,
bool  adjustMorphSetup = true 
)

Set the number of LOD levels. This will be called by the importer. Do not use manually.

◆ UpdateStaticAabb()

void EMotionFX::Actor::UpdateStaticAabb ( )

Sets the static aabb and expects to have the model asset ready.

◆ VerifySkinning()

void EMotionFX::Actor::VerifySkinning ( AZStd::vector< uint8 > &  conflictNodeFlags,
size_t  skeletalLODLevel,
size_t  geometryLODLevel 
)

Verify if the skinning will look correctly in the given geometry LOD for a given skeletal LOD level. As the skeletal LOD system can disable nodes entirely the skinning info of a mesh might be linked to a disabled node. This will end up in in an incorrectly deformed mesh.

Parameters
conflictNodeFlagsThe array of flags that indicate whether a node is used by the skinning info of the geometry LOD level but is disabled by the given skeletal LOD level. Nodes which have an enabled state after calling the function will be nodes that are responsible for bad skinning. The size of the array will always be equal to the number of nodes. So if the conflictNodeFlags[myNodeNr] equals 1 you know there is a conflict, while everything is alright if the value is 0.
skeletalLODLevelThe skeletal LOD level to be verified. The skinning influences will be tested against disabled nodes from the given skeletal LOD level.
geometryLODLevelThe geometry LOD level to test the skeletal LOD against with.

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