Underlying advance_expression parser engine

First of all,

I have been loving advance_expression property in Animation and the potential of flexibility and the range of possibility to the usage of it. I’m thankful to those who proposed this idea and implemented it to the engine as a functionality. This makes it easy to handle more complex animation logic.

But this been bugging my mind for a while, is this just GDScript in disguise or another custom syntax processsor specifically implemented for this? If this is actually GDScript, I wonder how far I can push the boundary of this expression (ex. feedback triggers to the base node, state feedback of the animation).

Proof-of-concept code:

  • On the base node
func trigger_something() → bool:
  print("Hey, the animation gone back to default!")

  return true
  • On advance_expression for transitioning to the target animation
state_1 == true && state_2 == true
  • On advance_expression for transitioning to default animation
trigger_something() == true

This in a way, will create the possibility of triggers or giving feedback to the logic code (base node).

Is this in a way, just a code that gets parsed to the “if statement” of the animation state machine?

The AnimationNodeStateMachineTransition.advance_expression uses an Expression object under the hood. It’s not GDScript. You can call methods from your AnimationTree.advance_expression_base_node in the advance_expression

More info about Expression:

2 Likes