mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[libgdx] SkeletonViewer, don't use mixing from an empty animation to play the first animation after loading the skeleton.
This commit is contained in:
parent
ca9a3ff7c2
commit
f567c18cfa
@ -108,6 +108,7 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
|
||||
ui.loadPrefs();
|
||||
ui.prefsLoaded = true;
|
||||
setAnimation(true);
|
||||
|
||||
if (false) {
|
||||
ui.animationList.clearListeners();
|
||||
@ -182,16 +183,16 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
// Configure skeleton from UI.
|
||||
|
||||
if (ui.skinList.getSelected() != null) skeleton.setSkin(ui.skinList.getSelected());
|
||||
setAnimation();
|
||||
setAnimation(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void setAnimation () {
|
||||
void setAnimation (boolean first) {
|
||||
if (!ui.prefsLoaded) return;
|
||||
if (ui.animationList.getSelected() == null) return;
|
||||
int track = ui.trackButtons.getCheckedIndex();
|
||||
TrackEntry current = state.getCurrent(track);
|
||||
TrackEntry entry;
|
||||
if (current == null) {
|
||||
if (!first && state.getCurrent(track) == null) {
|
||||
state.setEmptyAnimation(track, 0);
|
||||
entry = state.addAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked(), 0);
|
||||
entry.setMixDuration(ui.mixSlider.getValue());
|
||||
|
||||
@ -483,7 +483,7 @@ class SkeletonViewerUI {
|
||||
if (name == null)
|
||||
viewer.state.setEmptyAnimation(trackButtons.getCheckedIndex(), mixSlider.getValue());
|
||||
else
|
||||
viewer.setAnimation();
|
||||
viewer.setAnimation(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -491,7 +491,7 @@ class SkeletonViewerUI {
|
||||
|
||||
ChangeListener setAnimation = new ChangeListener() {
|
||||
public void changed (ChangeEvent event, Actor actor) {
|
||||
viewer.setAnimation();
|
||||
viewer.setAnimation(false);
|
||||
}
|
||||
};
|
||||
loopCheckbox.addListener(setAnimation);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user