Fix default interpolator handling in keyframe gui and after loading (fixes #64)

This commit is contained in:
Jonas Herzig
2017-05-21 16:29:59 +02:00
parent 391f304c5f
commit f13297c5a5
3 changed files with 4 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ public class ReplayModSimplePathing {
@SubscribeEvent
public void postReplayOpen(ReplayOpenEvent.Post event) {
currentTimeline = new SPTimeline();
clearCurrentTimeline();
guiPathing = new GuiPathing(core, this, event.getReplayHandler());
}
@@ -85,11 +85,11 @@ public class ReplayModSimplePathing {
public void setCurrentTimeline(SPTimeline newTimeline) {
selectedPath = null;
currentTimeline = newTimeline;
updateDefaultInterpolatorType();
}
public void clearCurrentTimeline() {
setCurrentTimeline(new SPTimeline());
updateDefaultInterpolatorType();
}
public SPTimeline getCurrentTimeline() {

View File

@@ -71,7 +71,7 @@ public class SPTimeline implements PathingRegistry {
@Getter
private EntityPositionTracker entityTracker;
private InterpolatorType defaultInterpolatorType = InterpolatorType.fromString("invalid string returns default");
private InterpolatorType defaultInterpolatorType;
public SPTimeline() {
this(createInitialTimeline());

View File

@@ -310,6 +310,7 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
dropdown.setSelected(type); // trigger the callback once to display settings panel
} else {
setSettingsPanel(InterpolatorType.DEFAULT);
type = InterpolatorType.DEFAULT;
}
if (getInterpolatorTypeNoDefault(type).getInterpolatorClass().isInstance(interpolator)) {
//noinspection unchecked