Run video rendering from runLater
Prevents any issues arising from the fact that we would otherwise be somewhere deep in the GUI lib button handling call stack.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.replaymod.render.gui;
|
package com.replaymod.render.gui;
|
||||||
|
|
||||||
|
import com.replaymod.core.ReplayMod;
|
||||||
import com.replaymod.render.RenderSettings;
|
import com.replaymod.render.RenderSettings;
|
||||||
import com.replaymod.render.VideoWriter;
|
import com.replaymod.render.VideoWriter;
|
||||||
import de.johni0702.minecraft.gui.container.GuiPanel;
|
import de.johni0702.minecraft.gui.container.GuiPanel;
|
||||||
@@ -79,7 +80,7 @@ public class GuiExportFailed extends GuiScreen {
|
|||||||
.map(l -> new GuiLabel().setText(l))
|
.map(l -> new GuiLabel().setText(l))
|
||||||
.toArray(GuiElement[]::new));
|
.toArray(GuiElement[]::new));
|
||||||
|
|
||||||
resetButton.onClick(() -> {
|
resetButton.onClick(() -> ReplayMod.instance.runLater(() -> {
|
||||||
RenderSettings oldSettings = e.getSettings();
|
RenderSettings oldSettings = e.getSettings();
|
||||||
doRestart.accept(new RenderSettings(
|
doRestart.accept(new RenderSettings(
|
||||||
oldSettings.getRenderMethod(),
|
oldSettings.getRenderMethod(),
|
||||||
@@ -102,7 +103,7 @@ public class GuiExportFailed extends GuiScreen {
|
|||||||
oldSettings.getEncodingPreset().getValue(),
|
oldSettings.getEncodingPreset().getValue(),
|
||||||
oldSettings.isHighPerformance()
|
oldSettings.isHighPerformance()
|
||||||
));
|
));
|
||||||
});
|
}));
|
||||||
|
|
||||||
abortButton.onClick(() -> {
|
abortButton.onClick(() -> {
|
||||||
// Assume they know what they're doing
|
// Assume they know what they're doing
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.replaymod.render.gui;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import com.replaymod.core.ReplayMod;
|
||||||
import com.replaymod.core.utils.Utils;
|
import com.replaymod.core.utils.Utils;
|
||||||
import com.replaymod.render.ReplayModRender;
|
import com.replaymod.render.ReplayModRender;
|
||||||
import com.replaymod.render.VideoWriter;
|
import com.replaymod.render.VideoWriter;
|
||||||
@@ -196,7 +197,7 @@ public class GuiRenderQueue extends AbstractGuiPopup<GuiRenderQueue> {
|
|||||||
|
|
||||||
renderButton.onClick(() -> {
|
renderButton.onClick(() -> {
|
||||||
LOGGER.trace("Render button clicked");
|
LOGGER.trace("Render button clicked");
|
||||||
processQueue(queue);
|
ReplayMod.instance.runLater(() -> processQueue(queue));
|
||||||
});
|
});
|
||||||
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.InstanceCreator;
|
import com.google.gson.InstanceCreator;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
import com.replaymod.core.ReplayMod;
|
||||||
import com.replaymod.render.RenderSettings;
|
import com.replaymod.render.RenderSettings;
|
||||||
import com.replaymod.render.ReplayModRender;
|
import com.replaymod.render.ReplayModRender;
|
||||||
import com.replaymod.render.VideoWriter;
|
import com.replaymod.render.VideoWriter;
|
||||||
@@ -228,7 +229,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
new GuiRenderQueue(GuiRenderSettings.this, GuiRenderSettings.this, replayHandler, timeline).open();
|
new GuiRenderQueue(GuiRenderSettings.this, GuiRenderSettings.this, replayHandler, timeline).open();
|
||||||
}
|
}
|
||||||
}).setSize(100, 20).setI18nLabel("replaymod.gui.renderqueue.open");
|
}).setSize(100, 20).setI18nLabel("replaymod.gui.renderqueue.open");
|
||||||
public final GuiButton renderButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
public final GuiButton renderButton = new GuiButton(buttonPanel).onClick(() -> ReplayMod.instance.runLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// Closing this GUI ensures that settings are saved
|
// Closing this GUI ensures that settings are saved
|
||||||
@@ -261,7 +262,7 @@ public class GuiRenderSettings extends GuiScreen implements Closeable {
|
|||||||
display(); // Re-show the render settings gui and the new error popup
|
display(); // Re-show the render settings gui and the new error popup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).setSize(100, 20).setI18nLabel("replaymod.gui.render");
|
})).setSize(100, 20).setI18nLabel("replaymod.gui.render");
|
||||||
public final GuiButton cancelButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
public final GuiButton cancelButton = new GuiButton(buttonPanel).onClick(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
Reference in New Issue
Block a user