mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
AnimationState, don't mix from an animation that was never applied.
This commit is contained in:
parent
a39c970a6a
commit
23f16c016c
@ -501,6 +501,24 @@ public class AnimationStateTest {
|
||||
}
|
||||
});
|
||||
|
||||
setup("setAnimation twice", // 21
|
||||
expect(0, "start", 0, 0), //
|
||||
|
||||
expect(1, "start", 0, 0), //
|
||||
|
||||
expect(0, "interrupt", 0, 0), //
|
||||
expect(0, "end", 0, 0), //
|
||||
|
||||
expect(1, "event 0", 0, 0), //
|
||||
expect(1, "event 14", 0.5f, 0.5f), //
|
||||
expect(1, "event 30", 1, 1), //
|
||||
expect(1, "complete", 1, 1), //
|
||||
expect(1, "end", 1, 1.1f) //
|
||||
);
|
||||
state.setAnimation(0, "events1", false); // First should be ignored.
|
||||
state.setAnimation(0, "events2", false);
|
||||
run(0.1f, 1000, null);
|
||||
|
||||
System.out.println("AnimationState tests passed.");
|
||||
}
|
||||
|
||||
|
||||
@ -265,8 +265,12 @@ public class AnimationState {
|
||||
TrackEntry entry = trackEntry(trackIndex, animation, loop, current);
|
||||
if (current != null) {
|
||||
freeAll(current.next);
|
||||
current.next = entry;
|
||||
entry.delay = current.trackLast;
|
||||
if (current.trackLast == -1) // If current was never applied, don't mix from it, just replace it.
|
||||
setCurrent(trackIndex, entry);
|
||||
else {
|
||||
current.next = entry;
|
||||
entry.delay = current.trackLast;
|
||||
}
|
||||
} else
|
||||
setCurrent(trackIndex, entry);
|
||||
return entry;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user