Hey, I'm upgrading our project from 3.5 to 3.8 in unity, and meet a mixing problem.
Blog: AnimationState: multiple mixing without dipping
As this blog say, spine 3.5 has a flag MultipleMixing, when MultipleMixing == false, it's only mix two animations.
I find the code is
private void SetCurrent (int index, TrackEntry current, bool interrupt) {
TrackEntry from = ExpandToIndex(index);
tracks.Items[index] = current;
if (from != null) {
if (interrupt) queue.Interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
//from.timelinesRotation.Clear();
var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
if (multipleMixing) {
// The interrupted mix will mix out from its current percentage to zero.
current.mixAlpha *= Math.Min(from.mixTime / from.mixDuration, 1);
} else {
// A mix was interrupted, mix from the closest animation.
if (from.mixTime / from.mixDuration < 0.5f && mixingFrom.animation != AnimationState.EmptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
from.mixAlpha = 0;
from.mixTime = 0;
from.mixDuration = 0;
}
}
from.timelinesRotation.Clear(); // Reset rotation for mixing out, in case entry was mixed in.
}
queue.Start(current);
}
our project rely on MultipleMixing == FALSE. But in spine3.8 runtime, I find this logic has changed, it's seem MultipleMixing is always true.
private void SetCurrent (int index, TrackEntry current, bool interrupt) {
TrackEntry from = ExpandToIndex(index);
tracks.Items[index] = current;
if (from != null) {
if (interrupt) queue.Interrupt(from);
current.mixingFrom = from;
from.mixingTo = current;
current.mixTime = 0;
// Store the interrupted mix percentage.
if (from.mixingFrom != null && from.mixDuration > 0)
current.interruptAlpha *= Math.Min(1, from.mixTime / from.mixDuration);
from.timelinesRotation.Clear(); // Reset rotation for mixing out, in case entry was mixed in.
}
queue.Start(current); // triggers AnimationsChanged
}
Our animation system rely on only two animation mixed, so it's wrong in 3.8 runtime.
I have tried cherry pick old 3.5's logic to 3.8 and play animation, it's works.
So how can I disable multipleMixing in 3.8?
Thanks a lot.