Adjustments for consistency

This commit is contained in:
CrushedPixel
2018-12-06 14:18:55 +01:00
parent a7ec6524b7
commit 7c3fcd4e42
4 changed files with 22 additions and 23 deletions

View File

@@ -147,7 +147,7 @@ public class YoutubeUploader {
CommandLine commandLine = new CommandLine(settings.getExportCommandOrDefault()); CommandLine commandLine = new CommandLine(settings.getExportCommandOrDefault());
commandLine.addArguments(args); commandLine.addArguments(args);
LOGGER.info("Re-encoding for metadata injection with {} {}", settings.getExportCommand(), args); LOGGER.info("Re-encoding for metadata injection with {} {}", commandLine.getExecutable(), args);
Process process = new ProcessBuilder(commandLine.toStrings()).directory(outputFile.getParentFile()).start(); Process process = new ProcessBuilder(commandLine.toStrings()).directory(outputFile.getParentFile()).start();
final AtomicBoolean active = new AtomicBoolean(true); final AtomicBoolean active = new AtomicBoolean(true);

View File

@@ -150,22 +150,22 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
.setI18nLabel("replaymod.gui.rendersettings.chromakey"); .setI18nLabel("replaymod.gui.rendersettings.chromakey");
public final GuiColorPicker chromaKeyingColor = new GuiColorPicker().setSize(30, 15); public final GuiColorPicker chromaKeyingColor = new GuiColorPicker().setSize(30, 15);
public final int minSphericalFov = 120; public static final int MIN_SPHERICAL_FOV = 120;
public final int maxSphericalFov = 360; public static final int MAX_SPHERICAL_FOV = 360;
public final int sphericalFovSteps = 5; public static final int SPHERICAL_FOV_STEP_SIZE = 5;
public final GuiSlider sphericalFovSlider = new GuiSlider() public final GuiSlider sphericalFovSlider = new GuiSlider()
.onValueChanged(new Runnable() { .onValueChanged(new Runnable() {
@Override @Override
public void run() { public void run() {
sphericalFovSlider.setText(I18n.format("replaymod.gui.rendersettings.sphericalFov") sphericalFovSlider.setText(I18n.format("replaymod.gui.rendersettings.sphericalFov")
+ ": " + (minSphericalFov + sphericalFovSlider.getValue() * sphericalFovSteps) + "°"); + ": " + (MIN_SPHERICAL_FOV + sphericalFovSlider.getValue() * SPHERICAL_FOV_STEP_SIZE) + "°");
updateInputs(); updateInputs();
} }
}).setSize(200, 20).setSteps((maxSphericalFov - minSphericalFov) / sphericalFovSteps); }).setSize(200, 20).setSteps((MAX_SPHERICAL_FOV - MIN_SPHERICAL_FOV) / SPHERICAL_FOV_STEP_SIZE);
public final GuiCheckbox inject360Metadata = new GuiCheckbox() public final GuiCheckbox injectSphericalMetadata = new GuiCheckbox()
.setI18nLabel("replaymod.gui.rendersettings.360metadata"); .setI18nLabel("replaymod.gui.rendersettings.sphericalmetadata");
public final GuiDropdownMenu<RenderSettings.AntiAliasing> antiAliasingDropdown = new GuiDropdownMenu<RenderSettings.AntiAliasing>() public final GuiDropdownMenu<RenderSettings.AntiAliasing> antiAliasingDropdown = new GuiDropdownMenu<RenderSettings.AntiAliasing>()
.setSize(200, 20).setValues(RenderSettings.AntiAliasing.values()).setSelected(RenderSettings.AntiAliasing.NONE); .setSize(200, 20).setValues(RenderSettings.AntiAliasing.values()).setSelected(RenderSettings.AntiAliasing.NONE);
@@ -176,7 +176,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
.addElements(new GridLayout.Data(0, 0.5), .addElements(new GridLayout.Data(0, 0.5),
new GuiLabel().setI18nText("replaymod.gui.rendersettings.stabilizecamera"), stabilizePanel, new GuiLabel().setI18nText("replaymod.gui.rendersettings.stabilizecamera"), stabilizePanel,
chromaKeyingCheckbox, chromaKeyingColor, chromaKeyingCheckbox, chromaKeyingColor,
inject360Metadata, sphericalFovSlider, injectSphericalMetadata, sphericalFovSlider,
new GuiLabel().setI18nText("replaymod.gui.rendersettings.antialiasing"), antiAliasingDropdown)); new GuiLabel().setI18nText("replaymod.gui.rendersettings.antialiasing"), antiAliasingDropdown));
public final GuiTextField exportCommand = new GuiTextField().setI18nHint("replaymod.gui.rendersettings.command") public final GuiTextField exportCommand = new GuiTextField().setI18nHint("replaymod.gui.rendersettings.command")
@@ -309,7 +309,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
videoWidth.setEnabled(!renderMethod.hasFixedAspectRatio()); videoWidth.setEnabled(!renderMethod.hasFixedAspectRatio());
// Validate video width and height // Validate video width and height
String error = isResolutionValid(); String error = updateResolution();
if (error == null) { if (error == null) {
renderButton.setEnabled().setTooltip(null); renderButton.setEnabled().setTooltip(null);
videoWidth.setTextColor(Colors.WHITE); videoWidth.setTextColor(Colors.WHITE);
@@ -346,14 +346,14 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
// Enable/Disable inject metadata checkbox // Enable/Disable inject metadata checkbox
if (encodingPresetDropdown.getSelectedValue().getFileExtension().equals("mp4") if (encodingPresetDropdown.getSelectedValue().getFileExtension().equals("mp4")
&& renderMethod.isSpherical()) { && renderMethod.isSpherical()) {
inject360Metadata.setEnabled().setTooltip(null); injectSphericalMetadata.setEnabled().setTooltip(null);
} else { } else {
inject360Metadata.setDisabled().setTooltip(new GuiTooltip().setColor(Colors.RED) injectSphericalMetadata.setDisabled().setTooltip(new GuiTooltip().setColor(Colors.RED)
.setI18nText("replaymod.gui.rendersettings.360metadata.error")); .setI18nText("replaymod.gui.rendersettings.sphericalmetadata.error"));
} }
} }
protected String isResolutionValid() { protected String updateResolution() {
RenderSettings.EncodingPreset preset = encodingPresetDropdown.getSelectedValue(); RenderSettings.EncodingPreset preset = encodingPresetDropdown.getSelectedValue();
RenderSettings.RenderMethod method = renderMethodDropdown.getSelectedValue(); RenderSettings.RenderMethod method = renderMethodDropdown.getSelectedValue();
@@ -366,10 +366,10 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
return "replaymod.gui.rendersettings.customresolution.warning.cubic.height"; return "replaymod.gui.rendersettings.customresolution.warning.cubic.height";
} }
int sphericalFov = minSphericalFov + sphericalFovSlider.getValue() * sphericalFovSteps; int sphericalFov = MIN_SPHERICAL_FOV + sphericalFovSlider.getValue() * SPHERICAL_FOV_STEP_SIZE;
videoWidth = videoWidthForHeight(method, videoHeight, sphericalFov, sphericalFov); videoWidth = videoWidthForHeight(method, videoHeight, sphericalFov, sphericalFov);
this.videoWidth.setValue(videoWidth); // TODO: isResolutionValid should not have side-effects this.videoWidth.setValue(videoWidth);
} else { } else {
videoWidth = this.videoWidth.getInteger(); videoWidth = this.videoWidth.getInteger();
} }
@@ -457,8 +457,8 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
chromaKeyingCheckbox.setChecked(true); chromaKeyingCheckbox.setChecked(true);
chromaKeyingColor.setColor(settings.getChromaKeyingColor()); chromaKeyingColor.setColor(settings.getChromaKeyingColor());
} }
sphericalFovSlider.setValue((settings.getSphericalFovX() - minSphericalFov) / sphericalFovSteps); sphericalFovSlider.setValue((settings.getSphericalFovX() - MIN_SPHERICAL_FOV) / SPHERICAL_FOV_STEP_SIZE);
inject360Metadata.setChecked(settings.isInjectSphericalMetadata()); injectSphericalMetadata.setChecked(settings.isInjectSphericalMetadata());
antiAliasingDropdown.setSelected(settings.getAntiAliasing()); antiAliasingDropdown.setSelected(settings.getAntiAliasing());
exportCommand.setText(settings.getExportCommand()); exportCommand.setText(settings.getExportCommand());
exportArguments.setText(settings.getExportArguments()); exportArguments.setText(settings.getExportArguments());
@@ -467,7 +467,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
} }
public RenderSettings save(boolean serialize) { public RenderSettings save(boolean serialize) {
int sphericalFov = minSphericalFov + sphericalFovSlider.getValue() * sphericalFovSteps; int sphericalFov = MIN_SPHERICAL_FOV + sphericalFovSlider.getValue() * SPHERICAL_FOV_STEP_SIZE;
return new RenderSettings( return new RenderSettings(
renderMethodDropdown.getSelectedValue(), renderMethodDropdown.getSelectedValue(),
@@ -482,8 +482,8 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
stabilizePitch.isChecked() && (serialize || stabilizePitch.isEnabled()), stabilizePitch.isChecked() && (serialize || stabilizePitch.isEnabled()),
stabilizeRoll.isChecked() && (serialize || stabilizeRoll.isEnabled()), stabilizeRoll.isChecked() && (serialize || stabilizeRoll.isEnabled()),
chromaKeyingCheckbox.isChecked() ? chromaKeyingColor.getColor() : null, chromaKeyingCheckbox.isChecked() ? chromaKeyingColor.getColor() : null,
sphericalFov, sphericalFov, sphericalFov, Math.min(180, sphericalFov),
inject360Metadata.isChecked() && (serialize || inject360Metadata.isEnabled()), injectSphericalMetadata.isChecked() && (serialize || injectSphericalMetadata.isEnabled()),
antiAliasingDropdown.getSelectedValue(), antiAliasingDropdown.getSelectedValue(),
exportCommand.getText(), exportCommand.getText(),
exportArguments.getText(), exportArguments.getText(),

View File

@@ -152,7 +152,6 @@ public class VideoRenderer implements RenderInfo {
renderingPipeline.run(); renderingPipeline.run();
if (mc.hasCrashed) { if (mc.hasCrashed) {
setFailure(mc.crashReporter.getCrashCause());
throw new ReportedException(mc.crashReporter); throw new ReportedException(mc.crashReporter);
} }