Do not rely on error handling popup for sodium info (fixes #392)
Instead we now disable all the Render buttons and give them a tooltip. Much more user-friendly.
This commit is contained in:
@@ -25,6 +25,7 @@ import de.johni0702.minecraft.gui.container.GuiVerticalList;
|
|||||||
import de.johni0702.minecraft.gui.element.GuiButton;
|
import de.johni0702.minecraft.gui.element.GuiButton;
|
||||||
import de.johni0702.minecraft.gui.element.GuiElement;
|
import de.johni0702.minecraft.gui.element.GuiElement;
|
||||||
import de.johni0702.minecraft.gui.element.GuiLabel;
|
import de.johni0702.minecraft.gui.element.GuiLabel;
|
||||||
|
import de.johni0702.minecraft.gui.element.GuiTooltip;
|
||||||
import de.johni0702.minecraft.gui.function.Typeable;
|
import de.johni0702.minecraft.gui.function.Typeable;
|
||||||
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||||
import de.johni0702.minecraft.gui.layout.GridLayout;
|
import de.johni0702.minecraft.gui.layout.GridLayout;
|
||||||
@@ -338,6 +339,11 @@ public class GuiRenderQueue extends AbstractGuiPopup<GuiRenderQueue> implements
|
|||||||
removeButton.setEnabled(selected >= 1);
|
removeButton.setEnabled(selected >= 1);
|
||||||
renderButton.setEnabled(selected > 0);
|
renderButton.setEnabled(selected > 0);
|
||||||
renderButton.setI18nLabel("replaymod.gui.renderqueue.render" + (selected > 0 ? "selected" : "all"));
|
renderButton.setI18nLabel("replaymod.gui.renderqueue.render" + (selected > 0 ? "selected" : "all"));
|
||||||
|
|
||||||
|
String[] compatError = VideoRenderer.checkCompat();
|
||||||
|
if (compatError != null) {
|
||||||
|
renderButton.setDisabled().setTooltip(new GuiTooltip().setText(compatError));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -367,19 +367,26 @@ public class GuiRenderSettings extends AbstractGuiPopup<GuiRenderSettings> {
|
|||||||
videoWidth.setEnabled(!renderMethod.hasFixedAspectRatio());
|
videoWidth.setEnabled(!renderMethod.hasFixedAspectRatio());
|
||||||
|
|
||||||
// Validate video width and height
|
// Validate video width and height
|
||||||
String error = updateResolution();
|
String resolutionError = updateResolution();
|
||||||
if (error == null) {
|
if (resolutionError == null) {
|
||||||
renderButton.setEnabled().setTooltip(null);
|
|
||||||
queueButton.setEnabled().setTooltip(null);
|
queueButton.setEnabled().setTooltip(null);
|
||||||
videoWidth.setTextColor(Colors.WHITE);
|
videoWidth.setTextColor(Colors.WHITE);
|
||||||
videoHeight.setTextColor(Colors.WHITE);
|
videoHeight.setTextColor(Colors.WHITE);
|
||||||
} else {
|
} else {
|
||||||
renderButton.setDisabled().setTooltip(new GuiTooltip().setI18nText(error));
|
queueButton.setDisabled().setTooltip(new GuiTooltip().setI18nText(resolutionError));
|
||||||
queueButton.setDisabled().setTooltip(new GuiTooltip().setI18nText(error));
|
|
||||||
videoWidth.setTextColor(Colors.RED);
|
videoWidth.setTextColor(Colors.RED);
|
||||||
videoHeight.setTextColor(Colors.RED);
|
videoHeight.setTextColor(Colors.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String[] compatError = VideoRenderer.checkCompat();
|
||||||
|
if (resolutionError != null) {
|
||||||
|
renderButton.setDisabled().setTooltip(new GuiTooltip().setI18nText(resolutionError));
|
||||||
|
} else if (compatError != null) {
|
||||||
|
renderButton.setDisabled().setTooltip(new GuiTooltip().setText(compatError));
|
||||||
|
} else {
|
||||||
|
renderButton.setEnabled().setTooltip(null);
|
||||||
|
}
|
||||||
|
|
||||||
// Enable/Disable bitrate input field and dropdown
|
// Enable/Disable bitrate input field and dropdown
|
||||||
if (encodingPresetDropdown.getSelectedValue().hasBitrateSetting()) {
|
if (encodingPresetDropdown.getSelectedValue().hasBitrateSetting()) {
|
||||||
bitRateField.setEnabled();
|
bitRateField.setEnabled();
|
||||||
|
|||||||
@@ -63,15 +63,6 @@ public class ChunkLoadingRenderGlobal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void install() {
|
private void install() {
|
||||||
//#if FABRIC>=1
|
|
||||||
if (net.fabricmc.loader.api.FabricLoader.getInstance().isModLoaded("sodium")) {
|
|
||||||
throw new UnsupportedOperationException(
|
|
||||||
"Rendering is not currently supported while Sodium is installed.\n" +
|
|
||||||
"See https://github.com/ReplayMod/ReplayMod/issues/150\n" +
|
|
||||||
"For now, you need to uninstall Sodium before rendering!"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
//#endif
|
|
||||||
try {
|
try {
|
||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
Field hookField = WorldRenderer.class.getField("replayModRender_hook");
|
Field hookField = WorldRenderer.class.getField("replayModRender_hook");
|
||||||
|
|||||||
@@ -727,4 +727,17 @@ public class VideoRenderer implements RenderInfo {
|
|||||||
return getVideoTime();
|
return getVideoTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String[] checkCompat() {
|
||||||
|
//#if FABRIC>=1
|
||||||
|
if (net.fabricmc.loader.api.FabricLoader.getInstance().isModLoaded("sodium")) {
|
||||||
|
return new String[] {
|
||||||
|
"Rendering is not currently supported while Sodium is installed.",
|
||||||
|
"See https://github.com/ReplayMod/ReplayMod/issues/150",
|
||||||
|
"For now, you need to uninstall Sodium before rendering!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//#endif
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.google.common.util.concurrent.FutureCallback;
|
|||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
import com.replaymod.render.gui.GuiRenderQueue;
|
import com.replaymod.render.gui.GuiRenderQueue;
|
||||||
|
import com.replaymod.render.rendering.VideoRenderer;
|
||||||
import com.replaymod.render.utils.RenderJob;
|
import com.replaymod.render.utils.RenderJob;
|
||||||
import com.replaymod.replaystudio.us.myles.ViaVersion.api.Pair;
|
import com.replaymod.replaystudio.us.myles.ViaVersion.api.Pair;
|
||||||
import de.johni0702.minecraft.gui.GuiRenderer;
|
import de.johni0702.minecraft.gui.GuiRenderer;
|
||||||
@@ -281,6 +282,11 @@ public class GuiReplayViewer extends GuiScreen {
|
|||||||
loadButton.setI18nLabel("replaymod.gui.viewer.bulkrender", jobs.size());
|
loadButton.setI18nLabel("replaymod.gui.viewer.bulkrender", jobs.size());
|
||||||
loadButton.setTooltip(new GuiTooltip().setText(tooltipLines));
|
loadButton.setTooltip(new GuiTooltip().setText(tooltipLines));
|
||||||
loadButton.setEnabled(!jobs.isEmpty());
|
loadButton.setEnabled(!jobs.isEmpty());
|
||||||
|
|
||||||
|
String[] compatError = VideoRenderer.checkCompat();
|
||||||
|
if (compatError != null) {
|
||||||
|
loadButton.setDisabled().setTooltip(new GuiTooltip().setText(compatError));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
loadButton.setI18nLabel("replaymod.gui.load");
|
loadButton.setI18nLabel("replaymod.gui.load");
|
||||||
loadButton.setTooltip(null);
|
loadButton.setTooltip(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user