From ff9e341c9aa4000f8bcf1b7b428ca18cd5ec6762 Mon Sep 17 00:00:00 2001 From: CrushedPixel Date: Fri, 3 Jul 2015 00:08:19 +0200 Subject: [PATCH] Added a way to customize the main Command | https://trello.com/c/PAFUGf6x/ --- .../replaymod/gui/GuiRenderSettings.java | 26 ++++++++++++++----- .../assets/replaymod/lang/en_US.lang | 5 ++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java b/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java index d521c829..5158e09a 100644 --- a/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java @@ -33,7 +33,7 @@ public class GuiRenderSettings extends GuiScreen { private GuiVideoFramerateSlider framerateSlider; private GuiNumberInput bitrateInput; private GuiColorPicker colorPicker; - private GuiAdvancedTextField ffmpegArguments; + private GuiAdvancedTextField commandInput, ffmpegArguments; private List permanentButtons = new ArrayList(); private List defaultButtons = new ArrayList(); @@ -144,6 +144,10 @@ public class GuiRenderSettings extends GuiScreen { colorPicker = new GuiColorPicker(GuiConstants.RENDER_SETTINGS_COLOR_PICKER, 0, 0, I18n.format("replaymod.gui.rendersettings.skycolor")+": ", 0, 0); colorPicker.enabled = enableGreenscreen.isChecked(); + commandInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20); + commandInput.hint = I18n.format("replaymod.gui.rendersettings.command"); + commandInput.setMaxStringLength(3200); + ffmpegArguments = new GuiAdvancedTextField(fontRendererObj, 0, 0, 50, 20); ffmpegArguments.hint = I18n.format("replaymod.gui.rendersettings.ffmpeghint"); ffmpegArguments.setMaxStringLength(3200); @@ -229,10 +233,12 @@ public class GuiRenderSettings extends GuiScreen { i++; } - ffmpegArguments.width = 305; - ffmpegArguments.xPosition = (this.width-ffmpegArguments.width)/2; - ffmpegArguments.yPosition = this.virtualY + 20 + ((i/2)*25); + commandInput.width = 55; + commandInput.xPosition = (this.width-305)/2; + commandInput.yPosition = ffmpegArguments.yPosition = this.virtualY + 20 + ((i/2)*25); + ffmpegArguments.width = 245; + ffmpegArguments.xPosition = commandInput.xPosition+commandInput.width+5; initialized = true; } @@ -269,12 +275,13 @@ public class GuiRenderSettings extends GuiScreen { rendererDropdown.drawTextBox(); } else { + commandInput.drawTextBox(); ffmpegArguments.drawTextBox(); String[] rows = StringUtils.splitStringInMultipleRows(I18n.format("replaymod.gui.rendersettings.ffmpeg.description"), 305); int i = 0; for(String row : rows) { - drawString(fontRendererObj, row, ffmpegArguments.xPosition, ffmpegArguments.yPosition + 30 + (15 * i), Color.WHITE.getRGB()); + drawString(fontRendererObj, row, commandInput.xPosition, commandInput.yPosition + 30 + (15 * i), Color.WHITE.getRGB()); i++; } } @@ -288,6 +295,7 @@ public class GuiRenderSettings extends GuiScreen { yRes.mouseClicked(mouseX, mouseY, mouseButton); bitrateInput.mouseClicked(mouseX, mouseY, mouseButton); } else { + commandInput.mouseClicked(mouseX, mouseY, mouseButton); ffmpegArguments.mouseClicked(mouseX, mouseY, mouseButton); } @@ -335,6 +343,7 @@ public class GuiRenderSettings extends GuiScreen { yRes.textboxKeyTyped(typedChar, keyCode); bitrateInput.textboxKeyTyped(typedChar, keyCode); } else { + commandInput.textboxKeyTyped(typedChar, keyCode); ffmpegArguments.textboxKeyTyped(typedChar, keyCode); } super.keyTyped(typedChar, keyCode); @@ -345,6 +354,7 @@ public class GuiRenderSettings extends GuiScreen { xRes.updateCursorCounter(); yRes.updateCursorCounter(); bitrateInput.updateCursorCounter(); + commandInput.updateCursorCounter(); ffmpegArguments.updateCursorCounter(); super.updateScreen(); } @@ -450,8 +460,12 @@ public class GuiRenderSettings extends GuiScreen { } options.setRenderer(renderer); + if(commandInput.getText().trim().length() > 0) { + options.setExportCommand(commandInput.getText().trim()); + } + if(ffmpegArguments.getText().trim().length() > 0) { - options.setExportCommandArgs(ffmpegArguments.getText()); + options.setExportCommandArgs(ffmpegArguments.getText().trim()); } ReplayHandler.startPath(options); diff --git a/src/main/resources/assets/replaymod/lang/en_US.lang b/src/main/resources/assets/replaymod/lang/en_US.lang index 510334fd..5a62bde0 100644 --- a/src/main/resources/assets/replaymod/lang/en_US.lang +++ b/src/main/resources/assets/replaymod/lang/en_US.lang @@ -295,8 +295,9 @@ replaymod.gui.rendersettings.quality=Video Quality replaymod.gui.rendersettings.chromakey=Chroma Keying replaymod.gui.rendersettings.skycolor=Sky Color -replaymod.gui.rendersettings.ffmpeghint=ffmpeg Command Line Arguments -replaymod.gui.rendersettings.ffmpeg.description=If you define custom Command Line Arguments for ffmpeg, they will replace the Replay Mod's Render Settings (File Destination, Codec, Bitrate, Framerate etc.) +replaymod.gui.rendersettings.command=Command +replaymod.gui.rendersettings.arguments=Command Line Arguments +replaymod.gui.rendersettings.ffmpeg.description=By default, the Replay Mod will render videos as .webm files. If you are an advanced user, you can customize the command line parameters used to export the video. For more information, check http://replaymod.com/docs replaymod.gui.rendersettings.stablecamera=Ignore Camera Rotation replaymod.gui.rendersettings.exportyoutube=Export for YouTube