[libgdx] SkeletonViewer, don't use mixing from an empty animation to play the first animation after loading the skeleton.

This commit is contained in:
Nathan Sweet 2021-06-18 22:23:25 -04:00
parent ca9a3ff7c2
commit f567c18cfa
2 changed files with 7 additions and 6 deletions

View File

@ -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());

View File

@ -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);