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

Classes

struct  Statistics
 

Public Member Functions

void RecursiveReinit ()
 
bool InitAfterLoading ()
 
void RecursiveInvalidateUniqueDatas ()
 Recursive invalidate unique data for all corresponding anim graph instances.
 
const char * GetFileName () const
 
const AZStd::string & GetFileNameString () const
 
void SetFileName (const char *fileName)
 
AnimGraphStateMachineGetRootStateMachine () const
 
void SetRootStateMachine (AnimGraphStateMachine *stateMachine)
 
AnimGraphNodeRecursiveFindNodeByName (const char *nodeName) const
 
bool IsNodeNameUnique (const AZStd::string &newNameCandidate, const AnimGraphNode *forNode) const
 
AnimGraphNodeRecursiveFindNodeById (AnimGraphNodeId nodeId) const
 
AnimGraphStateTransitionRecursiveFindTransitionById (AnimGraphConnectionId transitionId) const
 
void RecursiveCollectNodesOfType (const AZ::TypeId &nodeType, AZStd::vector< AnimGraphNode * > *outNodes) const
 
void RecursiveCollectTransitionConditionsOfType (const AZ::TypeId &conditionType, AZStd::vector< AnimGraphTransitionCondition * > *outConditions) const
 
void RecursiveCollectObjectsOfType (const AZ::TypeId &objectType, AZStd::vector< AnimGraphObject * > &outObjects)
 
void RecursiveCollectObjectsAffectedBy (AnimGraph *animGraph, AZStd::vector< AnimGraphObject * > &outObjects)
 
size_t RecursiveCalcNumNodes () const
 
void RecursiveCalcStatistics (Statistics &outStatistics) const
 
size_t RecursiveCalcNumNodeConnections () const
 
AZStd::string GenerateNodeName (const AZStd::unordered_set< AZStd::string > &nameReserveList, const char *prefix="Node") const
 
size_t GetNumParameters () const
 
size_t GetNumValueParameters () const
 
const ParameterFindParameter (size_t index) const
 
const ValueParameterFindValueParameter (size_t index) const
 
GroupParameterVector RecursivelyGetGroupParameters () const
 
const ValueParameterVector & RecursivelyGetValueParameters () const
 
const ParameterVector & GetChildParameters () const
 
ValueParameterVector GetChildValueParameters () const
 
const ParameterFindParameterByName (const AZStd::string &paramName) const
 
const ValueParameterFindValueParameterByName (const AZStd::string &paramName) const
 
GroupParameterFindGroupParameterByName (const AZStd::string &groupName) const
 
const GroupParameterFindParentGroupParameter (const Parameter *parameter) const
 
AZ::Outcome< size_t > FindParameterIndexByName (const AZStd::string &paramName) const
 
AZ::Outcome< size_t > FindValueParameterIndexByName (const AZStd::string &paramName) const
 
AZ::Outcome< size_t > FindParameterIndex (Parameter *parameter) const
 
AZ::Outcome< size_t > FindParameterIndex (const Parameter *parameter) const
 
AZ::Outcome< size_t > FindValueParameterIndex (const ValueParameter *parameter) const
 
AZ::Outcome< size_t > FindRelativeParameterIndex (const Parameter *parameter) const
 
bool AddParameter (Parameter *parameter, const GroupParameter *parent=nullptr)
 
bool InsertParameter (size_t index, Parameter *parameter, const GroupParameter *parent=nullptr)
 
bool RenameParameter (Parameter *parameter, const AZStd::string &newName)
 
bool RemoveParameter (Parameter *parameter)
 
bool TakeParameterFromParent (const Parameter *parameter)
 
uint32 GetID () const
 
void SetID (uint32 id)
 
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
 
size_t GetNumNodeGroups () const
 
AnimGraphNodeGroupGetNodeGroup (size_t index) const
 
AnimGraphNodeGroupFindNodeGroupByName (const char *groupName) const
 
size_t FindNodeGroupIndexByName (const char *groupName) const
 
void AddNodeGroup (AnimGraphNodeGroup *nodeGroup)
 
void RemoveNodeGroup (size_t index, bool delFromMem=true)
 
void RemoveAllNodeGroups (bool delFromMem=true)
 
AnimGraphNodeGroupFindNodeGroupForNode (AnimGraphNode *animGraphNode) const
 
