Setting AnimGraph Variable with Python

Hello,

I am trying to set AnimGraph variables using Python code but I am running into some issues.

I am using the state-machine scene of the Animation Graph Samples.

After opening the scene and starting the simulation with the Play button I try to run the following code in the Script Editor to make the character wave:

import omni.anim.graph.core as ag

characters = ag.get_characters()

for character in characters:
	character.set_variable("graph:variable:Action", "Wave")

This does not work and I get the following warning in the Console:

[Warning] [omni.anim.graph.core.python] Type mismatch for variable graph:variable:Action in Character::SetVariable

If I open the AnimGraph I see the Type of the Action variable is string. However, if I click on the character SkelRoot it is listed as a float in the property description. Using a float in my code results in the same warning.

I would like to understand this better.
What am I missing?

It worked with

import omni.anim.graph.core as ag

characters = ag.get_characters()

for character in characters:
	character.set_variable("Action", "Wave")

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.