mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[libgdx] SkeletonViewer, don't use additive for track 0. Improved UI disable states.
This commit is contained in:
parent
7e440c28ae
commit
5d1852662c
@ -12,6 +12,7 @@ com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
|
|||||||
selection: { name: white, color: selection },
|
selection: { name: white, color: selection },
|
||||||
dim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.3 } },
|
dim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.3 } },
|
||||||
list-selection: { name: list-selection, color: selection },
|
list-selection: { name: list-selection, color: selection },
|
||||||
|
slider-handle-disabled: { name: slider-handle, color: disabled },
|
||||||
},
|
},
|
||||||
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
|
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
|
||||||
default: {
|
default: {
|
||||||
@ -61,6 +62,6 @@ com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
|
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
|
||||||
default-horizontal: { background: slider-bg, knob: slider-handle },
|
default-horizontal: { background: slider-bg, knob: slider-handle, disabledKnob: slider-handle-disabled },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -209,7 +209,7 @@ public class SkeletonViewer extends ApplicationAdapter {
|
|||||||
entry = state.setAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked());
|
entry = state.setAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked());
|
||||||
entry.setHoldPrevious(track > 0 && ui.holdPrevCheckbox.isChecked());
|
entry.setHoldPrevious(track > 0 && ui.holdPrevCheckbox.isChecked());
|
||||||
}
|
}
|
||||||
entry.setMixBlend(ui.addCheckbox.isChecked() ? MixBlend.add : MixBlend.replace);
|
entry.setMixBlend(track > 0 && ui.addCheckbox.isChecked() ? MixBlend.add : MixBlend.replace);
|
||||||
entry.setReverse(ui.reverseCheckbox.isChecked());
|
entry.setReverse(ui.reverseCheckbox.isChecked());
|
||||||
entry.setAlpha(ui.alphaSlider.getValue());
|
entry.setAlpha(ui.alphaSlider.getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,6 +62,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
import com.badlogic.gdx.scenes.scene2d.ui.Window;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Null;
|
import com.badlogic.gdx.utils.Null;
|
||||||
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
import com.badlogic.gdx.utils.viewport.ScreenViewport;
|
||||||
@ -125,7 +126,9 @@ class SkeletonViewerUI {
|
|||||||
|
|
||||||
ButtonGroup<TextButton> trackButtons = new ButtonGroup();
|
ButtonGroup<TextButton> trackButtons = new ButtonGroup();
|
||||||
CheckBox loopCheckbox = new CheckBox("Loop", skin);
|
CheckBox loopCheckbox = new CheckBox("Loop", skin);
|
||||||
CheckBox addCheckbox = new CheckBox("Add", skin);
|
CheckBox reverseCheckbox = new CheckBox("Reverse", skin);
|
||||||
|
CheckBox holdPrevCheckbox = new HigherTrackCheckBox("Hold previous");
|
||||||
|
CheckBox addCheckbox = new HigherTrackCheckBox("Add");
|
||||||
|
|
||||||
Slider alphaSlider = new Slider(0, 1, 0.01f, false, skin);
|
Slider alphaSlider = new Slider(0, 1, 0.01f, false, skin);
|
||||||
Label alphaLabel = new Label("100%", skin);
|
Label alphaLabel = new Label("100%", skin);
|
||||||
@ -137,9 +140,6 @@ class SkeletonViewerUI {
|
|||||||
Label speedLabel = new Label("1.0x", skin);
|
Label speedLabel = new Label("1.0x", skin);
|
||||||
TextButton speedResetButton = new TextButton("Reset", skin);
|
TextButton speedResetButton = new TextButton("Reset", skin);
|
||||||
|
|
||||||
CheckBox reverseCheckbox = new CheckBox("Reverse", skin);
|
|
||||||
CheckBox holdPrevCheckbox = new CheckBox("Hold previous", skin);
|
|
||||||
|
|
||||||
Slider mixSlider = new Slider(0, 4, 0.01f, false, skin);
|
Slider mixSlider = new Slider(0, 4, 0.01f, false, skin);
|
||||||
Label mixLabel = new Label("0.3s", skin);
|
Label mixLabel = new Label("0.3s", skin);
|
||||||
|
|
||||||
@ -194,6 +194,7 @@ class SkeletonViewerUI {
|
|||||||
|
|
||||||
alphaSlider.setValue(1);
|
alphaSlider.setValue(1);
|
||||||
alphaSlider.setDisabled(true);
|
alphaSlider.setDisabled(true);
|
||||||
|
alphaLabel.setColor(skin.getColor("disabled"));
|
||||||
|
|
||||||
addCheckbox.setDisabled(true);
|
addCheckbox.setDisabled(true);
|
||||||
holdPrevCheckbox.setDisabled(true);
|
holdPrevCheckbox.setDisabled(true);
|
||||||
@ -557,6 +558,7 @@ class SkeletonViewerUI {
|
|||||||
animationList.getSelection().setProgrammaticChangeEvents(true);
|
animationList.getSelection().setProgrammaticChangeEvents(true);
|
||||||
|
|
||||||
alphaSlider.setDisabled(track == 0);
|
alphaSlider.setDisabled(track == 0);
|
||||||
|
alphaLabel.setColor(track == 0 ? skin.getColor("disabled") : Color.WHITE);
|
||||||
alphaSlider.setValue(current == null ? 1 : current.alpha);
|
alphaSlider.setValue(current == null ? 1 : current.alpha);
|
||||||
|
|
||||||
addCheckbox.setDisabled(track == 0);
|
addCheckbox.setDisabled(track == 0);
|
||||||
@ -564,11 +566,13 @@ class SkeletonViewerUI {
|
|||||||
|
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
loopCheckbox.setChecked(current.getLoop());
|
loopCheckbox.setChecked(current.getLoop());
|
||||||
addCheckbox.setChecked(current.getMixBlend() == MixBlend.add);
|
|
||||||
reverseCheckbox.setChecked(current.getReverse());
|
reverseCheckbox.setChecked(current.getReverse());
|
||||||
|
if (track > 0) {
|
||||||
|
addCheckbox.setChecked(current.getMixBlend() == MixBlend.add);
|
||||||
holdPrevCheckbox.setChecked(current.getHoldPrevious());
|
holdPrevCheckbox.setChecked(current.getHoldPrevious());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
for (TextButton button : trackButtons.getButtons())
|
for (TextButton button : trackButtons.getButtons())
|
||||||
button.addListener(trackButtonListener);
|
button.addListener(trackButtonListener);
|
||||||
@ -762,4 +766,15 @@ class SkeletonViewerUI {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HigherTrackCheckBox extends CheckBox {
|
||||||
|
public HigherTrackCheckBox (String text) {
|
||||||
|
super(text, skin);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Drawable getImageDrawable () {
|
||||||
|
if (trackButtons.getCheckedIndex() == 0) return getStyle().checkboxOffDisabled;
|
||||||
|
return super.getImageDrawable();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user