godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.34k stars 21.06k forks source link

Editor can't handle complex Animation State Machine Advanced Expressions #89667

Open Eluem opened 7 months ago

Eluem commented 7 months ago

Tested versions

Reproducible in v4.2.stable.official [46dc27791]

System information

Windows 10 - Godot v4.2.stable.official [46dc27791]

Issue description

If you use a boolean valued function in the Advanced Expression of an Animation State Machine transition, it works when the project is run, but it seems to halt in the editor.

It would be very useful for this to work, especially because I can't find an easier way to implement conditions that are consumed by transitions.

Steps to reproduce

Minimal reproduction project (MRP)

AnimationStateMachineAdvancedExpressionBug.zip

Eluem commented 6 months ago

I believe I was mistaken. Adding "@tool" to the top of the script and then restarting the project seems to resolve this issue in my more recent experiments. I didn't realize that you needed to reload the project for "@tool" to take effect. Though, I'm not sure if requiring @tool for functions to run in animations is the intended behavior or not.

Also, while experimenting with this, I noticed that short-circuiting doesn't seem to occur in the advanced expressions.. but I want to be sure before opening another potentially erroneous issue.