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

View File

@@ -71,7 +71,7 @@ public class SPTimeline implements PathingRegistry {
@Getter @Getter
private EntityPositionTracker entityTracker; private EntityPositionTracker entityTracker;
private InterpolatorType defaultInterpolatorType = InterpolatorType.fromString("invalid string returns default"); private InterpolatorType defaultInterpolatorType;
public SPTimeline() { public SPTimeline() {
this(createInitialTimeline()); 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 dropdown.setSelected(type); // trigger the callback once to display settings panel
} else { } else {
setSettingsPanel(InterpolatorType.DEFAULT); setSettingsPanel(InterpolatorType.DEFAULT);
type = InterpolatorType.DEFAULT;
} }
if (getInterpolatorTypeNoDefault(type).getInterpolatorClass().isInstance(interpolator)) { if (getInterpolatorTypeNoDefault(type).getInterpolatorClass().isInstance(interpolator)) {
//noinspection unchecked //noinspection unchecked