Animation Graph API Reference¶
All Animation Graph Python API commands are called from the omni.anim.graph.core
module.
Some commands are also available in the Action Graph node catalog.
Table of Contents
get_characters¶
Returns a list of active character instances. Must be called in Play mode.
Example
import omni.anim.graph.core as ag chars = ag.get_characters()
get_character_count¶
Returns the number of active character instances. Must be called in Play mode.
Example
import omni.anim.graph.core as ag char_count = ag.get_character_count()
get_character¶
Returns the active character instance for the specified USD Path string. Must be called in Play mode.
Arguments
arg0 (str): The USD Path to the USD SkelRoot with an Animation Graph applied.
Example
import omni.anim.graph.core as ag ag.get_character("/World/MyCharacter")
character.set_variable¶
Sets a variable in a character’s applied Animation Graph. The variable can be a value or array. Must be called in Play mode.
Arguments
arg0 (str): The variable’s node name. arg1 (value): The value to be applied that matches the variable type.
Example
import omni.anim.graph.core as ag char = ag.get_character("/World/MyCharacter") char.set_variable("MyBoolean", True)
character.get_variable¶
Returns a variable in a character’s applied Animation Graph. Returns a list.
Example
import omni.anim.graph.core as ag char = ag.get_character("/World/MyCharacter") char.get_variable("MyBoolean")
character.is_node_active¶
Return boolean indicating whether the given Animation Graph node. Must be called in Play mode.
Arguments
arg0 (str): The node name as a relative path from the Animation Graph root.
Example
import omni.anim.graph.core as ag char = ag.get_character("/World/MyCharacter") char.is_node_active("/MyAnimGraphNode")
character.get_world_transform¶
Gets the root World Transform of a character. Must be called in Play mode.
Also available as an Action Graph node.
Arguments
arg0 (carb::Float3): The translation arg1 (carb::Float4): The rotation
Example
import omni.anim.graph.core as ag import carb char = ag.get_character("/World/MyCharacter") pos = carb.Float3(0, 0, 0) rot = carb.Float4(0, 0, 0, 0) char.get_world_transform(pos, rot)
character.set_world_transform¶
Sets the root World Transform on a character. Must be called in Play mode.
Also available as an Action Graph node.
Arguments
arg0 (carb::Float3): The translation arg1 (carb::Float4): The rotation
Example
import omni.anim.graph.core as ag import carb char = ag.get_character("/World/MyCharacter") pos = carb.Float3(20, 0, 100) rot = carb.Float4(0, 0, 0, 0) char.set_world_transform(pos, rot)
character.get_joint_transform¶
Gets the a joint’s transform in world space. Must be called in Play mode.
Also available as an Action Graph node.
Arguments
arg0 (str): The joint name, not joint path. arg1 (carb::Float3): The translation arg2 (carb::Float4): The rotation
Example
import omni.anim.graph.core as ag import carb char = ag.get_character("/World/MyCharacter") pos = carb.Float3(20, 0, 100) rot = carb.Float4(0, 0, 0, 0) char.get_joint_transform("Pelvis", pos, rot)
character.update¶
Manually update/tick a character. Must be called in Play mode.
Arguments
arg0 (float): The delta time in seconds.
Example
import omni.anim.graph.core as ag char = ag.get_character("/World/MyCharacter") char.update(1.0)