Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimationPlayer signals are not emitting when animations played from AnimationTree #28311

Closed
Calamander opened this issue Apr 22, 2019 · 17 comments · Fixed by #70278
Closed

AnimationPlayer signals are not emitting when animations played from AnimationTree #28311

Calamander opened this issue Apr 22, 2019 · 17 comments · Fixed by #70278

Comments

@Calamander
Copy link
Contributor

Calamander commented Apr 22, 2019

Bugsquad edit: This issue has been confirmed several times already. No need to confirm it further.


Godot version:
3.1 stable

OS/device including version:
Windows 10 Pro 1809

Issue description:
AnimationPlayer animations signals are not firing when animation played from within any AnimationTree node. I assume this is a bug, since AnimationPlayer directly attached to AnimationTree and AnimationTree doesn't have it's own signals controlling animation flow, so if tree is complex enough it becomes impossible to control it without signals.
I'm very confised since it is very important part of functionality but I couldn't find anyone bothered by its absence so I thought maybe I'm misunderstanding something, but couldn't find any solution so far.
#8521

Steps to reproduce:
Create (looping or not) animation in AnimationPlayer.
Create AnimationTree, assign AnimationPlayer to it. Inside AnimationTree (AnimationNodeBlendTree for ex) create Animation Node and connect it to output or any other combination. Activate AnimationTree, run.

Minimal reproduction project:
Test.zip
Enabling "autostart" on timer will allow signals emitting, since animations played directly from AnimationPlayer, indicating that it is perfectly fine by itself.

@JU-2094
Copy link

JU-2094 commented May 26, 2019

I had the same problem. I solved it by adding a callback in the animation. In your animation add the track for functions callback. Then you set the track key, and specify the name of the callback.

@Calamander
Copy link
Contributor Author

I had the same problem. I solved it by adding a callback in the animation. In your animation add the track for functions callback. Then you set the track key, and specify the name of the callback.

Yeah, I did it too, but the problem here is if function key too close to 0 or end of animation - it is sometimes not triggering so you have to move it +/- dozen milliseconds on animation timeline which makes timing animation even more cumbersome, even though I used the most simple animations, without any blending or time scaling/seeking.

@Rodeo-McCabe
Copy link

I can confirm this bug is present on Linux as well (Manjaro).

Unfortunately, the above workaround is not possible for me, since the function I need to call is in a script attached to an AnimationNode inside the AnimationTree. When creating a call method track, you can only select nodes which are displayed in the scene dock, and AnimationNodes inside an AnimationTree are not displayed.

ArtlessAvian added a commit to ArtlessAvian/godot-wild-11 that referenced this issue Jul 14, 2019
Learning Godot's built in StateMachine!!!
It's been okay, but I wish it had signals.
Also, the backing AnimationPlayer doesn't emit signals which sucks.
godotengine/godot#28311
@Rodeo-McCabe
Copy link

Rodeo-McCabe commented Mar 2, 2020

@mateusbds #30508 might be of interest to you.

@smks

This comment has been minimized.

@vvinhas

This comment has been minimized.

@JoshMooney

This comment has been minimized.

@metcalf-putnam
Copy link

Also having this issue, but this workaround worked like a charm for my use case (adding call method tracks to the animation(s) in question): https://amp.reddit.com/r/godot/comments/7lsrga/animationtreeplayer_detecting_when_an_animation/

@yth1130
Copy link

yth1130 commented Aug 23, 2020

Is it intended action?

@sstelfox
Copy link

Just hit this as well. The explicit "Call Method Track" to a node won't work for my specific use case as the target is dynamically created by a GdNative library.

@Azumist
Copy link

Azumist commented Nov 18, 2020

Same issue. Resolved it by using timers and setting wait_time to animation length, but it's a very makeshift solution.

@fracteed
Copy link

fracteed commented Jan 7, 2021

Damn, I am running into all sorts of issues with this limitation. You can't even get the current animation or position being played from the animation tree. None of the methods or signals from the animation player work when using a tree.

The timer workaround is not suitable if you have animations that blend in and out at different ramped speeds. The function track is not really suitable if you are importing gltf animations, but makes sense if your animations are created in Godot itself.

Hopefully there is a dev working on patch for this, as it is very difficult to work around!

@akien-mga akien-mga added this to the 4.0 milestone Jan 7, 2021
@Gagege
Copy link

Gagege commented Mar 7, 2021

Is there currently any other way to dynamically blend animations at runtime?

@Rodeo-McCabe
Copy link

Commenting to link this relevant issue and pull request:

godotengine/godot-proposals#1462 (comment)
#41771

Possibly a better solution overall, since it means we don't have implement our own state machine to effectively use the built in state machine ....

@abumbalough
Copy link

Confirming that I have the same issue when using AnimationPlayer from AnimationTree in 3.4.4.stable

@TokageItLab
Copy link
Member

TokageItLab commented Jul 5, 2022

AnimationTree only reads AnimationPlayer animations, it does not play the AnimationPlayer.

By the way, I remember @reduz and I were talking about AnimationTree loading animations from the AnimationLibrary directly.

There is also a fundamental problem with emitting signals from AnimationBlendTree's NodeAnimation and getting their playback position. This is because the AnimationTree is a node, but the AnimationBlendTree is a resource and can be referenced by multiple nodes.

So, if that is what you need, we will need to implement the signal correctly on the AnimationTree side.

@lufog
Copy link
Contributor

lufog commented Dec 1, 2022

AnimationTree only reads AnimationPlayer animations, it does not play the AnimationPlayer.

I always thought that AnimationTree was some kind of add-on to AnimationPlayer. And wondered why my

await animation_player.animation_finished

didn't work, when I used AnimationTree.

By the way, I remember @reduz and I were talking about AnimationTree loading animations from the AnimationLibrary directly.

If the AnimationTree only uses animations from the AnimationPlayer and nothing else. It really makes sense to put them in a separate resource. To avoid similar confusion in the future. And remove the extra node from the scene tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet