mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-08 11:46:53 +08:00
Merge branch 'master' of https://github.com/EsotericSoftware/spine-runtimes
This commit is contained in:
commit
be13e57bbc
@ -650,8 +650,8 @@ public class AnimationStateTests {
|
|||||||
expect(0, "end", 0.8f, 0.9f), //
|
expect(0, "end", 0.8f, 0.9f), //
|
||||||
expect(0, "dispose", 0.8f, 0.9f), //
|
expect(0, "dispose", 0.8f, 0.9f), //
|
||||||
|
|
||||||
expect(-1, "end", 0.1f, 0.9f), //
|
expect(-1, "end", 0.2f, 1), //
|
||||||
expect(-1, "dispose", 0.1f, 0.9f) //
|
expect(-1, "dispose", 0.2f, 1) //
|
||||||
);
|
);
|
||||||
state.addAnimation(0, "events1", false, 0);
|
state.addAnimation(0, "events1", false, 0);
|
||||||
run(0.1f, 10, new TestListener() {
|
run(0.1f, 10, new TestListener() {
|
||||||
|
|||||||
@ -108,9 +108,7 @@ public class AnimationState {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
updateMixingFrom(current, delta);
|
|
||||||
} else {
|
} else {
|
||||||
updateMixingFrom(current, delta);
|
|
||||||
// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
|
// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
|
||||||
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
|
||||||
tracks.set(i, null);
|
tracks.set(i, null);
|
||||||
@ -119,6 +117,7 @@ public class AnimationState {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateMixingFrom(current, delta);
|
||||||
|
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
}
|
}
|
||||||
@ -158,7 +157,10 @@ public class AnimationState {
|
|||||||
|
|
||||||
// Apply mixing from entries first.
|
// Apply mixing from entries first.
|
||||||
float mix = current.alpha;
|
float mix = current.alpha;
|
||||||
if (current.mixingFrom != null) mix *= applyMixingFrom(current, skeleton);
|
if (current.mixingFrom != null)
|
||||||
|
mix *= applyMixingFrom(current, skeleton);
|
||||||
|
else if (current.trackTime >= current.trackEnd) //
|
||||||
|
mix = 0; // Set to setup pose the last time the entry will be applied.
|
||||||
|
|
||||||
// Apply current entry.
|
// Apply current entry.
|
||||||
float animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
float animationLast = current.animationLast, animationTime = current.getAnimationTime();
|
||||||
@ -408,11 +410,11 @@ public class AnimationState {
|
|||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
// Don't mix from an entry that was never applied.
|
// Don't mix from an entry that was never applied.
|
||||||
tracks.set(trackIndex, null);
|
tracks.set(trackIndex, current.mixingFrom);
|
||||||
queue.interrupt(current);
|
queue.interrupt(current);
|
||||||
queue.end(current);
|
queue.end(current);
|
||||||
disposeNext(current);
|
disposeNext(current);
|
||||||
current = null;
|
current = current.mixingFrom;
|
||||||
} else
|
} else
|
||||||
disposeNext(current);
|
disposeNext(current);
|
||||||
}
|
}
|
||||||
@ -750,10 +752,10 @@ public class AnimationState {
|
|||||||
/** The track time in seconds when this animation will be removed from the track. Defaults to the animation
|
/** The track time in seconds when this animation will be removed from the track. Defaults to the animation
|
||||||
* {@link Animation#duration} for non-looping animations and the highest float possible for looping animations. If the track
|
* {@link Animation#duration} for non-looping animations and the highest float possible for looping animations. If the track
|
||||||
* end time is reached, no other animations are queued for playback, and mixing from any previous animations is complete,
|
* end time is reached, no other animations are queued for playback, and mixing from any previous animations is complete,
|
||||||
* then the track is cleared, leaving skeletons in their previous pose.
|
* then the properties keyed by the animation are set to the setup pose and the track is cleared.
|
||||||
* <p>
|
* <p>
|
||||||
* It may be desired to use {@link AnimationState#addEmptyAnimation(int, float, float)} to mix the skeletons back to the
|
* It may be desired to use {@link AnimationState#addEmptyAnimation(int, float, float)} to mix the properties back to the
|
||||||
* setup pose, rather than leaving them in their previous pose. */
|
* setup pose over time, rather than have it happen instantly. */
|
||||||
public float getTrackEnd () {
|
public float getTrackEnd () {
|
||||||
return trackEnd;
|
return trackEnd;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -227,10 +227,8 @@ public class SkeletonViewer extends ApplicationAdapter {
|
|||||||
state.setEmptyAnimation(track, 0);
|
state.setEmptyAnimation(track, 0);
|
||||||
entry = state.addAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked(), 0);
|
entry = state.addAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked(), 0);
|
||||||
entry.setMixDuration(ui.mixSlider.getValue());
|
entry.setMixDuration(ui.mixSlider.getValue());
|
||||||
entry.setTrackEnd(Integer.MAX_VALUE);
|
|
||||||
} else {
|
} else {
|
||||||
entry = state.setAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked());
|
entry = state.setAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked());
|
||||||
entry.setTrackEnd(Integer.MAX_VALUE);
|
|
||||||
}
|
}
|
||||||
entry.setAlpha(ui.alphaSlider.getValue());
|
entry.setAlpha(ui.alphaSlider.getValue());
|
||||||
}
|
}
|
||||||
@ -705,6 +703,12 @@ public class SkeletonViewer extends ApplicationAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void render () {
|
void render () {
|
||||||
|
if (state.getCurrent(ui.trackButtons.getCheckedIndex()) == null) {
|
||||||
|
ui.animationList.getSelection().setProgrammaticChangeEvents(false);
|
||||||
|
ui.animationList.setSelected(null);
|
||||||
|
ui.animationList.getSelection().setProgrammaticChangeEvents(true);
|
||||||
|
}
|
||||||
|
|
||||||
statusLabel.pack();
|
statusLabel.pack();
|
||||||
if (minimizeButton.isChecked())
|
if (minimizeButton.isChecked())
|
||||||
statusLabel.setPosition(10, 25, Align.bottom | Align.left);
|
statusLabel.setPosition(10, 25, Align.bottom | Align.left);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user