jzela

I have situation where I'd like to clear all queued tracks except than the current playing track. Is there a simple way to do this? I'm using UE4 C++.

Thanks!
jzela
Сообщения: 8

badlogic

There's no explicit API for this use case I'm afraid. However, you could attach a track entry listener to the current track entry, and when its animation is done, you could clear the entire track.
Аватара пользователя
badlogic

Mario
Сообщения: 1093

jzela

I ended up adding a function to handle this in my local AnimationState.c, it is modeled after other similar functions. I have created a configurable state machine ActorComponent in C++ on top of the Spine-C API (using the UE4 runtime as reference). This new function is useful for allowing the next track to be determined, but then re-determined before the current track finishes - depending on the results of external criteria (setup as gates).

It seems to work fine, but do you think there will be a problem with this?
void spAnimationState_clearNextTrack(spAnimationState* self, int trackIndex) {
spTrackEntry* current;
spTrackEntry* entry;
spTrackEntry* from;
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);

if (trackIndex >= self->tracksCount) return;
current = self->tracks[trackIndex];
if (!current) return;

_spAnimationState_disposeNext(self, current);

entry = current;
while (1) {
from = entry->mixingFrom;
if (!from) break;
_spEventQueue_end(internal->queue, from);
entry->mixingFrom = 0;
entry = from;
}
}
jzela
Сообщения: 8

badlogic

This should work fine for your use case, but may result in some cut off mixes when a track is mixing between two track entries. You could potentially remove the bottom while loop so any mixes are finished.
Аватара пользователя
badlogic

Mario
Сообщения: 1093

jzela

Thanks!
jzela
Сообщения: 8


Вернуться в Runtimes
cron