DOF polished

This commit is contained in:
2026-07-07 05:04:16 +04:00
parent 6024227716
commit 9f51c59508
6 changed files with 86 additions and 52 deletions

View File

@@ -2,7 +2,6 @@ package com.replaymod.simplepathing.gui;
import com.replaymod.pathing.properties.CameraProperties;
import com.replaymod.pathing.properties.TimestampProperty;
import com.replaymod.pathing.properties.LensProperties;
import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replaystudio.pathing.change.Change;
import com.replaymod.replaystudio.pathing.change.CombinedChange;
@@ -146,17 +145,21 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
protected abstract Change save();
public static class Spectator extends GuiEditKeyframe<Spectator> {
public final GuiLensKeyframePanel lensPanel = new GuiLensKeyframePanel();
public Spectator(GuiPathing gui, SPPath path, long keyframe) {
super(gui, path, keyframe, "spec");
link(timeMinField, timeSecField, timeMSecField);
inputs.setLayout(new VerticalLayout().setSpacing(10)).addElements(new VerticalLayout.Data(0.5, false), lensPanel.load(this.keyframe));
link(lensPanel.focalDistanceField, lensPanel.apertureRadiusField, timeMinField, timeSecField, timeMSecField);
popup.invokeAll(IGuiLabel.class, e -> e.setColor(Colors.BLACK));
}
@Override
protected Change save() {
return CombinedChange.createFromApplied();
return guiPathing.getMod().getCurrentTimeline().updateLensProperties(time, lensPanel.getFocalDistance(), lensPanel.getApertureRadius());
}
@Override
@@ -215,11 +218,10 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
public final GuiNumberField pitchField = newGuiNumberField().setSize(60, 20).setPrecision(5);
public final GuiNumberField rollField = newGuiNumberField().setSize(60, 20).setPrecision(5);
public final GuiNumberField focalDistanceField = newGuiNumberField().setSize(60, 20).setPrecision(3);
public final GuiNumberField apertureRadiusField = newGuiNumberField().setSize(60, 20).setPrecision(4);
public final InterpolationPanel interpolationPanel = new InterpolationPanel();
public final GuiLensKeyframePanel lensPanel = new GuiLensKeyframePanel();
{
GuiPanel positionInputs = new GuiPanel()
.setLayout(new GridLayout().setCellsEqualSize(false).setColumns(4).setSpacingX(3).setSpacingY(5))
@@ -229,13 +231,11 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.ypos"), yField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.campitch"), pitchField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.zpos"), zField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.camroll"), rollField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.focalDistance"), focalDistanceField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.apertureRadius"), apertureRadiusField
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.camroll"), rollField
);
inputs.setLayout(new VerticalLayout().setSpacing(10)).addElements(new VerticalLayout.Data(0.5, false),
positionInputs, interpolationPanel);
positionInputs, lensPanel, interpolationPanel);
}
public Position(GuiPathing gui, SPPath path, long keyframe) {
@@ -252,12 +252,9 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
rollField.setValue(rot.getRight());
});
this.keyframe.getValue(LensProperties.FOCAL_DISTANCE)
.ifPresent(v -> focalDistanceField.setValue(v.getLeft()));
this.keyframe.getValue(LensProperties.APERTURE_RADIUS)
.ifPresent(v -> apertureRadiusField.setValue(v.getLeft()));
lensPanel.load(this.keyframe);
link(xField, yField, zField, yawField, pitchField, rollField, focalDistanceField, apertureRadiusField, timeMinField, timeSecField, timeMSecField);
link(xField, yField, zField, yawField, pitchField, rollField, timeMinField, lensPanel.focalDistanceField, lensPanel.apertureRadiusField, timeSecField, timeMSecField);
popup.invokeAll(IGuiLabel.class, e -> e.setColor(Colors.BLACK));
}
@@ -267,19 +264,21 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
SPTimeline timeline = guiPathing.getMod().getCurrentTimeline();
Change positionChange = timeline.updatePositionKeyframe(time,
xField.getDouble(), yField.getDouble(), zField.getDouble(),
yawField.getFloat(), pitchField.getFloat(), rollField.getFloat(),
focalDistanceField.getFloat(), apertureRadiusField.getFloat()
yawField.getFloat(), pitchField.getFloat(), rollField.getFloat()
);
Change lensChange = timeline.updateLensProperties(time,
lensPanel.getFocalDistance(), lensPanel.getApertureRadius());
if (interpolationPanel.getSettingsPanel() == null) {
// The last keyframe doesn't have interpolator settings because there is no segment following it
return positionChange;
return CombinedChange.createFromApplied(positionChange, lensChange);
}
Interpolator interpolator = interpolationPanel.getSettingsPanel().createInterpolator();
if (interpolationPanel.getInterpolatorType() == InterpolatorType.DEFAULT) {
return CombinedChange.createFromApplied(positionChange, timeline.setInterpolatorToDefault(time),
timeline.setDefaultInterpolator(interpolator));
return CombinedChange.createFromApplied(positionChange, lensChange,
timeline.setInterpolatorToDefault(time), timeline.setDefaultInterpolator(interpolator));
} else {
return CombinedChange.createFromApplied(positionChange, timeline.setInterpolator(time, interpolator));
return CombinedChange.createFromApplied(positionChange, lensChange,
timeline.setInterpolator(time, interpolator));
}
}