Open txigreman opened 5 years ago
That's by design, AnimationPlayer emits animation_finished
when it finishes playing animations. If it chains to another animation, it emits animation_changed
instead.
There might be a worthwhile discussion if any future refactoring is to be for the AnimationPlayer. Some of the naming and behavior of things are not exactly intuitive, and perhaps missing.
Like play/stop also doubling as resume/pause depending on how you flag the stop.
Finished also implies the animation has completed a cycle, regardless, so I don't know it just wouldn't fire both changed and finished. I think it also doesn't fire when dealing with loops, so you have to resort to call function keyframes to tie into catching things at the end of looping animations.
The current behaviour, in my opinion, is not consistent and misleading: animation_started
is called for each animation, but animation_finished
is only call at the end of the queue. I think they both should behave in the same way. Also the documentation is not very specific indicating when the signals are emitted.
On top of this I saw on this Godot 3.2 preliminar changelog that Tween now has a new signal tween_all_completed
. I understand it's a different node, but in my opinion we should try to make this details consistent across all the platform. For Tween is completed
, and it's called for each tween, but for AnimationPlayer is finished
, and is only called at the end of the queue...
@txigreman These are good and valide points, you might want to mention them here: https://github.com/godotengine/godot/issues/16863
There definitely should also be consistency with on_finished
signal when loop is turned on (#34608).
The more I think about it, the more I would find it consistent to have on_finished
emitted at the end of the animation, no matter what (with or without active loop or queue). And then have a new signal on_queue_finished
emitted at the end of the queue.
For anyone who may come to work on this, it might also be worth watching for this bug as well: https://github.com/godotengine/godot/issues/22210
Well, unless animation_started
plays from AnimationTree, it can be removed. animation_changed
covers it.
Godot version: 3.1.stable.official
OS/device including version: Windows 10
Issue description: When several animations are queued in an AnimationPlayer, signal
animation_finished
is not emited when changing between animations, butanimation_started
is.Both signals (
animation_started
ananimation_finished
) provides the animation name, but behave different as the first one is called for each individual animation, but the second doesn't. I think they both should be called for each animation, and maybe include two new signal to indicate the global/queue start and end.Note: Tween class has
tween_started
andtween_completed
signals, and emits them for each individual "animation".Minimal reproduction project: Test.zip