[ts] Ported latest AnimationState changes

This commit is contained in:
badlogic 2016-11-28 16:32:02 +01:00
parent 4e0fdc022b
commit c604d93a5c
19 changed files with 8688 additions and 8668 deletions

View File

@ -309,7 +309,7 @@ declare module spine {
queueEvents(entry: TrackEntry, animationTime: number): void; queueEvents(entry: TrackEntry, animationTime: number): void;
clearTracks(): void; clearTracks(): void;
clearTrack(trackIndex: number): void; clearTrack(trackIndex: number): void;
setCurrent(index: number, current: TrackEntry): void; setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry; setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry; setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry; addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;

View File

@ -1323,7 +1323,7 @@ var spine;
next.delay = 0; next.delay = 0;
next.trackTime = nextTime + delta * next.timeScale; next.trackTime = nextTime + delta * next.timeScale;
current.trackTime += currentDelta; current.trackTime += currentDelta;
this.setCurrent(i, next); this.setCurrent(i, next, true);
while (next.mixingFrom != null) { while (next.mixingFrom != null) {
next.mixTime += currentDelta; next.mixTime += currentDelta;
next = next.mixingFrom; next = next.mixingFrom;
@ -1562,11 +1562,12 @@ var spine;
this.tracks[current.trackIndex] = null; this.tracks[current.trackIndex] = null;
this.queue.drain(); this.queue.drain();
}; };
AnimationState.prototype.setCurrent = function (index, current) { AnimationState.prototype.setCurrent = function (index, current, interrupt) {
var from = this.expandToIndex(index); var from = this.expandToIndex(index);
this.tracks[index] = current; this.tracks[index] = current;
if (from != null) { if (from != null) {
this.queue.interrupt(from); if (interrupt)
this.queue.interrupt(from);
current.mixingFrom = from; current.mixingFrom = from;
current.mixTime = 0; current.mixTime = 0;
if (from.mixingFrom != null) if (from.mixingFrom != null)
@ -1583,6 +1584,7 @@ var spine;
AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) { AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) {
if (animation == null) if (animation == null)
throw new Error("animation cannot be null."); throw new Error("animation cannot be null.");
var interrupt = true;
var current = this.expandToIndex(trackIndex); var current = this.expandToIndex(trackIndex);
if (current != null) { if (current != null) {
if (current.nextTrackLast == -1) { if (current.nextTrackLast == -1) {
@ -1591,12 +1593,13 @@ var spine;
this.queue.end(current); this.queue.end(current);
this.disposeNext(current); this.disposeNext(current);
current = current.mixingFrom; current = current.mixingFrom;
interrupt = false;
} }
else else
this.disposeNext(current); this.disposeNext(current);
} }
var entry = this.trackEntry(trackIndex, animation, loop, current); var entry = this.trackEntry(trackIndex, animation, loop, current);
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, interrupt);
this.queue.drain(); this.queue.drain();
return entry; return entry;
}; };
@ -1616,7 +1619,7 @@ var spine;
} }
var entry = this.trackEntry(trackIndex, animation, loop, last); var entry = this.trackEntry(trackIndex, animation, loop, last);
if (last == null) { if (last == null) {
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, true);
this.queue.drain(); this.queue.drain();
} }
else { else {

File diff suppressed because one or more lines are too long

View File

@ -309,7 +309,7 @@ declare module spine {
queueEvents(entry: TrackEntry, animationTime: number): void; queueEvents(entry: TrackEntry, animationTime: number): void;
clearTracks(): void; clearTracks(): void;
clearTrack(trackIndex: number): void; clearTrack(trackIndex: number): void;
setCurrent(index: number, current: TrackEntry): void; setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry; setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry; setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry; addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;

View File

@ -1323,7 +1323,7 @@ var spine;
next.delay = 0; next.delay = 0;
next.trackTime = nextTime + delta * next.timeScale; next.trackTime = nextTime + delta * next.timeScale;
current.trackTime += currentDelta; current.trackTime += currentDelta;
this.setCurrent(i, next); this.setCurrent(i, next, true);
while (next.mixingFrom != null) { while (next.mixingFrom != null) {
next.mixTime += currentDelta; next.mixTime += currentDelta;
next = next.mixingFrom; next = next.mixingFrom;
@ -1562,11 +1562,12 @@ var spine;
this.tracks[current.trackIndex] = null; this.tracks[current.trackIndex] = null;
this.queue.drain(); this.queue.drain();
}; };
AnimationState.prototype.setCurrent = function (index, current) { AnimationState.prototype.setCurrent = function (index, current, interrupt) {
var from = this.expandToIndex(index); var from = this.expandToIndex(index);
this.tracks[index] = current; this.tracks[index] = current;
if (from != null) { if (from != null) {
this.queue.interrupt(from); if (interrupt)
this.queue.interrupt(from);
current.mixingFrom = from; current.mixingFrom = from;
current.mixTime = 0; current.mixTime = 0;
if (from.mixingFrom != null) if (from.mixingFrom != null)
@ -1583,6 +1584,7 @@ var spine;
AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) { AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) {
if (animation == null) if (animation == null)
throw new Error("animation cannot be null."); throw new Error("animation cannot be null.");
var interrupt = true;
var current = this.expandToIndex(trackIndex); var current = this.expandToIndex(trackIndex);
if (current != null) { if (current != null) {
if (current.nextTrackLast == -1) { if (current.nextTrackLast == -1) {
@ -1591,12 +1593,13 @@ var spine;
this.queue.end(current); this.queue.end(current);
this.disposeNext(current); this.disposeNext(current);
current = current.mixingFrom; current = current.mixingFrom;
interrupt = false;
} }
else else
this.disposeNext(current); this.disposeNext(current);
} }
var entry = this.trackEntry(trackIndex, animation, loop, current); var entry = this.trackEntry(trackIndex, animation, loop, current);
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, interrupt);
this.queue.drain(); this.queue.drain();
return entry; return entry;
}; };
@ -1616,7 +1619,7 @@ var spine;
} }
var entry = this.trackEntry(trackIndex, animation, loop, last); var entry = this.trackEntry(trackIndex, animation, loop, last);
if (last == null) { if (last == null) {
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, true);
this.queue.drain(); this.queue.drain();
} }
else { else {

File diff suppressed because one or more lines are too long

View File

@ -221,7 +221,7 @@ declare module spine {
queueEvents(entry: TrackEntry, animationTime: number): void; queueEvents(entry: TrackEntry, animationTime: number): void;
clearTracks(): void; clearTracks(): void;
clearTrack(trackIndex: number): void; clearTrack(trackIndex: number): void;
setCurrent(index: number, current: TrackEntry): void; setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry; setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry; setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry; addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;

View File

@ -976,7 +976,7 @@ var spine;
next.delay = 0; next.delay = 0;
next.trackTime = nextTime + delta * next.timeScale; next.trackTime = nextTime + delta * next.timeScale;
current.trackTime += currentDelta; current.trackTime += currentDelta;
this.setCurrent(i, next); this.setCurrent(i, next, true);
while (next.mixingFrom != null) { while (next.mixingFrom != null) {
next.mixTime += currentDelta; next.mixTime += currentDelta;
next = next.mixingFrom; next = next.mixingFrom;
@ -1215,11 +1215,12 @@ var spine;
this.tracks[current.trackIndex] = null; this.tracks[current.trackIndex] = null;
this.queue.drain(); this.queue.drain();
}; };
AnimationState.prototype.setCurrent = function (index, current) { AnimationState.prototype.setCurrent = function (index, current, interrupt) {
var from = this.expandToIndex(index); var from = this.expandToIndex(index);
this.tracks[index] = current; this.tracks[index] = current;
if (from != null) { if (from != null) {
this.queue.interrupt(from); if (interrupt)
this.queue.interrupt(from);
current.mixingFrom = from; current.mixingFrom = from;
current.mixTime = 0; current.mixTime = 0;
if (from.mixingFrom != null) if (from.mixingFrom != null)
@ -1236,6 +1237,7 @@ var spine;
AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) { AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) {
if (animation == null) if (animation == null)
throw new Error("animation cannot be null."); throw new Error("animation cannot be null.");
var interrupt = true;
var current = this.expandToIndex(trackIndex); var current = this.expandToIndex(trackIndex);
if (current != null) { if (current != null) {
if (current.nextTrackLast == -1) { if (current.nextTrackLast == -1) {
@ -1244,12 +1246,13 @@ var spine;
this.queue.end(current); this.queue.end(current);
this.disposeNext(current); this.disposeNext(current);
current = current.mixingFrom; current = current.mixingFrom;
interrupt = false;
} }
else else
this.disposeNext(current); this.disposeNext(current);
} }
var entry = this.trackEntry(trackIndex, animation, loop, current); var entry = this.trackEntry(trackIndex, animation, loop, current);
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, interrupt);
this.queue.drain(); this.queue.drain();
return entry; return entry;
}; };
@ -1269,7 +1272,7 @@ var spine;
} }
var entry = this.trackEntry(trackIndex, animation, loop, last); var entry = this.trackEntry(trackIndex, animation, loop, last);
if (last == null) { if (last == null) {
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, true);
this.queue.drain(); this.queue.drain();
} }
else { else {

File diff suppressed because one or more lines are too long

View File

@ -221,7 +221,7 @@ declare module spine {
queueEvents(entry: TrackEntry, animationTime: number): void; queueEvents(entry: TrackEntry, animationTime: number): void;
clearTracks(): void; clearTracks(): void;
clearTrack(trackIndex: number): void; clearTrack(trackIndex: number): void;
setCurrent(index: number, current: TrackEntry): void; setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry; setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry; setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry; addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;

View File

@ -976,7 +976,7 @@ var spine;
next.delay = 0; next.delay = 0;
next.trackTime = nextTime + delta * next.timeScale; next.trackTime = nextTime + delta * next.timeScale;
current.trackTime += currentDelta; current.trackTime += currentDelta;
this.setCurrent(i, next); this.setCurrent(i, next, true);
while (next.mixingFrom != null) { while (next.mixingFrom != null) {
next.mixTime += currentDelta; next.mixTime += currentDelta;
next = next.mixingFrom; next = next.mixingFrom;
@ -1215,11 +1215,12 @@ var spine;
this.tracks[current.trackIndex] = null; this.tracks[current.trackIndex] = null;
this.queue.drain(); this.queue.drain();
}; };
AnimationState.prototype.setCurrent = function (index, current) { AnimationState.prototype.setCurrent = function (index, current, interrupt) {
var from = this.expandToIndex(index); var from = this.expandToIndex(index);
this.tracks[index] = current; this.tracks[index] = current;
if (from != null) { if (from != null) {
this.queue.interrupt(from); if (interrupt)
this.queue.interrupt(from);
current.mixingFrom = from; current.mixingFrom = from;
current.mixTime = 0; current.mixTime = 0;
if (from.mixingFrom != null) if (from.mixingFrom != null)
@ -1236,6 +1237,7 @@ var spine;
AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) { AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) {
if (animation == null) if (animation == null)
throw new Error("animation cannot be null."); throw new Error("animation cannot be null.");
var interrupt = true;
var current = this.expandToIndex(trackIndex); var current = this.expandToIndex(trackIndex);
if (current != null) { if (current != null) {
if (current.nextTrackLast == -1) { if (current.nextTrackLast == -1) {
@ -1244,12 +1246,13 @@ var spine;
this.queue.end(current); this.queue.end(current);
this.disposeNext(current); this.disposeNext(current);
current = current.mixingFrom; current = current.mixingFrom;
interrupt = false;
} }
else else
this.disposeNext(current); this.disposeNext(current);
} }
var entry = this.trackEntry(trackIndex, animation, loop, current); var entry = this.trackEntry(trackIndex, animation, loop, current);
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, interrupt);
this.queue.drain(); this.queue.drain();
return entry; return entry;
}; };
@ -1269,7 +1272,7 @@ var spine;
} }
var entry = this.trackEntry(trackIndex, animation, loop, last); var entry = this.trackEntry(trackIndex, animation, loop, last);
if (last == null) { if (last == null) {
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, true);
this.queue.drain(); this.queue.drain();
} }
else { else {

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -221,7 +221,7 @@ declare module spine {
queueEvents(entry: TrackEntry, animationTime: number): void; queueEvents(entry: TrackEntry, animationTime: number): void;
clearTracks(): void; clearTracks(): void;
clearTrack(trackIndex: number): void; clearTrack(trackIndex: number): void;
setCurrent(index: number, current: TrackEntry): void; setCurrent(index: number, current: TrackEntry, interrupt: boolean): void;
setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry; setAnimation(trackIndex: number, animationName: string, loop: boolean): TrackEntry;
setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry; setAnimationWith(trackIndex: number, animation: Animation, loop: boolean): TrackEntry;
addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry; addAnimation(trackIndex: number, animationName: string, loop: boolean, delay: number): TrackEntry;

View File

@ -976,7 +976,7 @@ var spine;
next.delay = 0; next.delay = 0;
next.trackTime = nextTime + delta * next.timeScale; next.trackTime = nextTime + delta * next.timeScale;
current.trackTime += currentDelta; current.trackTime += currentDelta;
this.setCurrent(i, next); this.setCurrent(i, next, true);
while (next.mixingFrom != null) { while (next.mixingFrom != null) {
next.mixTime += currentDelta; next.mixTime += currentDelta;
next = next.mixingFrom; next = next.mixingFrom;
@ -1215,11 +1215,12 @@ var spine;
this.tracks[current.trackIndex] = null; this.tracks[current.trackIndex] = null;
this.queue.drain(); this.queue.drain();
}; };
AnimationState.prototype.setCurrent = function (index, current) { AnimationState.prototype.setCurrent = function (index, current, interrupt) {
var from = this.expandToIndex(index); var from = this.expandToIndex(index);
this.tracks[index] = current; this.tracks[index] = current;
if (from != null) { if (from != null) {
this.queue.interrupt(from); if (interrupt)
this.queue.interrupt(from);
current.mixingFrom = from; current.mixingFrom = from;
current.mixTime = 0; current.mixTime = 0;
if (from.mixingFrom != null) if (from.mixingFrom != null)
@ -1236,6 +1237,7 @@ var spine;
AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) { AnimationState.prototype.setAnimationWith = function (trackIndex, animation, loop) {
if (animation == null) if (animation == null)
throw new Error("animation cannot be null."); throw new Error("animation cannot be null.");
var interrupt = true;
var current = this.expandToIndex(trackIndex); var current = this.expandToIndex(trackIndex);
if (current != null) { if (current != null) {
if (current.nextTrackLast == -1) { if (current.nextTrackLast == -1) {
@ -1244,12 +1246,13 @@ var spine;
this.queue.end(current); this.queue.end(current);
this.disposeNext(current); this.disposeNext(current);
current = current.mixingFrom; current = current.mixingFrom;
interrupt = false;
} }
else else
this.disposeNext(current); this.disposeNext(current);
} }
var entry = this.trackEntry(trackIndex, animation, loop, current); var entry = this.trackEntry(trackIndex, animation, loop, current);
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, interrupt);
this.queue.drain(); this.queue.drain();
return entry; return entry;
}; };
@ -1269,7 +1272,7 @@ var spine;
} }
var entry = this.trackEntry(trackIndex, animation, loop, last); var entry = this.trackEntry(trackIndex, animation, loop, last);
if (last == null) { if (last == null) {
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, true);
this.queue.drain(); this.queue.drain();
} }
else { else {

File diff suppressed because one or more lines are too long

View File

@ -74,7 +74,7 @@ module spine {
next.delay = 0; next.delay = 0;
next.trackTime = nextTime + delta * next.timeScale; next.trackTime = nextTime + delta * next.timeScale;
current.trackTime += currentDelta; current.trackTime += currentDelta;
this.setCurrent(i, next); this.setCurrent(i, next, true);
while (next.mixingFrom != null) { while (next.mixingFrom != null) {
next.mixTime += currentDelta; next.mixTime += currentDelta;
next = next.mixingFrom; next = next.mixingFrom;
@ -338,12 +338,12 @@ module spine {
this.queue.drain(); this.queue.drain();
} }
setCurrent (index: number, current: TrackEntry) { setCurrent (index: number, current: TrackEntry, interrupt: boolean) {
let from = this.expandToIndex(index); let from = this.expandToIndex(index);
this.tracks[index] = current; this.tracks[index] = current;
if (from != null) { if (from != null) {
this.queue.interrupt(from); if (interrupt) this.queue.interrupt(from);
current.mixingFrom = from; current.mixingFrom = from;
current.mixTime = 0; current.mixTime = 0;
@ -362,6 +362,7 @@ module spine {
setAnimationWith (trackIndex: number, animation: Animation, loop: boolean) { setAnimationWith (trackIndex: number, animation: Animation, loop: boolean) {
if (animation == null) throw new Error("animation cannot be null."); if (animation == null) throw new Error("animation cannot be null.");
let interrupt = true;
let current = this.expandToIndex(trackIndex); let current = this.expandToIndex(trackIndex);
if (current != null) { if (current != null) {
if (current.nextTrackLast == -1) { if (current.nextTrackLast == -1) {
@ -371,11 +372,12 @@ module spine {
this.queue.end(current); this.queue.end(current);
this.disposeNext(current); this.disposeNext(current);
current = current.mixingFrom; current = current.mixingFrom;
interrupt = false;
} else } else
this.disposeNext(current); this.disposeNext(current);
} }
let entry = this.trackEntry(trackIndex, animation, loop, current); let entry = this.trackEntry(trackIndex, animation, loop, current);
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, interrupt);
this.queue.drain(); this.queue.drain();
return entry; return entry;
} }
@ -398,7 +400,7 @@ module spine {
let entry = this.trackEntry(trackIndex, animation, loop, last); let entry = this.trackEntry(trackIndex, animation, loop, last);
if (last == null) { if (last == null) {
this.setCurrent(trackIndex, entry); this.setCurrent(trackIndex, entry, true);
this.queue.drain(); this.queue.drain();
} else { } else {
last.next = entry; last.next = entry;