mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-01 22:16:01 +00:00
Public Release
This commit is contained in:
1 parent
666398e480
commit
61bb497a22
126 files changed
+8435
-1240
No files matched your search
@@ -3,53 +3,72 @@ package com.moulberry.flashback.editor;
|
||||
import com.moulberry.flashback.keyframe.Keyframe;
|
||||
import com.moulberry.flashback.keyframe.KeyframeType;
|
||||
import com.moulberry.flashback.state.EditorState;
|
||||
import com.moulberry.flashback.state.EditorStateHistoryAction;
|
||||
import com.moulberry.flashback.state.EditorStateHistoryEntry;
|
||||
import com.moulberry.flashback.state.KeyframeTrack;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public record SavedTrack(KeyframeType type, int track, boolean copiedFromDisabled,
|
||||
TreeMap<Integer, Keyframe<?>> keyframes) {
|
||||
TreeMap<Integer, Keyframe> keyframes) {
|
||||
public int applyToEditorState(EditorState editorState, int cursorTicks, int totalTicks) {
|
||||
if (this.keyframes == null || this.keyframes.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
editorState.dirty = true;
|
||||
|
||||
// Try to apply directly to copied track
|
||||
if (this.track >= 0 && this.track < editorState.keyframeTracks.size()) {
|
||||
KeyframeTrack keyframeTrack = editorState.keyframeTracks.get(this.track);
|
||||
if ((keyframeTrack.enabled || this.copiedFromDisabled) && keyframeTrack.keyframeType == this.type) {
|
||||
return this.applyTo(keyframeTrack, cursorTicks, totalTicks);
|
||||
return this.applyTo(editorState, this.type, keyframeTrack, this.track, cursorTicks, totalTicks);
|
||||
}
|
||||
}
|
||||
|
||||
// Try to find first eligible enabled track
|
||||
for (KeyframeTrack keyframeTrack : editorState.keyframeTracks) {
|
||||
if (keyframeTrack.enabled && keyframeTrack.keyframeType == this.type) {
|
||||
return this.applyTo(keyframeTrack, cursorTicks, totalTicks);
|
||||
return this.applyTo(editorState, this.type, keyframeTrack, this.track, cursorTicks, totalTicks);
|
||||
}
|
||||
}
|
||||
|
||||
// Create new track
|
||||
KeyframeTrack keyframeTrack = new KeyframeTrack(this.type);
|
||||
int count = this.applyTo(keyframeTrack, cursorTicks, totalTicks);
|
||||
if (!keyframeTrack.keyframesByTick.isEmpty()) {
|
||||
editorState.keyframeTracks.add(keyframeTrack);
|
||||
}
|
||||
return count;
|
||||
return this.applyTo(editorState, this.type, null, this.track, cursorTicks, totalTicks);
|
||||
}
|
||||
|
||||
public int applyTo(KeyframeTrack keyframeTrack, int cursorTicks, int totalTicks) {
|
||||
private int applyTo(EditorState editorState, KeyframeType type, @Nullable KeyframeTrack existing, int trackIndex, int cursorTicks, int totalTicks) {
|
||||
List<EditorStateHistoryAction> undo = new ArrayList<>();
|
||||
List<EditorStateHistoryAction> redo = new ArrayList<>();
|
||||
|
||||
if (existing == null) {
|
||||
undo.add(new EditorStateHistoryAction.RemoveTrack(type, trackIndex));
|
||||
redo.add(new EditorStateHistoryAction.AddTrack(type, trackIndex));
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (Map.Entry<Integer, Keyframe<?>> entry : this.keyframes.entrySet()) {
|
||||
for (Map.Entry<Integer, Keyframe> entry : this.keyframes.entrySet()) {
|
||||
int newTick = entry.getKey() + cursorTicks;
|
||||
if (newTick >= 0 && newTick <= totalTicks) {
|
||||
keyframeTrack.keyframesByTick.put(newTick, entry.getValue());
|
||||
if (existing != null) {
|
||||
Keyframe old = existing.keyframesByTick.get(newTick);
|
||||
|
||||
if (old != null) {
|
||||
undo.add(new EditorStateHistoryAction.SetKeyframe(type, trackIndex, newTick, old.copy()));
|
||||
} else {
|
||||
undo.add(new EditorStateHistoryAction.RemoveKeyframe(type, trackIndex, newTick));
|
||||
}
|
||||
}
|
||||
redo.add(new EditorStateHistoryAction.SetKeyframe(type, trackIndex, newTick, entry.getValue().copy()));
|
||||
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
editorState.push(new EditorStateHistoryEntry(undo, redo, "Pasted " + count + " keyframe(s)"));
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,7 @@ public class CustomImGuiImplGlfw {
|
||||
if (keyInBoundsForGame) this.keyPressedGame[minecraftKey] = action != GLFW_RELEASE;
|
||||
|
||||
// Don't allow key presses during export
|
||||
if (Flashback.EXPORT_JOB != null && Flashback.EXPORT_JOB.isRunning()) {
|
||||
if (Flashback.isExporting()) {
|
||||
if (action == GLFW_RELEASE && keyInBoundsForGame && this.keyPressedGame[minecraftKey]) {
|
||||
this.keyPressedGame[minecraftKey] = false;
|
||||
} else {
|
||||
|
||||
@@ -42,87 +42,6 @@ public class ImGuiHelper {
|
||||
return imString;
|
||||
}
|
||||
|
||||
public static int elementList(String name, List<String> elements, float width, int minLines, int maxLines, boolean framed, IntConsumer buttonConsumer) {
|
||||
if (minLines > maxLines) throw new IllegalArgumentException();
|
||||
|
||||
if (width <= 0) {
|
||||
width = Math.max(ImGui.getContentRegionAvailX() + width, 4.0f);
|
||||
}
|
||||
|
||||
float itemSpacingX = ImGui.getStyle().getItemSpacingX();
|
||||
float framePaddingX = ImGui.getStyle().getFramePaddingX();
|
||||
float availableSpace = width;
|
||||
if (framed) availableSpace -= framePaddingX*2f;
|
||||
|
||||
int lines = 0;
|
||||
boolean scrollbar = false;
|
||||
if (minLines == maxLines) {
|
||||
lines = minLines;
|
||||
scrollbar = true; // assume there is a scrollbar
|
||||
} else {
|
||||
float consumedWidth = 0;
|
||||
for (String element : elements) {
|
||||
float elementWidth = framePaddingX*2f + ImGuiHelper.calcTextWidth(element);
|
||||
if (consumedWidth+elementWidth < availableSpace && consumedWidth > 0) {
|
||||
consumedWidth += elementWidth + itemSpacingX;
|
||||
} else {
|
||||
consumedWidth = elementWidth + itemSpacingX;
|
||||
lines += 1;
|
||||
if (lines > maxLines) {
|
||||
lines = maxLines;
|
||||
scrollbar = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lines < minLines) lines = minLines;
|
||||
}
|
||||
|
||||
float lineHeight = ImGui.getFontSize() + ImGui.getStyle().getFramePaddingY()*2 + ImGui.getStyle().getItemSpacingY();
|
||||
boolean visible;
|
||||
if (framed) {
|
||||
visible = ImGui.beginChildFrame(ImGui.getID(name), width, lineHeight*lines + ImGui.getStyle().getFramePaddingY()*2 - ImGui.getStyle().getItemSpacingY());
|
||||
} else {
|
||||
visible = ImGui.beginChild(name, width, lineHeight*lines - ImGui.getStyle().getItemSpacingY());
|
||||
}
|
||||
|
||||
int ret = -1;
|
||||
|
||||
if (visible) {
|
||||
if (scrollbar) {
|
||||
availableSpace -= ImGui.getStyle().getScrollbarSize();
|
||||
}
|
||||
|
||||
float consumedWidth = 0;
|
||||
for (int i=0; i<elements.size(); i++) {
|
||||
String element = elements.get(i);
|
||||
float elementWidth = framePaddingX*2f + ImGuiHelper.calcTextWidth(element);
|
||||
if (consumedWidth+elementWidth < availableSpace && consumedWidth > 0) {
|
||||
ImGui.sameLine();
|
||||
consumedWidth += elementWidth + itemSpacingX;
|
||||
} else {
|
||||
consumedWidth = elementWidth + itemSpacingX;
|
||||
}
|
||||
ImGui.pushID(i);
|
||||
if (ImGui.button(element)) {
|
||||
ret = i;
|
||||
}
|
||||
if (buttonConsumer != null) {
|
||||
buttonConsumer.accept(i);
|
||||
}
|
||||
ImGui.popID();
|
||||
}
|
||||
}
|
||||
|
||||
if (framed) {
|
||||
ImGui.endChildFrame();
|
||||
} else {
|
||||
ImGui.endChild();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static final int[] enumComboSharedArray = new int[]{0};
|
||||
private static final Map<Class<?>, Object[]> enumComboCachedValues = new HashMap<>();
|
||||
private static final Map<Class<?>, String[]> enumComboCachedText = new HashMap<>();
|
||||
@@ -207,28 +126,18 @@ public class ImGuiHelper {
|
||||
|
||||
private static boolean closeableModalOnTopLast = false;
|
||||
private static boolean closeableModalOnTop = false;
|
||||
private static boolean inputIntScrolledLastFrame = false;
|
||||
private static boolean inputIntScrolledThisFrame = false;
|
||||
|
||||
private static boolean wantSpecialInputLastFrame = false;
|
||||
private static boolean wantSpecialInputThisFrame = false;
|
||||
|
||||
private static StringBuilder specialInput = new StringBuilder();
|
||||
private static int backspaceCount = 0;
|
||||
|
||||
private static boolean handledFocusNext = false;
|
||||
private static boolean focusNext = false;
|
||||
|
||||
public static void endFrame() {
|
||||
closeableModalOnTopLast = closeableModalOnTop;
|
||||
inputIntScrolledLastFrame = inputIntScrolledThisFrame;
|
||||
inputIntScrolledThisFrame = false;
|
||||
|
||||
wantSpecialInputLastFrame = wantSpecialInputThisFrame;
|
||||
wantSpecialInputThisFrame = false;
|
||||
|
||||
handledFocusNext = false;
|
||||
focusNext = false;
|
||||
|
||||
if (!wantSpecialInputLastFrame) specialInput.setLength(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.TextureUtil;
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import com.moulberry.flashback.editor.ui.windows.ExportQueueWindow;
|
||||
import com.moulberry.flashback.state.EditorState;
|
||||
import com.moulberry.flashback.state.EditorStateManager;
|
||||
import com.moulberry.flashback.combo_options.Sizing;
|
||||
import com.moulberry.flashback.editor.ui.windows.MainMenuBar;
|
||||
import com.moulberry.flashback.editor.ui.windows.StartExportWindow;
|
||||
@@ -21,11 +23,9 @@ import net.minecraft.client.gui.screens.ProgressScreen;
|
||||
import net.minecraft.client.gui.screens.ReceivingLevelScreen;
|
||||
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.ProjectileUtil;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
@@ -54,10 +54,10 @@ public class ReplayUI {
|
||||
private static boolean initialized = false;
|
||||
|
||||
private static boolean isFrameHovered = false;
|
||||
private static int frameX = 0;
|
||||
private static int frameY = 0;
|
||||
private static int frameWidth = 1;
|
||||
private static int frameHeight = 1;
|
||||
public static int frameX = 0;
|
||||
public static int frameY = 0;
|
||||
public static int frameWidth = 1;
|
||||
public static int frameHeight = 1;
|
||||
private static boolean activeLastFrame = false;
|
||||
|
||||
public static Matrix4f lastProjectionMatrix = null;
|
||||
@@ -84,7 +84,7 @@ public class ReplayUI {
|
||||
private static boolean popupOpenLastFrame = false;
|
||||
|
||||
private static String infoOverlayText = null;
|
||||
private static long infoOverlayStartMillis = 0;
|
||||
private static long infoOverlayEndMillis = 0;
|
||||
|
||||
private static int selectedEntity = Integer.MIN_VALUE;
|
||||
private static boolean openSelectedEntityPopup = false;
|
||||
@@ -105,6 +105,14 @@ public class ReplayUI {
|
||||
try {
|
||||
Files.writeString(path, ReplayUIDefaults.LAYOUT);
|
||||
} catch(IOException ignored) {}
|
||||
} else {
|
||||
try {
|
||||
String imguiIni = Files.readString(path);
|
||||
if (imguiIni.contains("[Window][Timeline]")) {
|
||||
imguiIni = imguiIni.replace("[Window][Timeline]", "[Window][###Timeline]");
|
||||
Files.writeString(path, imguiIni);
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
|
||||
long oldImGuiContext = ImGui.getCurrentContext().ptr;
|
||||
@@ -305,7 +313,12 @@ public class ReplayUI {
|
||||
|
||||
public static void setInfoOverlay(String text) {
|
||||
infoOverlayText = text;
|
||||
infoOverlayStartMillis = System.currentTimeMillis();
|
||||
infoOverlayEndMillis = System.currentTimeMillis() + 5000;
|
||||
}
|
||||
|
||||
public synchronized static void setInfoOverlayShort(String text) {
|
||||
infoOverlayText = text;
|
||||
infoOverlayEndMillis = System.currentTimeMillis() + 1000;
|
||||
}
|
||||
|
||||
public static void setupMainViewport() {
|
||||
@@ -382,6 +395,11 @@ public class ReplayUI {
|
||||
return activeLastFrame;
|
||||
}
|
||||
|
||||
public static boolean shouldModifyViewport() {
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
return isActive() && editorState != null && editorState.replayVisuals.sizing != Sizing.UNDERLAY;
|
||||
}
|
||||
|
||||
private static void transitionActiveState(boolean active) {
|
||||
if (activeLastFrame == active) return;
|
||||
activeLastFrame = active;
|
||||
@@ -538,12 +556,15 @@ public class ReplayUI {
|
||||
frameWidth = (int) Math.max(1, maxX - minX);
|
||||
frameHeight = (int) Math.max(1, maxY - minY);
|
||||
|
||||
if (ReplayVisuals.sizing == Sizing.KEEP_ASPECT_RATIO || ReplayVisuals.sizing == Sizing.CHANGE_ASPECT_RATIO) {
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
Sizing sizing = editorState == null ? Sizing.KEEP_ASPECT_RATIO : editorState.replayVisuals.sizing;
|
||||
|
||||
if (sizing == Sizing.KEEP_ASPECT_RATIO || sizing == Sizing.CHANGE_ASPECT_RATIO) {
|
||||
float aspectRatio;
|
||||
if (ReplayVisuals.sizing == Sizing.KEEP_ASPECT_RATIO) {
|
||||
if (sizing == Sizing.KEEP_ASPECT_RATIO) {
|
||||
aspectRatio = ImGui.getMainViewport().getSizeX() / ImGui.getMainViewport().getSizeY();
|
||||
} else {
|
||||
aspectRatio = ReplayVisuals.changeAspectRatio.aspectRatio();
|
||||
aspectRatio = editorState.replayVisuals.changeAspectRatio.aspectRatio();
|
||||
}
|
||||
|
||||
float currentAspectRatio = frameWidth / (float) frameHeight;
|
||||
@@ -561,8 +582,9 @@ public class ReplayUI {
|
||||
|
||||
if (infoOverlayText != null) {
|
||||
long currentMillis = System.currentTimeMillis();
|
||||
if (currentMillis < infoOverlayStartMillis || currentMillis > infoOverlayStartMillis + 5000) {
|
||||
if (currentMillis < infoOverlayEndMillis - 30000 || currentMillis > infoOverlayEndMillis) {
|
||||
infoOverlayText = null;
|
||||
infoOverlayEndMillis = 0;
|
||||
} else {
|
||||
ImGui.setNextWindowPos(frameX + frameWidth*0.5f, frameY + frameHeight*0.75f, ImGuiCond.Always, 0.5f, 0.5f);
|
||||
ImGui.setNextWindowSizeConstraints(0, 0, 550, frameHeight*0.45f);
|
||||
@@ -583,7 +605,7 @@ public class ReplayUI {
|
||||
}
|
||||
}
|
||||
|
||||
if (ReplayVisuals.sizing == Sizing.UNDERLAY) {
|
||||
if (sizing == Sizing.UNDERLAY) {
|
||||
frameX = 0;
|
||||
frameY = 0;
|
||||
frameWidth = Minecraft.getInstance().getWindow().getScreenWidth();
|
||||
@@ -594,27 +616,33 @@ public class ReplayUI {
|
||||
Minecraft.getInstance().resizeDisplay();
|
||||
}
|
||||
|
||||
if (ReplayVisuals.ruleOfThirdsGuide) {
|
||||
ImDrawList drawList = ImGui.getForegroundDrawList();
|
||||
drawList.addLine(frameX + frameWidth/3, frameY, frameX + frameWidth/3, frameY+frameHeight, -1, 2);
|
||||
drawList.addLine(frameX + frameWidth*2/3, frameY, frameX + frameWidth*2/3, frameY+frameHeight, -1, 2);
|
||||
drawList.addLine(frameX, frameY + frameHeight/3, frameX + frameWidth, frameY + frameHeight/3, -1, 2);
|
||||
drawList.addLine(frameX, frameY + frameHeight*2/3, frameX + frameWidth, frameY + frameHeight*2/3, -1, 2);
|
||||
}
|
||||
if (Minecraft.getInstance().screen == null && Minecraft.getInstance().getOverlay() == null) {
|
||||
if (editorState != null && editorState.replayVisuals.ruleOfThirdsGuide) {
|
||||
ImDrawList drawList = ImGui.getBackgroundDrawList();
|
||||
drawList.removeImDrawListFlags(ImDrawListFlags.AntiAliasedLines);
|
||||
drawList.addLine(frameX + frameWidth/3, frameY, frameX + frameWidth/3, frameY+frameHeight, 0xAAFFFFFF, 2);
|
||||
drawList.addLine(frameX + frameWidth*2/3, frameY, frameX + frameWidth*2/3, frameY+frameHeight, 0xAAFFFFFF, 2);
|
||||
drawList.addLine(frameX, frameY + frameHeight/3, frameX + frameWidth, frameY + frameHeight/3, 0xAAFFFFFF, 2);
|
||||
drawList.addLine(frameX, frameY + frameHeight*2/3, frameX + frameWidth, frameY + frameHeight*2/3, 0xAAFFFFFF, 2);
|
||||
drawList.addImDrawListFlags(ImDrawListFlags.AntiAliasedLines);
|
||||
}
|
||||
|
||||
if (ReplayVisuals.centerGuide) {
|
||||
ImDrawList drawList = ImGui.getForegroundDrawList();
|
||||
drawList.addLine(frameX + frameWidth/2, frameY, frameX + frameWidth/2, frameY+frameHeight, -1, 2);
|
||||
drawList.addLine(frameX, frameY + frameHeight/2, frameX + frameWidth, frameY + frameHeight/2, -1, 2);
|
||||
if (editorState != null && editorState.replayVisuals.centerGuide) {
|
||||
ImDrawList drawList = ImGui.getBackgroundDrawList();
|
||||
drawList.removeImDrawListFlags(ImDrawListFlags.AntiAliasedLines);
|
||||
drawList.addLine(frameX + frameWidth/2, frameY, frameX + frameWidth/2, frameY+frameHeight, 0xAAFFFFFF, 2);
|
||||
drawList.addLine(frameX, frameY + frameHeight/2, frameX + frameWidth, frameY + frameHeight/2, 0xAAFFFFFF, 2);
|
||||
drawList.addImDrawListFlags(ImDrawListFlags.AntiAliasedLines);
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedEntity != Integer.MIN_VALUE) {
|
||||
Entity entity = Minecraft.getInstance().level.getEntity(selectedEntity);
|
||||
if (entity == null) {
|
||||
selectedEntity = Integer.MIN_VALUE;
|
||||
} else if (entity instanceof Player && !ReplayVisuals.renderPlayers) {
|
||||
} else if (entity instanceof Player && editorState != null && !editorState.replayVisuals.renderPlayers) {
|
||||
selectedEntity = Integer.MIN_VALUE;
|
||||
} else if (!(entity instanceof Player) && !ReplayVisuals.renderEntities) {
|
||||
} else if (!(entity instanceof Player) && editorState != null && !editorState.replayVisuals.renderEntities) {
|
||||
selectedEntity = Integer.MIN_VALUE;
|
||||
} else {
|
||||
if (openSelectedEntityPopup) {
|
||||
@@ -629,10 +657,10 @@ public class ReplayUI {
|
||||
if (ImGui.button("Look At")) {
|
||||
Minecraft.getInstance().cameraEntity.lookAt(EntityAnchorArgument.Anchor.EYES, entity.getEyePosition());
|
||||
}
|
||||
// todo: need to remember spectate target when a snapshot is played
|
||||
// if (ImGui.button("Spectate")) {
|
||||
// Minecraft.getInstance().player.connection.sendUnsignedCommand("spectate " + entity.getUUID());
|
||||
// }
|
||||
if (ImGui.button("Spectate")) {
|
||||
Minecraft.getInstance().player.connection.sendUnsignedCommand("spectate " + entity.getUUID());
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
// ImGui.sameLine();
|
||||
// ImGui.button("Track Entity");
|
||||
//
|
||||
@@ -676,7 +704,7 @@ public class ReplayUI {
|
||||
if (wheelY != 0) {
|
||||
final float defaultFlyingSpeed = 0.05f;
|
||||
float flyingSpeed = Mth.clamp(player.getAbilities().getFlyingSpeed() + (float)wheelY * defaultFlyingSpeed / 10f,
|
||||
defaultFlyingSpeed / 10f, defaultFlyingSpeed * 5.0f);
|
||||
defaultFlyingSpeed / 10f, defaultFlyingSpeed * 10.0f);
|
||||
setInfoOverlay(String.format("Flying Speed: %.1f", flyingSpeed / defaultFlyingSpeed));
|
||||
player.getAbilities().setFlyingSpeed(flyingSpeed);
|
||||
}
|
||||
@@ -693,6 +721,7 @@ public class ReplayUI {
|
||||
VisualsWindow.render();
|
||||
TimelineWindow.render();
|
||||
StartExportWindow.render();
|
||||
ExportQueueWindow.render();
|
||||
|
||||
popupOpenLastFrame = ImGui.isPopupOpen("", ImGuiPopupFlags.AnyPopup);
|
||||
|
||||
@@ -824,7 +853,9 @@ public class ReplayUI {
|
||||
BlockHitResult blockResult = null;
|
||||
EntityHitResult entityResult = null;
|
||||
|
||||
if (ReplayVisuals.renderBlocks) {
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
|
||||
if (editorState == null || editorState.replayVisuals.renderBlocks) {
|
||||
ClipContext clipContext = new ClipContext(from, to, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, CollisionContext.empty());
|
||||
blockResult = Minecraft.getInstance().level.clip(clipContext);
|
||||
|
||||
@@ -833,16 +864,16 @@ public class ReplayUI {
|
||||
}
|
||||
}
|
||||
|
||||
if (ReplayVisuals.renderEntities || ReplayVisuals.renderPlayers) {
|
||||
if (editorState == null || editorState.replayVisuals.renderEntities || editorState.replayVisuals.renderPlayers) {
|
||||
AABB boundingBox = new AABB(from.subtract(0.5f, 0.5f, 0.5f), from.add(0.5f, 0.5f, 0.5f));
|
||||
boundingBox = boundingBox.expandTowards(look.scale(distance));
|
||||
|
||||
Predicate<Entity> predicate;
|
||||
if (ReplayVisuals.renderEntities && ReplayVisuals.renderPlayers) {
|
||||
if (editorState.replayVisuals.renderEntities && editorState.replayVisuals.renderPlayers) {
|
||||
predicate = entity -> true;
|
||||
} else if (ReplayVisuals.renderPlayers) {
|
||||
} else if (editorState.replayVisuals.renderPlayers) {
|
||||
predicate = entity -> entity instanceof Player;
|
||||
} else if (ReplayVisuals.renderEntities) {
|
||||
} else if (editorState.replayVisuals.renderEntities) {
|
||||
predicate = entity -> !(entity instanceof Player);
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
|
||||
@@ -10,18 +10,18 @@ import org.lwjgl.glfw.GLFW;
|
||||
public class ReplayUIDefaults {
|
||||
|
||||
public static final String LAYOUT = """
|
||||
[Window][Timeline]
|
||||
[Window][###Timeline]
|
||||
Pos=0,830
|
||||
Size=1920,250
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
|
||||
[Window][Visuals]
|
||||
Pos=1670,0
|
||||
Size=250,830
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,22 Size=1920,1080 Split=Y Selected=0x1F1A625A
|
||||
DockNode ID=0x00000001 Parent=0x8B93E3BD SizeRef=1920,830 Split=X Selected=0x1F1A625A
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.moulberry.flashback.editor.ui.windows;
|
||||
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.editor.ui.ImGuiHelper;
|
||||
import com.moulberry.flashback.exporting.ExportJob;
|
||||
import com.moulberry.flashback.exporting.ExportJobQueue;
|
||||
import com.moulberry.flashback.exporting.ExportSettings;
|
||||
import imgui.ImGui;
|
||||
import imgui.flag.ImGuiCol;
|
||||
import imgui.flag.ImGuiTableColumnFlags;
|
||||
import imgui.flag.ImGuiTableFlags;
|
||||
import imgui.flag.ImGuiWindowFlags;
|
||||
|
||||
public class ExportQueueWindow {
|
||||
|
||||
private static boolean open = false;
|
||||
|
||||
public static void open() {
|
||||
open = true;
|
||||
}
|
||||
|
||||
public static void render() {
|
||||
if (open) {
|
||||
ImGui.openPopup("###ExportQueue");
|
||||
open = false;
|
||||
}
|
||||
|
||||
if (ImGuiHelper.beginPopupModalCloseable("Export Queue###ExportQueue", ImGuiWindowFlags.AlwaysAutoResize)) {
|
||||
ImGuiHelper.pushStyleColor(ImGuiCol.Border, 0xFF808080);
|
||||
|
||||
boolean canStartJob = !ExportJobQueue.queuedJobs.isEmpty() && Flashback.EXPORT_JOB == null;
|
||||
boolean canRemoveJob = !ExportJobQueue.queuedJobs.isEmpty();
|
||||
|
||||
ImGui.text("Jobs");
|
||||
if (ImGui.beginChild("##Jobs", 300, 150, true)) {
|
||||
if (ImGui.beginTable("##JobTable", 3, ImGuiTableFlags.SizingFixedFit)) {
|
||||
ImGui.tableSetupColumn("Name", ImGuiTableColumnFlags.WidthStretch);
|
||||
|
||||
int startJob = -1;
|
||||
int removeJob = -1;
|
||||
|
||||
for (int i = 0; i < ExportJobQueue.queuedJobs.size(); i++) {
|
||||
ExportSettings queuedJob = ExportJobQueue.queuedJobs.get(i);
|
||||
String name = queuedJob.name() == null ? "Job #" + (i+1) : queuedJob.name();
|
||||
|
||||
ImGui.tableNextColumn();
|
||||
ImGui.text(name);
|
||||
ImGui.tableNextColumn();
|
||||
if (ImGui.smallButton("Start")) {
|
||||
startJob = i;
|
||||
}
|
||||
ImGui.tableNextColumn();
|
||||
if (ImGui.smallButton("Remove")) {
|
||||
removeJob = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (startJob >= 0 && canStartJob) {
|
||||
ExportSettings settings = ExportJobQueue.queuedJobs.remove(startJob);
|
||||
Flashback.EXPORT_JOB = new ExportJob(settings);
|
||||
} else if (removeJob >= 0 && canRemoveJob) {
|
||||
ExportJobQueue.queuedJobs.remove(removeJob);
|
||||
}
|
||||
|
||||
ImGui.endTable();
|
||||
}
|
||||
ImGui.endChild();
|
||||
}
|
||||
|
||||
ImGuiHelper.popStyleColor();
|
||||
|
||||
|
||||
if (!canStartJob) ImGui.beginDisabled();
|
||||
if (ImGui.button("Start All") && canStartJob) {
|
||||
ExportJobQueue.drainingQueue = true;
|
||||
}
|
||||
if (!canStartJob) ImGui.endDisabled();
|
||||
|
||||
ImGui.sameLine();
|
||||
|
||||
if (!canRemoveJob) ImGui.beginDisabled();
|
||||
if (ImGui.button("Remove All") && canRemoveJob) {
|
||||
ExportJobQueue.queuedJobs.clear();
|
||||
}
|
||||
if (!canRemoveJob) ImGui.endDisabled();
|
||||
|
||||
ImGuiHelper.endPopupModalCloseable();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.moulberry.flashback.editor.ui.windows;
|
||||
|
||||
import com.moulberry.flashback.exporting.ExportJobQueue;
|
||||
import imgui.ImGui;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class MainMenuBar {
|
||||
|
||||
@@ -10,6 +12,17 @@ public class MainMenuBar {
|
||||
StartExportWindow.open();
|
||||
}
|
||||
|
||||
if (!ExportJobQueue.queuedJobs.isEmpty()) {
|
||||
String name = "Export Queue (" + ExportJobQueue.count() + ")";
|
||||
if (ImGui.menuItem(name + "###QueuedJobs")) {
|
||||
ExportQueueWindow.open();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.menuItem("Hide (F1)")) {
|
||||
Minecraft.getInstance().options.hideGui = true;
|
||||
}
|
||||
|
||||
ImGui.endMainMenuBar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,42 +2,56 @@ package com.moulberry.flashback.editor.ui.windows;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.combo_options.AudioCodec;
|
||||
import com.moulberry.flashback.combo_options.VideoCodec;
|
||||
import com.moulberry.flashback.combo_options.VideoContainer;
|
||||
import com.moulberry.flashback.combo_options.VideoPreset;
|
||||
import com.moulberry.flashback.compat.IrisApiWrapper;
|
||||
import com.moulberry.flashback.exporting.ExportJobQueue;
|
||||
import com.moulberry.flashback.state.EditorState;
|
||||
import com.moulberry.flashback.state.EditorStateCache;
|
||||
import com.moulberry.flashback.state.EditorStateManager;
|
||||
import com.moulberry.flashback.editor.ui.ImGuiHelper;
|
||||
import com.moulberry.flashback.exporting.AsyncFileDialogs;
|
||||
import com.moulberry.flashback.exporting.ExportJob;
|
||||
import com.moulberry.flashback.exporting.ExportSettings;
|
||||
import com.moulberry.flashback.playback.ReplayServer;
|
||||
import imgui.ImGui;
|
||||
import imgui.flag.ImGuiPopupFlags;
|
||||
import imgui.flag.ImGuiWindowFlags;
|
||||
import imgui.type.ImFloat;
|
||||
import imgui.type.ImString;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.minecraft.FileUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class StartExportWindow {
|
||||
|
||||
private static boolean open = false;
|
||||
private static boolean close = false;
|
||||
|
||||
private static final int[] lastFramebufferSize = new int[]{0, 0};
|
||||
|
||||
private static final int[] resolution = new int[]{1920, 1080};
|
||||
private static final int[] startEndTick = new int[]{0, 100};
|
||||
private static final ImFloat framerate = new ImFloat(60);
|
||||
private static boolean resetRng = false;
|
||||
|
||||
private static VideoContainer container = VideoContainer.MP4;
|
||||
private static VideoCodec codec = VideoCodec.H264;
|
||||
private static VideoPreset preset = VideoPreset.MEDIUM;
|
||||
private static int[] selectedEncoder = new int[]{0};
|
||||
private static VideoCodec videoCodec = VideoCodec.H264;
|
||||
private static int[] selectedVideoEncoder = new int[]{0};
|
||||
private static boolean useMaximumBitrate = false;
|
||||
private static final ImString bitrate = ImGuiHelper.createResizableImString("20m");
|
||||
|
||||
private static boolean recordAudio = false;
|
||||
private static AudioCodec audioCodec = AudioCodec.AAC;
|
||||
|
||||
private static final ImString jobName = ImGuiHelper.createResizableImString("");
|
||||
|
||||
static {
|
||||
bitrate.inputData.allowedChars = "0123456789kmb";
|
||||
}
|
||||
@@ -60,11 +74,23 @@ public class StartExportWindow {
|
||||
}
|
||||
|
||||
if (ImGuiHelper.beginPopupModalCloseable("Export to video###StartExport", ImGuiWindowFlags.AlwaysAutoResize)) {
|
||||
if (close) {
|
||||
close = false;
|
||||
ImGui.closeCurrentPopup();
|
||||
ImGuiHelper.endPopupModalCloseable();
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiHelper.separatorWithText("Capture Options");
|
||||
|
||||
ImGui.inputInt2("Resolution", resolution);
|
||||
if (resolution[0] < 16) resolution[0] = 16;
|
||||
if (resolution[1] < 16) resolution[1] = 16;
|
||||
if (resolution[0] % 2 != 0) resolution[0] += 1;
|
||||
if (resolution[1] % 2 != 0) resolution[1] += 1;
|
||||
|
||||
if (ImGui.inputInt2("Start/end tick", startEndTick)) {
|
||||
EditorState editorState = EditorStateCache.getCurrent();
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
ReplayServer replayServer = Flashback.getReplayServer();
|
||||
if (editorState != null && replayServer != null) {
|
||||
editorState.setExportTicks(startEndTick[0], startEndTick[1], replayServer.getTotalReplayTicks());
|
||||
@@ -72,6 +98,11 @@ public class StartExportWindow {
|
||||
}
|
||||
ImGui.inputFloat("Framerate", framerate);
|
||||
|
||||
if (ImGui.checkbox("Reset RNG", resetRng)) {
|
||||
resetRng = !resetRng;
|
||||
}
|
||||
ImGuiHelper.tooltip("Attempts to remove randomness from the replay in order to produce more consistent outputs when recording the same scene multiple times");
|
||||
|
||||
ImGuiHelper.separatorWithText("Video Options");
|
||||
|
||||
VideoContainer newContainer = ImGuiHelper.enumCombo("Container", container);
|
||||
@@ -79,43 +110,29 @@ public class StartExportWindow {
|
||||
container = newContainer;
|
||||
|
||||
boolean supported = false;
|
||||
for (VideoCodec supportedCodec : container.getSupportedCodecs()) {
|
||||
if (codec == supportedCodec) {
|
||||
for (VideoCodec supportedCodec : container.getSupportedVideoCodecs()) {
|
||||
if (videoCodec == supportedCodec) {
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!supported) {
|
||||
codec = container.getSupportedCodecs()[0];
|
||||
videoCodec = container.getSupportedVideoCodecs()[0];
|
||||
}
|
||||
}
|
||||
|
||||
VideoCodec newCodec = ImGuiHelper.enumCombo("Codec", codec, container.getSupportedCodecs());
|
||||
if (newCodec != codec) {
|
||||
codec = newCodec;
|
||||
selectedEncoder[0] = 0;
|
||||
VideoCodec newCodec = ImGuiHelper.enumCombo("Codec", videoCodec, container.getSupportedVideoCodecs());
|
||||
if (newCodec != videoCodec) {
|
||||
videoCodec = newCodec;
|
||||
selectedVideoEncoder[0] = 0;
|
||||
}
|
||||
|
||||
String[] encoders = codec.getEncoders();
|
||||
String[] encoders = videoCodec.getEncoders();
|
||||
if (encoders.length > 1) {
|
||||
ImGuiHelper.combo("Encoder", selectedEncoder, encoders);
|
||||
ImGuiHelper.combo("Encoder", selectedVideoEncoder, encoders);
|
||||
}
|
||||
|
||||
// VideoPreset newPreset = ImGuiHelper.enumCombo("Preset", preset);
|
||||
// if (newPreset != preset) {
|
||||
// preset = newPreset;
|
||||
//
|
||||
// useMaximumBitrate = false;
|
||||
// if (preset.ordinal() <= VideoPreset.SUPERFAST.ordinal()) {
|
||||
// bitrate.set("5m");
|
||||
// } else if (preset.ordinal() <= VideoPreset.MEDIUM.ordinal()) {
|
||||
// bitrate.set("10m");
|
||||
// } else {
|
||||
// bitrate.set("20m");
|
||||
// }
|
||||
// }
|
||||
|
||||
if (ImGui.checkbox("Use Maximum Bitrate", useMaximumBitrate)) {
|
||||
useMaximumBitrate = !useMaximumBitrate;
|
||||
}
|
||||
@@ -127,43 +144,121 @@ public class StartExportWindow {
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.button("Begin")) {
|
||||
int numBitrate;
|
||||
if (useMaximumBitrate) {
|
||||
numBitrate = 0;
|
||||
} else {
|
||||
numBitrate = stringToBitrate(ImGuiHelper.getString(bitrate));
|
||||
AudioCodec[] supportedAudioCodecs = container.getSupportedAudioCodecs();
|
||||
if (supportedAudioCodecs.length > 0) {
|
||||
ImGuiHelper.separatorWithText("Audio Options");
|
||||
|
||||
if (ImGui.checkbox("Record Audio", recordAudio)) {
|
||||
recordAudio = !recordAudio;
|
||||
}
|
||||
|
||||
String encoder = codec.getEncoders()[selectedEncoder[0]];
|
||||
if (recordAudio) {
|
||||
AudioCodec newAudioCodec = ImGuiHelper.enumCombo("Audio Codec", audioCodec, supportedAudioCodecs);
|
||||
if (newAudioCodec != audioCodec) {
|
||||
audioCodec = newAudioCodec;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
recordAudio = false;
|
||||
}
|
||||
|
||||
Path defaultExportPath = FabricLoader.getInstance().getGameDir();
|
||||
String defaultExportPathString = defaultExportPath.toString();
|
||||
AsyncFileDialogs.saveFileDialog(defaultExportPathString, "output." + container.extension(),
|
||||
container.extension(), container.extension()).thenAccept(pathStr -> {
|
||||
if (pathStr != null) {
|
||||
int start = Math.max(0, startEndTick[0]);
|
||||
int end = Math.max(start, startEndTick[1]);
|
||||
ImGui.dummy(0, 10);
|
||||
|
||||
ReplayServer replayServer = Flashback.getReplayServer();
|
||||
if (replayServer != null) {
|
||||
int totalTicks = replayServer.getTotalReplayTicks();
|
||||
start = Math.min(start, totalTicks);
|
||||
end = Math.min(end, totalTicks);
|
||||
}
|
||||
|
||||
Path path = Path.of(pathStr);
|
||||
ExportSettings settings = new ExportSettings(resolution[0], resolution[1], start, end,
|
||||
Math.max(1, framerate.get()), container, codec, encoder, numBitrate, path);
|
||||
float buttonSize = (ImGui.getContentRegionAvailX() - ImGui.getStyle().getItemSpacingX()) / 2f;
|
||||
if (ImGui.button("Start Export", buttonSize, 25)) {
|
||||
createExportSettings(null).thenAccept(settings -> {
|
||||
if (settings != null) {
|
||||
close = true;
|
||||
Flashback.EXPORT_JOB = new ExportJob(settings);
|
||||
}
|
||||
});
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("Add to Queue", buttonSize, 25)) {
|
||||
jobName.set("Job #" + (ExportJobQueue.count()+1));
|
||||
ImGui.openPopup("QueuedJobName");
|
||||
}
|
||||
|
||||
ImGui.closeCurrentPopup();
|
||||
if (ImGui.beginPopup("QueuedJobName")) {
|
||||
ImGui.setNextItemWidth(100);
|
||||
ImGui.inputText("Job Name", jobName);
|
||||
|
||||
if (ImGui.button("Queue Job")) {
|
||||
createExportSettings(ImGuiHelper.getString(jobName)).thenAccept(settings -> {
|
||||
if (settings != null) {
|
||||
close = true;
|
||||
ExportJobQueue.queuedJobs.add(settings);
|
||||
}
|
||||
});
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("Back")) {
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
ImGui.endPopup();
|
||||
}
|
||||
|
||||
ImGuiHelper.endPopupModalCloseable();
|
||||
}
|
||||
|
||||
close = false;
|
||||
}
|
||||
|
||||
private static CompletableFuture<ExportSettings> createExportSettings(@Nullable String name) {
|
||||
int numBitrate;
|
||||
if (useMaximumBitrate) {
|
||||
numBitrate = 0;
|
||||
} else {
|
||||
numBitrate = stringToBitrate(ImGuiHelper.getString(bitrate));
|
||||
}
|
||||
|
||||
String encoder = videoCodec.getEncoders()[selectedVideoEncoder[0]];
|
||||
|
||||
Path defaultExportPath = FabricLoader.getInstance().getGameDir();
|
||||
|
||||
String defaultName = null;
|
||||
if (name != null) {
|
||||
try {
|
||||
defaultName = FileUtil.findAvailableName(defaultExportPath, name, "." + container.extension());
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
if (defaultName == null) {
|
||||
defaultName = "output." + container.extension();
|
||||
}
|
||||
|
||||
String defaultExportPathString = defaultExportPath.toString();
|
||||
return AsyncFileDialogs.saveFileDialog(defaultExportPathString, defaultName,
|
||||
container.extension(), container.extension()).thenApply(pathStr -> {
|
||||
if (pathStr != null) {
|
||||
int start = Math.max(0, startEndTick[0]);
|
||||
int end = Math.max(start, startEndTick[1]);
|
||||
|
||||
ReplayServer replayServer = Flashback.getReplayServer();
|
||||
if (replayServer != null) {
|
||||
int totalTicks = replayServer.getTotalReplayTicks();
|
||||
start = Math.min(start, totalTicks);
|
||||
end = Math.min(end, totalTicks);
|
||||
}
|
||||
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
if (editorState == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Path path = Path.of(pathStr);
|
||||
return new ExportSettings(name, editorState.copy(),
|
||||
player.position(), player.getYRot(), player.getXRot(),
|
||||
resolution[0], resolution[1], start, end,
|
||||
Math.max(1, framerate.get()), resetRng, container, videoCodec, encoder, numBitrate, recordAudio, path);
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private static int stringToBitrate(String string) {
|
||||
@@ -210,7 +305,7 @@ public class StartExportWindow {
|
||||
public static void open() {
|
||||
open = true;
|
||||
|
||||
EditorState editorState = EditorStateCache.getCurrent();
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
|
||||
if (editorState != null && editorState.exportStartTicks >= 0) {
|
||||
startEndTick[0] = editorState.exportStartTicks;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,11 @@
|
||||
package com.moulberry.flashback.editor.ui.windows;
|
||||
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.playback.ReplayServer;
|
||||
import com.moulberry.flashback.record.FlashbackMeta;
|
||||
import com.moulberry.flashback.state.EditorState;
|
||||
import com.moulberry.flashback.state.EditorStateManager;
|
||||
import com.moulberry.flashback.visuals.ReplayVisuals;
|
||||
import com.moulberry.flashback.combo_options.Sizing;
|
||||
import com.moulberry.flashback.editor.ui.ImGuiHelper;
|
||||
import imgui.ImGui;
|
||||
@@ -12,108 +17,217 @@ public class VisualsWindow {
|
||||
private static final int[] intBuffer = new int[]{0};
|
||||
|
||||
public static void render() {
|
||||
ReplayServer replayServer = Flashback.getReplayServer();
|
||||
if (replayServer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
FlashbackMeta metadata = replayServer.getMetadata();
|
||||
EditorState editorState = EditorStateManager.get(metadata.replayIdentifier);
|
||||
ReplayVisuals visuals = editorState.replayVisuals;
|
||||
|
||||
if (ImGui.begin("Visuals")) {
|
||||
ImGuiHelper.separatorWithText("GUI");
|
||||
|
||||
if (ImGui.checkbox("Chat", ReplayVisuals.showChat)) {
|
||||
ReplayVisuals.showChat = !ReplayVisuals.showChat;
|
||||
if (ImGui.checkbox("Chat", visuals.showChat)) {
|
||||
visuals.showChat = !visuals.showChat;
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (ImGui.checkbox("Boss Bar", ReplayVisuals.showBossBar)) {
|
||||
ReplayVisuals.showBossBar = !ReplayVisuals.showBossBar;
|
||||
if (ImGui.checkbox("Boss Bar", visuals.showBossBar)) {
|
||||
visuals.showBossBar = !visuals.showBossBar;
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (ImGui.checkbox("Title Text", ReplayVisuals.showTitleText)) {
|
||||
ReplayVisuals.showTitleText = !ReplayVisuals.showTitleText;
|
||||
if (ImGui.checkbox("Title Text", visuals.showTitleText)) {
|
||||
visuals.showTitleText = !visuals.showTitleText;
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (ImGui.checkbox("Scoreboard", ReplayVisuals.showScoreboard)) {
|
||||
ReplayVisuals.showScoreboard = !ReplayVisuals.showScoreboard;
|
||||
if (ImGui.checkbox("Scoreboard", visuals.showScoreboard)) {
|
||||
visuals.showScoreboard = !visuals.showScoreboard;
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (ImGui.checkbox("Action Bar", ReplayVisuals.showActionBar)) {
|
||||
ReplayVisuals.showActionBar = !ReplayVisuals.showActionBar;
|
||||
if (ImGui.checkbox("Action Bar", visuals.showActionBar)) {
|
||||
visuals.showActionBar = !visuals.showActionBar;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
ImGuiHelper.separatorWithText("World");
|
||||
|
||||
if (ImGui.checkbox("Render Blocks", ReplayVisuals.renderBlocks)) {
|
||||
ReplayVisuals.renderBlocks = !ReplayVisuals.renderBlocks;
|
||||
if (ImGui.checkbox("Render Blocks", visuals.renderBlocks)) {
|
||||
visuals.renderBlocks = !visuals.renderBlocks;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (ImGui.checkbox("Render Entities", ReplayVisuals.renderEntities)) {
|
||||
ReplayVisuals.renderEntities = !ReplayVisuals.renderEntities;
|
||||
if (ImGui.checkbox("Render Entities", visuals.renderEntities)) {
|
||||
visuals.renderEntities = !visuals.renderEntities;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (ImGui.checkbox("Render Players", ReplayVisuals.renderPlayers)) {
|
||||
ReplayVisuals.renderPlayers = !ReplayVisuals.renderPlayers;
|
||||
if (ImGui.checkbox("Render Players", visuals.renderPlayers)) {
|
||||
visuals.renderPlayers = !visuals.renderPlayers;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (ImGui.checkbox("Render Particles", ReplayVisuals.renderParticles)) {
|
||||
ReplayVisuals.renderParticles = !ReplayVisuals.renderParticles;
|
||||
if (ImGui.checkbox("Render Particles", visuals.renderParticles)) {
|
||||
visuals.renderParticles = !visuals.renderParticles;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (ImGui.checkbox("Render Sky", ReplayVisuals.renderSky)) {
|
||||
ReplayVisuals.renderSky = !ReplayVisuals.renderSky;
|
||||
if (ImGui.checkbox("Render Sky", visuals.renderSky)) {
|
||||
visuals.renderSky = !visuals.renderSky;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (ImGui.checkbox("Render Nametags", ReplayVisuals.renderNametags)) {
|
||||
ReplayVisuals.renderNametags = !ReplayVisuals.renderNametags;
|
||||
if (ImGui.checkbox("Render Nametags", visuals.renderNametags)) {
|
||||
visuals.renderNametags = !visuals.renderNametags;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
ImGuiHelper.separatorWithText("Overrides");
|
||||
|
||||
// Fog distance
|
||||
if (ImGui.checkbox("Override Fog", ReplayVisuals.overrideFog)) {
|
||||
ReplayVisuals.overrideFog = !ReplayVisuals.overrideFog;
|
||||
if (ImGui.checkbox("Override Fog", visuals.overrideFog)) {
|
||||
visuals.overrideFog = !visuals.overrideFog;
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (ReplayVisuals.overrideFog) {
|
||||
floatBuffer[0] = ReplayVisuals.overrideFogStart;
|
||||
if (visuals.overrideFog) {
|
||||
floatBuffer[0] = visuals.overrideFogStart;
|
||||
if (ImGui.sliderFloat("Start", floatBuffer, 0.0f, 512.0f)) {
|
||||
ReplayVisuals.overrideFogStart = floatBuffer[0];
|
||||
visuals.overrideFogStart = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
floatBuffer[0] = ReplayVisuals.overrideFogEnd;
|
||||
floatBuffer[0] = visuals.overrideFogEnd;
|
||||
if (ImGui.sliderFloat("End", floatBuffer, 0.0f, 512.0f)) {
|
||||
ReplayVisuals.overrideFogEnd = floatBuffer[0];
|
||||
visuals.overrideFogEnd = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// FOV
|
||||
if (ImGui.checkbox("Override FOV", ReplayVisuals.overrideFov)) {
|
||||
ReplayVisuals.overrideFov = !ReplayVisuals.overrideFov;
|
||||
if (ImGui.checkbox("Override FOV", visuals.overrideFov)) {
|
||||
visuals.overrideFov = !visuals.overrideFov;
|
||||
Minecraft.getInstance().levelRenderer.needsUpdate();
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (ReplayVisuals.overrideFov) {
|
||||
floatBuffer[0] = ReplayVisuals.overrideFovAmount;
|
||||
if (ImGui.sliderFloat("FOV", floatBuffer, 0.1f, 110.0f, "%.1f")) {
|
||||
ReplayVisuals.setFov(floatBuffer[0]);
|
||||
if (visuals.overrideFov) {
|
||||
floatBuffer[0] = visuals.overrideFovAmount;
|
||||
if (ImGui.sliderFloat("FOV", floatBuffer, 1.0f, 110.0f, "%.1f")) {
|
||||
visuals.setFov(floatBuffer[0]);
|
||||
editorState.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// Time
|
||||
if (ImGui.checkbox("Override Time", ReplayVisuals.overrideTimeOfDay >= 0)) {
|
||||
if (ReplayVisuals.overrideTimeOfDay >= 0) {
|
||||
ReplayVisuals.overrideTimeOfDay = -1;
|
||||
if (ImGui.checkbox("Override Time", visuals.overrideTimeOfDay >= 0)) {
|
||||
if (visuals.overrideTimeOfDay >= 0) {
|
||||
visuals.overrideTimeOfDay = -1;
|
||||
} else {
|
||||
ReplayVisuals.overrideTimeOfDay = (int)(Minecraft.getInstance().level.getDayTime() % 24000);
|
||||
visuals.overrideTimeOfDay = (int)(Minecraft.getInstance().level.getDayTime() % 24000);
|
||||
}
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (visuals.overrideTimeOfDay >= 0) {
|
||||
intBuffer[0] = (int) visuals.overrideTimeOfDay;
|
||||
if (ImGui.sliderInt("Time", intBuffer, 0, 24000)) {
|
||||
visuals.overrideTimeOfDay = intBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
}
|
||||
if (ReplayVisuals.overrideTimeOfDay >= 0) {
|
||||
intBuffer[0] = (int) ReplayVisuals.overrideTimeOfDay;
|
||||
if (ImGui.sliderInt("Time", intBuffer, 0, 24000)) {
|
||||
ReplayVisuals.overrideTimeOfDay = intBuffer[0];
|
||||
|
||||
// Camera shake
|
||||
if (ImGui.checkbox("Camera Shake", visuals.overrideCameraShake)) {
|
||||
visuals.overrideCameraShake = !visuals.overrideCameraShake;
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (visuals.overrideCameraShake) {
|
||||
if (ImGui.checkbox("Split Y/X", visuals.cameraShakeSplitParams)) {
|
||||
visuals.cameraShakeSplitParams = !visuals.cameraShakeSplitParams;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (visuals.cameraShakeSplitParams) {
|
||||
ImGui.setNextItemWidth(100);
|
||||
floatBuffer[0] = visuals.cameraShakeXFrequency;
|
||||
if (ImGui.sliderFloat("Frequency X", floatBuffer, 0.1f, 10.0f, "%.1f")) {
|
||||
visuals.cameraShakeXFrequency = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
ImGui.setNextItemWidth(100);
|
||||
floatBuffer[0] = visuals.cameraShakeXAmplitude;
|
||||
if (ImGui.sliderFloat("Amplitude X", floatBuffer, 0.0f, 10.0f, "%.1f")) {
|
||||
visuals.cameraShakeXAmplitude = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
ImGui.setNextItemWidth(100);
|
||||
floatBuffer[0] = visuals.cameraShakeYFrequency;
|
||||
if (ImGui.sliderFloat("Frequency Y", floatBuffer, 0.1f, 10.0f, "%.1f")) {
|
||||
visuals.cameraShakeYFrequency = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
ImGui.setNextItemWidth(100);
|
||||
floatBuffer[0] = visuals.cameraShakeYAmplitude;
|
||||
if (ImGui.sliderFloat("Amplitude Y", floatBuffer, 0.0f, 10.0f, "%.1f")) {
|
||||
visuals.cameraShakeYAmplitude = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
} else {
|
||||
ImGui.setNextItemWidth(100);
|
||||
floatBuffer[0] = (visuals.cameraShakeXFrequency + visuals.cameraShakeYFrequency)/2.0f;
|
||||
if (ImGui.sliderFloat("Frequency", floatBuffer, 0.1f, 10.0f, "%.1f")) {
|
||||
visuals.cameraShakeXFrequency = floatBuffer[0];
|
||||
visuals.cameraShakeYFrequency = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
ImGui.setNextItemWidth(100);
|
||||
floatBuffer[0] = (visuals.cameraShakeXAmplitude + visuals.cameraShakeYAmplitude)/2.0f;
|
||||
if (ImGui.sliderFloat("Amplitude", floatBuffer, 0.0f, 10.0f, "%.1f")) {
|
||||
visuals.cameraShakeXAmplitude = floatBuffer[0];
|
||||
visuals.cameraShakeYAmplitude = floatBuffer[0];
|
||||
editorState.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Camera Roll
|
||||
if (ImGui.checkbox("Camera Roll", visuals.overrideRoll)) {
|
||||
visuals.overrideRoll = !visuals.overrideRoll;
|
||||
Minecraft.getInstance().levelRenderer.needsUpdate();
|
||||
editorState.markDirty();
|
||||
}
|
||||
if (visuals.overrideRoll) {
|
||||
floatBuffer[0] = visuals.overrideRollAmount;
|
||||
if (ImGui.sliderFloat("Roll", floatBuffer, -180.0f, 180.0f, "%.1f")) {
|
||||
visuals.overrideRollAmount = floatBuffer[0];
|
||||
Minecraft.getInstance().levelRenderer.needsUpdate();
|
||||
editorState.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiHelper.separatorWithText("Other");
|
||||
|
||||
if (ImGui.checkbox("Rule of Thirds Guide", ReplayVisuals.ruleOfThirdsGuide)) {
|
||||
ReplayVisuals.ruleOfThirdsGuide = !ReplayVisuals.ruleOfThirdsGuide;
|
||||
if (ImGui.checkbox("Rule of Thirds Guide", visuals.ruleOfThirdsGuide)) {
|
||||
visuals.ruleOfThirdsGuide = !visuals.ruleOfThirdsGuide;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
if (ImGui.checkbox("Center Guide", ReplayVisuals.centerGuide)) {
|
||||
ReplayVisuals.centerGuide = !ReplayVisuals.centerGuide;
|
||||
if (ImGui.checkbox("Center Guide", visuals.centerGuide)) {
|
||||
visuals.centerGuide = !visuals.centerGuide;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
ReplayVisuals.sizing = ImGuiHelper.enumCombo("Sizing", ReplayVisuals.sizing);
|
||||
if (ReplayVisuals.sizing == Sizing.CHANGE_ASPECT_RATIO) {
|
||||
ReplayVisuals.changeAspectRatio = ImGuiHelper.enumCombo("Aspect", ReplayVisuals.changeAspectRatio);
|
||||
if (ImGui.checkbox("Camera Path", visuals.cameraPath)) {
|
||||
visuals.cameraPath = !visuals.cameraPath;
|
||||
editorState.markDirty();
|
||||
}
|
||||
|
||||
visuals.sizing = ImGuiHelper.enumCombo("Sizing", visuals.sizing);
|
||||
if (visuals.sizing == Sizing.CHANGE_ASPECT_RATIO) {
|
||||
visuals.changeAspectRatio = ImGuiHelper.enumCombo("Aspect", visuals.changeAspectRatio);
|
||||
editorState.markDirty();
|
||||
}
|
||||
}
|
||||
ImGui.end();
|
||||
|
||||
Reference in new issue
Block a user