void FindAndRemoveCycles (AZStd::string *outRemovedConnectionsMessage=nullptr)
 
bool GetRetargetingEnabled () const
 
void SetRetargetingEnabled (bool enabled)
 
void RemoveAllObjectData (AnimGraphObject *object, bool delFromMem)
 
void AddObject (AnimGraphObject *object)
 
void RemoveObject (AnimGraphObject *object)
 
size_t GetNumObjects () const
 
AnimGraphObjectGetObject (size_t index) const
 
void ReserveNumObjects (size_t numObjects)
 
size_t GetNumNodes () const
 
AnimGraphNodeGetNode (size_t index) const
 
void ReserveNumNodes (size_t numNodes)
 
size_t CalcNumMotionNodes () const
 
size_t GetNumAnimGraphInstances () const
 
AnimGraphInstanceGetAnimGraphInstance (size_t index) const
 
void ReserveNumAnimGraphInstances (size_t numInstances)
 
void AddAnimGraphInstance (AnimGraphInstance *animGraphInstance)
 
void RemoveAnimGraphInstance (AnimGraphInstance *animGraphInstance)
 
void Lock ()
 
void Unlock ()
 
bool SaveToFile (const AZStd::string &filename, AZ::SerializeContext *context) const
 
void RemoveInvalidConnections (bool logWarnings=false)
 

Static Public Member Functions

static AZ_CLASS_ALLOCATOR_DECL AZ::Color RandomGraphColor ()
 
static void Reflect (AZ::ReflectContext *context)
 
static AnimGraphLoadFromFile (const AZStd::string &filename, AZ::SerializeContext *context, const AZ::ObjectStream::FilterDescriptor &loadFilter=AZ::ObjectStream::FilterDescriptor(nullptr, AZ::ObjectStream::FILTERFLAG_IGNORE_UNKNOWN_CLASSES))
 
static AnimGraphLoadFromBuffer (const void *buffer, const AZStd::size_t length, AZ::SerializeContext *context)
 

Member Function Documentation

◆ AddNodeGroup()

void EMotionFX::AnimGraph::AddNodeGroup ( AnimGraphNodeGroup nodeGroup)

Add the given node group.

Parameters
nodeGroupA pointer to the new node group to add.

◆ AddParameter()

bool EMotionFX::AnimGraph::AddParameter ( Parameter parameter,
const GroupParameter parent = nullptr 
)

Add the given parameter. The parameter will be fully managed and destroyed by this anim graph.

Parameters
[in]parameterA pointer to the parameter to add.
[in]parentParent group parameter. If nullptr, the parameter will be added to the root group parameter
Returns
true if the parameter was added

◆ FindAndRemoveCycles()

void EMotionFX::AnimGraph::FindAndRemoveCycles ( AZStd::string *  outRemovedConnectionsMessage = nullptr)

Finds cycles and removes connections that produce them. This method is intended to be used after loading

Parameters
[out]outRemovedConnectionsMessageif specified, it will compose a message of the connections that were removed

◆ FindGroupParameterByName()

GroupParameter* EMotionFX::AnimGraph::FindGroupParameterByName ( const AZStd::string &  groupName) const

Find a group parameter by name.

Parameters
groupNameThe group name to search for.
Returns
A pointer to the group parameter with the given name. nullptr will be returned in case it has not been found.

◆ FindNodeGroupByName()

AnimGraphNodeGroup* EMotionFX::AnimGraph::FindNodeGroupByName ( const char *  groupName) const

Find a node group based on the name and return a pointer.

Parameters
groupNameThe group name to search for.
Returns
A pointer to the node group with the given name. nullptr will be returned in case there is no node group in this anim graph with the given name.

◆ FindNodeGroupForNode()

AnimGraphNodeGroup* EMotionFX::AnimGraph::FindNodeGroupForNode ( AnimGraphNode animGraphNode) const

Find the node group the given node is part of and return a pointer to it.

Parameters
[in]animGraphNodeThe node to search the node group for.
Returns
A pointer to the node group in which the given node is in. nullptr will be returned in case the node is not part of a node group.

◆ FindNodeGroupIndexByName()

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

Find a node group index based on the name and return its index.

Parameters
groupNameThe group name to search for.
Returns
The index of the node group inside this anim graph, MCORE_INVALIDINDEX32 in case the node group wasn't found.

