How to get all Conditions in Parameters of AnimationTree?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Erwin Broekhuis

I have defined some Conditions in the Parameters > Conditions of an AnimationTree.

Is there a way to retrieve their names through code? I need to know their names, not their values.

So far I tried

var my_conditions = $AnimationTree.get("parameters/conditions")

hoping that it would return an Array to iterate through, but instead it returns null.

The point is, I want to have a function that iterates through all of the conditions and set them to FALSE, without having to know each of them by name.

:bust_in_silhouette: Reply From: Wakatta
for condition in get_property_list():
	if condition.name.begins_with("parameters"):
		if condition.type == TYPE_BOOL:
			set(condition.name, false)

Nonexistent function ‘get_parameter_list’ in base
AnimationNodeStateMachine

when I try

$AnimationTree.get_tree_root().get_parameter_list()

Erwin Broekhuis | 2021-04-03 19:31

Updated my answer to resolve your issue as get_parameter_list() only appears to work on custom AnimationNodes which i assumed you were using

Wakatta | 2021-04-04 23:11

1 Like