hi,

I have currently one thing to solve and I couldn't figure out a solution by myself or by searching.

I'm using a simple setup that is supposed play animations from a given list the enduser configures in random order and at random time, also the enduser is supposed to trigger and add animations at will.

This makes it somewhat difficult for any callbacks, and I don't see that as an option for me.
The only issue there is, is that the queue might grow indefinitely.

How can I ask for the current count of the queue. It know it would be a cheap, but the most simple solution to simply skip/refuse adding animations if the queue reached a specific count.

Related Discussions
...

To determine the current count of animations queued in a track, you can use the TrackEntry linked list starting from the currently playing animation. Each TrackEntry has a next property that points to the next animation in the queue. By iterating through this list, you can count the number of queued animations.

Here's a basic example of how you might implement this in code:

int countQueuedAnimations(AnimationState state, int trackIndex) {
    int count = 0;
    TrackEntry entry = state.getCurrent(trackIndex);
    while (entry != null) {
        count++;
        entry = entry.next;
    }
    // Subtract 1 to exclude the currently playing animation from the count
    return count - 1;
}

This function starts with the currently playing animation on the specified track and iterates through the next properties of each TrackEntry to count the total number of animations. It subtracts 1 from the total count to exclude the currently playing animation, giving you the count of animations that are queued but not yet playing.

Remember, this approach assumes you have access to the AnimationState and TrackEntry classes from your runtime and that you're familiar with accessing and manipulating these objects in your specific development environment.

yes indeed, that was the soluition I was looking for. Thanks a bunch

It was a little bit more compilcated to implement since integrated multiple spine runtime versions into my build. So I have to address different namespaces for each runtime.

But it does the job.

I'm glad that helped!

I don't suggest to integrated multiple Spine Runtime versions into the same app. It would be better to write export scripts and re-export all your projects using the same Spine version so you can use a single Spine Runtime version. We recently made these scripts available which can help:
EsotericSoftware/spine-scriptstree/master/export

    5 days later

    Nate
    Thanks for tip, I would prefer that, sadly not an option. I'll work on a viewer that should allow the user to not only use built-in assets, but also allows loading from external assets. Since I don't have access to each users assets, there wasn't a way arround it.