◆ FindParameter()

const Parameter* EMotionFX::AnimGraph::FindParameter ( size_t  index) const

Find a parameter given an index.

Parameters
[in]indexThe index of the parameter to return (index based on all parameters, returned parameter could be a group).
Returns
A pointer to the parameter.

◆ FindParameterByName()

const Parameter* EMotionFX::AnimGraph::FindParameterByName ( const AZStd::string &  paramName) const

Find parameter by name.

Parameters
[in]paramNameThe name of the parameter to search for.
Returns
A pointer to the parameter with the given name. nullptr will be returned in case it has not been found.

◆ FindParameterIndex()

AZ::Outcome<size_t> EMotionFX::AnimGraph::FindParameterIndex ( Parameter parameter) const

Find parameter index by parameter.

Parameters
[in]parameterThe parameter to search for.
Returns
The index of the parameter. AZ::Failure will be returned in case it has not been found.

◆ FindParameterIndexByName()

AZ::Outcome<size_t> EMotionFX::AnimGraph::FindParameterIndexByName ( const AZStd::string &  paramName) const

Find parameter index by name.

Parameters
[in]paramNameThe name of the parameter to search for.
Returns
The index of the parameter with the given name. AZ::Failure will be returned in case it has not been found.

◆ FindParentGroupParameter()

const GroupParameter* EMotionFX::AnimGraph::FindParentGroupParameter ( const Parameter parameter) const

Find the group parameter the given parameter is part of.

Parameters
[in]parameterThe parameter to search the group parameter for.
Returns
A pointer to the group parameter in which the given parameter is in. nullptr will be returned in case the parameter is not part of a group parameter.

◆ FindRelativeParameterIndex()

AZ::Outcome<size_t> EMotionFX::AnimGraph::FindRelativeParameterIndex ( const Parameter parameter) const

Find parameter index by parameter. Index is relative to its siblings.

Parameters
[in]parameterThe parameter to search for.
Returns
The index of the parameter. AZ::Failure will be returned in case it has not been found.

◆ FindValueParameter()

const ValueParameter* EMotionFX::AnimGraph::FindValueParameter ( size_t  index) const

Find a value parameter given an index.

