working DOF
This commit is contained in:
@@ -9,6 +9,7 @@ import com.google.gson.stream.JsonWriter;
|
||||
import com.replaymod.pathing.properties.CameraProperties;
|
||||
import com.replaymod.pathing.properties.SpectatorProperty;
|
||||
import com.replaymod.pathing.properties.TimestampProperty;
|
||||
import com.replaymod.pathing.properties.LensProperties;
|
||||
import com.replaymod.replaystudio.pathing.PathingRegistry;
|
||||
import com.replaymod.replaystudio.pathing.change.AddKeyframe;
|
||||
import com.replaymod.replaystudio.pathing.change.Change;
|
||||
@@ -158,6 +159,12 @@ public class SPTimeline implements PathingRegistry {
|
||||
|
||||
public void addPositionKeyframe(long time, double posX, double posY, double posZ,
|
||||
float yaw, float pitch, float roll, int spectated) {
|
||||
addPositionKeyframe(time, posX, posY, posZ, yaw, pitch, roll, spectated, 5.0f, 0.05f);
|
||||
}
|
||||
|
||||
public void addPositionKeyframe(long time, double posX, double posY, double posZ,
|
||||
float yaw, float pitch, float roll, int spectated,
|
||||
float focalDistance, float apertureRadius) {
|
||||
LOGGER.debug("Adding position keyframe at {} pos {}/{}/{} rot {}/{}/{} entId {}",
|
||||
time, posX, posY, posZ, yaw, pitch, roll, spectated);
|
||||
|
||||
@@ -172,6 +179,8 @@ public class SPTimeline implements PathingRegistry {
|
||||
UpdateKeyframeProperties.Builder builder = UpdateKeyframeProperties.create(path, keyframe);
|
||||
builder.setValue(CameraProperties.POSITION, Triple.of(posX, posY, posZ));
|
||||
builder.setValue(CameraProperties.ROTATION, Triple.of(yaw, pitch, roll));
|
||||
builder.setValue(LensProperties.FOCAL_DISTANCE, Triple.of(focalDistance, 0f, 0f));
|
||||
builder.setValue(LensProperties.APERTURE_RADIUS, Triple.of(apertureRadius, 0f, 0f));
|
||||
if (spectated != -1) {
|
||||
builder.setValue(SpectatorProperty.PROPERTY, spectated);
|
||||
}
|
||||
@@ -201,7 +210,13 @@ public class SPTimeline implements PathingRegistry {
|
||||
}
|
||||
|
||||
public Change updatePositionKeyframe(long time, double posX, double posY, double posZ,
|
||||
float yaw, float pitch, float roll) {
|
||||
float yaw, float pitch, float roll) {
|
||||
return updatePositionKeyframe(time, posX, posY, posZ, yaw, pitch, roll, 5.0f, 0.05f);
|
||||
}
|
||||
|
||||
public Change updatePositionKeyframe(long time, double posX, double posY, double posZ,
|
||||
float yaw, float pitch, float roll,
|
||||
float focalDistance, float apertureRadius) {
|
||||
LOGGER.debug("Updating position keyframe at {} to pos {}/{}/{} rot {}/{}/{}",
|
||||
time, posX, posY, posZ, yaw, pitch, roll);
|
||||
|
||||
@@ -213,6 +228,8 @@ public class SPTimeline implements PathingRegistry {
|
||||
Change change = UpdateKeyframeProperties.create(positionPath, keyframe)
|
||||
.setValue(CameraProperties.POSITION, Triple.of(posX, posY, posZ))
|
||||
.setValue(CameraProperties.ROTATION, Triple.of(yaw, pitch, roll))
|
||||
.setValue(LensProperties.FOCAL_DISTANCE, Triple.of(focalDistance, 0f, 0f))
|
||||
.setValue(LensProperties.APERTURE_RADIUS, Triple.of(apertureRadius, 0f, 0f))
|
||||
.done();
|
||||
change.apply(timeline);
|
||||
return change;
|
||||
@@ -569,6 +586,8 @@ public class SPTimeline implements PathingRegistry {
|
||||
private Interpolator registerPositionInterpolatorProperties(Interpolator interpolator) {
|
||||
interpolator.registerProperty(CameraProperties.POSITION);
|
||||
interpolator.registerProperty(CameraProperties.ROTATION);
|
||||
interpolator.registerProperty(LensProperties.FOCAL_DISTANCE);
|
||||
interpolator.registerProperty(LensProperties.APERTURE_RADIUS);
|
||||
return interpolator;
|
||||
}
|
||||
|
||||
@@ -592,6 +611,8 @@ public class SPTimeline implements PathingRegistry {
|
||||
timeline.registerProperty(CameraProperties.ROTATION);
|
||||
timeline.registerProperty(SpectatorProperty.PROPERTY);
|
||||
timeline.registerProperty(ExplicitInterpolationProperty.PROPERTY);
|
||||
timeline.registerProperty(LensProperties.FOCAL_DISTANCE);
|
||||
timeline.registerProperty(LensProperties.APERTURE_RADIUS);
|
||||
|
||||
return timeline;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -214,6 +215,9 @@ 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();
|
||||
|
||||
{
|
||||
@@ -225,7 +229,10 @@ 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.camroll"), rollField,
|
||||
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.focalDistance"), focalDistanceField,
|
||||
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.apertureRadius"), apertureRadiusField
|
||||
);
|
||||
|
||||
inputs.setLayout(new VerticalLayout().setSpacing(10)).addElements(new VerticalLayout.Data(0.5, false),
|
||||
positionInputs, interpolationPanel);
|
||||
@@ -245,7 +252,12 @@ public abstract class GuiEditKeyframe<T extends GuiEditKeyframe<T>> extends Abst
|
||||
rollField.setValue(rot.getRight());
|
||||
});
|
||||
|
||||
link(xField, yField, zField, yawField, pitchField, rollField, timeMinField, timeSecField, timeMSecField);
|
||||
this.keyframe.getValue(LensProperties.FOCAL_DISTANCE)
|
||||
.ifPresent(v -> focalDistanceField.setValue(v.getLeft()));
|
||||
this.keyframe.getValue(LensProperties.APERTURE_RADIUS)
|
||||
.ifPresent(v -> apertureRadiusField.setValue(v.getLeft()));
|
||||
|
||||
link(xField, yField, zField, yawField, pitchField, rollField, focalDistanceField, apertureRadiusField, timeMinField, timeSecField, timeMSecField);
|
||||
|
||||
popup.invokeAll(IGuiLabel.class, e -> e.setColor(Colors.BLACK));
|
||||
}
|
||||
@@ -255,7 +267,8 @@ 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()
|
||||
yawField.getFloat(), pitchField.getFloat(), rollField.getFloat(),
|
||||
focalDistanceField.getFloat(), apertureRadiusField.getFloat()
|
||||
);
|
||||
if (interpolationPanel.getSettingsPanel() == null) {
|
||||
// The last keyframe doesn't have interpolator settings because there is no segment following it
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.replaymod.pathing.player.RealtimeTimelinePlayer;
|
||||
import com.replaymod.pathing.properties.CameraProperties;
|
||||
import com.replaymod.pathing.properties.SpectatorProperty;
|
||||
import com.replaymod.pathing.properties.TimestampProperty;
|
||||
import com.replaymod.pathing.properties.LensProperties;
|
||||
import com.replaymod.render.gui.GuiRenderQueue;
|
||||
import com.replaymod.render.gui.GuiRenderSettings;
|
||||
import com.replaymod.replay.ReplayHandler;
|
||||
@@ -53,6 +54,7 @@ import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.util.crash.CrashReport;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
|
||||
//#if MC>=11400
|
||||
//#else
|
||||
@@ -703,8 +705,14 @@ public class GuiPathing {
|
||||
if (!replayHandler.isCameraView() && !neverSpectator) {
|
||||
spectatedId = replayHandler.getOverlay().getMinecraft().getCameraEntity().getEntityId();
|
||||
}
|
||||
|
||||
float focalDistance = timeline.getPositionPath()
|
||||
.getValue(LensProperties.FOCAL_DISTANCE, time).map(Triple::getLeft).orElse(5.0f);
|
||||
float apertureRadius = timeline.getPositionPath()
|
||||
.getValue(LensProperties.APERTURE_RADIUS, time).map(Triple::getLeft).orElse(0.05f);
|
||||
|
||||
timeline.addPositionKeyframe(time, camera.getX(), camera.getY(), camera.getZ(),
|
||||
camera.yaw, camera.pitch, camera.roll, spectatedId);
|
||||
camera.yaw, camera.pitch, camera.roll, spectatedId, focalDistance, apertureRadius);
|
||||
mod.setSelected(path, time);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user