@maranpis AnimationState.get_current()
will not return null
if you loop the animation, as the track entry will remain on the track indefinitely until you queue a new animation or clear the track entry.
I have a todo list item that will allow setting a signal callback on individual track entries as returned by add_animation
or set_animation
. That way, you can add a signal callback to the track entry and know exactly when it has started/completed (a loop)/ended, and do whatever you need to do. You can already do this by setting a signal callback on the animation state itself, then checking the track entry that your signal callback is passed, e.g.
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-godot/example/examples/02-animation-state-listeners/animation-state-listeners.gd#L15
You can simply query the animation name of the animation represented by the track entry:
func _animation_completed(sprite: SpineSprite, animation_state: SpineAnimationState, track_entry: SpineTrackEntry):
print("Animation completed: " + track_entry.get_animation().get_name())