Parameters
[in]indexThe index of the value parameter to return (index based on all the graph's value parameters).
Returns
A pointer to the value parameter.

◆ FindValueParameterByName()

const ValueParameter* EMotionFX::AnimGraph::FindValueParameterByName ( const AZStd::string &  paramName) const

Find a value parameter by name. The above function is more generic and this more specific. If the client already knows that is searching for a value parameter, this function will be faster to execute.

Parameters
[in]paramNameThe name of the value parameter to search for.
Returns
A pointer to the value parameter with the given name. nullptr will be returned in case it has not been found.

◆ FindValueParameterIndex()

AZ::Outcome<size_t> EMotionFX::AnimGraph::FindValueParameterIndex ( const ValueParameter parameter) const

Find value parameter index by parameter. Index is relative to other value parameters.

Parameters
[in]parameterThe parameter to search for.
Returns
The index of the parameter. AZ::Failure will be returned in case it has not been found.

◆ FindValueParameterIndexByName()

AZ::Outcome<size_t> EMotionFX::AnimGraph::FindValueParameterIndexByName ( const AZStd::string &  paramName) const

Find value parameter index by name. Index is relative to other value parameters.

Parameters
[in]paramNameThe name of the value parameter to search for.
Returns
The index of the parameter with the given name. AZ::Failure will be returned in case it has not been found.

◆ GetAutoUnregister()

bool EMotionFX::AnimGraph::GetAutoUnregister ( ) const

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

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

◆ GetChildParameters()

const ParameterVector& EMotionFX::AnimGraph::GetChildParameters ( ) const

Get all the parameters contained directly by this anim graph. This means that if this anim graph contains a group which contains more parameters, those are not returned (but the group is).

Returns
The parameters contained directly by this anim graph.

◆ GetChildValueParameters()

ValueParameterVector EMotionFX::AnimGraph::GetChildValueParameters ( ) const

Get all the value parameters contained directly by this anim graph. This means that if this anim graph contains a group which contains more value parameters, those are not returned.

Returns
The value parameters contained directly by this anim graph.

◆ GetDirtyFlag()

bool EMotionFX::AnimGraph::GetDirtyFlag ( ) const

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

Returns
The dirty flag.

◆ GetID()

uint32 EMotionFX::AnimGraph::GetID ( ) const

Get the unique identification number for this anim graph.

Returns
The unique identification number.

◆ GetNodeGroup()

AnimGraphNodeGroup* EMotionFX::AnimGraph::GetNodeGroup ( size_t  index) const

Get a pointer to the given node group.

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

◆ GetNumNodeGroups()

size_t EMotionFX::AnimGraph::GetNumNodeGroups ( ) const

Get the number of node groups.

Returns
The number of node groups.

◆ GetNumParameters()

size_t EMotionFX::AnimGraph::GetNumParameters ( ) const

Get the total number of parameters inside this anim graph. This will be the number of parameters from all group parameters counting the groups (therefore is the amount of parameters that have a value)

Returns
The number of parameters.

◆ GetNumValueParameters()

size_t EMotionFX::AnimGraph::GetNumValueParameters ( ) const

Get the total number of value parameters inside this anim graph. This will be the number of parameters from all group parameters. without counting the groups.

Returns
The number of value parameters.

◆ InsertParameter()

bool EMotionFX::AnimGraph::InsertParameter ( size_t  index,
Parameter parameter,
const GroupParameter parent = nullptr 
)

Insert the given parameter at the specified index. The index is relative to the parent. The parameter will be fully managed and destroyed by this anim graph.

Parameters
[in]indexThe index at which position the new parameter shall be inserted.
[in]parameterA pointer to the attribute info to insert.
[in]parentParent group parameter. If nullptr, the parameter will be added to the root group parameter
Returns
success if the parameter was added, the returned index is the absolute index among all parameter values

◆ RandomGraphColor()

static AZ_CLASS_ALLOCATOR_DECL AZ::Color EMotionFX::AnimGraph::RandomGraphColor ( )
static

Picks a random color for the anim graph.

Returns
The generated color.

◆ RecursivelyGetGroupParameters()

GroupParameterVector EMotionFX::AnimGraph::RecursivelyGetGroupParameters ( ) const

Get all the group parameters contained in this anim graph, recursively. This means that if a group is contained in another group within this anim graph, it is returned as well.

Returns
The group parameters contained in this anim graph, recursively.

◆ RecursivelyGetValueParameters()

const ValueParameterVector& EMotionFX::AnimGraph::RecursivelyGetValueParameters ( ) const

Get all the value parameters contained in this anim graph, recursively. This means that if a group contains more value parameters, those are returned as well.

Returns
The value parameters contained in this anim graph, recursively.

◆ RemoveAllNodeGroups()

void EMotionFX::AnimGraph::RemoveAllNodeGroups ( bool  delFromMem = true)

Remove all node groups.

Parameters
delFromMemSet to true (default) when you wish to also delete the node groups from memory.

◆ RemoveNodeGroup()

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

Remove the node group at the given index.

Parameters
indexThe node group index 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.

◆ RemoveParameter()

bool EMotionFX::AnimGraph::RemoveParameter ( Parameter parameter)

Removes the parameter specified by index. The parameter will be deleted.

Parameters
[in]parameterThe parameter to remove.

◆ RenameParameter()

bool EMotionFX::AnimGraph::RenameParameter ( Parameter parameter,
const AZStd::string &  newName 
)

Rename a parameter's name.

Parameters
[in]parameterParameter to rename.
[in]newNameNew name.

◆ SetAutoUnregister()

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

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

Parameters
enabledSet to true when you wish to automatically have this anim graph unregistered, otherwise set it to false.

◆ SetDirtyFlag()

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

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

Parameters
dirtyThe dirty flag.

◆ SetID()

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

Set the unique identification number for this anim graph.

Parameters
[in]idThe unique identification number.

◆ SetIsOwnedByAsset()

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

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

◆ SetIsOwnedByRuntime()

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

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

◆ TakeParameterFromParent()

bool EMotionFX::AnimGraph::TakeParameterFromParent ( const Parameter parameter)

Iterate over all group parameters and make sure the given parameter is not part of any of the groups anymore.

Parameters
[in]parameterIndexThe index of the parameter to be removed from all group parameters.

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