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

@@ -0,0 +1,37 @@
package com.replaymod.simplepathing.gui;
import com.replaymod.pathing.properties.LensProperties;
import com.replaymod.replaystudio.pathing.path.Keyframe;
import de.johni0702.minecraft.gui.container.AbstractGuiContainer;
import de.johni0702.minecraft.gui.element.GuiLabel;
import de.johni0702.minecraft.gui.element.GuiNumberField;
import de.johni0702.minecraft.gui.layout.GridLayout;
import org.apache.commons.lang3.tuple.Triple;
public class GuiLensKeyframePanel extends AbstractGuiContainer<GuiLensKeyframePanel> {
public final GuiNumberField focalDistanceField =
new GuiNumberField().setValidateOnFocusChange(true).setSize(60, 20).setPrecision(3).setMinValue(0);
public final GuiNumberField apertureRadiusField =
new GuiNumberField().setValidateOnFocusChange(true).setSize(60, 20).setPrecision(4).setMinValue(0);
public GuiLensKeyframePanel() {
setLayout(new GridLayout().setCellsEqualSize(false).setColumns(2).setSpacingX(3).setSpacingY(5));
addElements(new GridLayout.Data(1, 0.5),
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.focalDistance"), focalDistanceField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.apertureRadius"), apertureRadiusField);
}
public GuiLensKeyframePanel load(Keyframe keyframe) {
focalDistanceField.setValue(keyframe.getValue(LensProperties.FOCAL_DISTANCE)
.map(Triple::getLeft).orElse(LensProperties.DEFAULT_FOCAL_DISTANCE));
apertureRadiusField.setValue(keyframe.getValue(LensProperties.APERTURE_RADIUS)
.map(Triple::getLeft).orElse(LensProperties.DEFAULT_APERTURE_RADIUS));
return this;
}
public float getFocalDistance() { return focalDistanceField.getFloat(); }
public float getApertureRadius() { return apertureRadiusField.getFloat(); }
@Override
protected GuiLensKeyframePanel getThis() { return this; }
}