Custom Objects are now being saved with Path Presets instead of globally

This commit is contained in:
CrushedPixel
2015-08-16 18:30:00 +02:00
parent c95c2f0e4c
commit f2752f2790
10 changed files with 59 additions and 61 deletions

View File

@@ -139,7 +139,7 @@ public class GuiKeyframeRepository extends GuiScreen implements GuiReplayOverlay
List<Keyframe> kfs = new ArrayList<Keyframe>(ReplayHandler.getAllKeyframes());
Keyframe[] keyframes = kfs.toArray(new Keyframe[ReplayHandler.getAllKeyframes().size()]);
KeyframeSet newSet = new KeyframeSet(I18n.format("replaymod.gui.keyframerepository.preset.defaultname"), keyframes);
KeyframeSet newSet = new KeyframeSet(I18n.format("replaymod.gui.keyframerepository.preset.defaultname"), keyframes, ReplayHandler.getCustomImageObjects());
try {
CameraPathValidator.validateCameraPath(ReplayHandler.getPositionKeyframes(), ReplayHandler.getTimeKeyframes());
@@ -161,7 +161,7 @@ public class GuiKeyframeRepository extends GuiScreen implements GuiReplayOverlay
keyframeSetList.removeElement(keyframeSetList.getSelectionIndex());
break;
case GuiConstants.KEYFRAME_REPOSITORY_LOAD_BUTTON:
ReplayHandler.useKeyframePreset(keyframeSetList.getElement(keyframeSetList.getSelectionIndex()).getKeyframes());
ReplayHandler.useKeyframePreset(keyframeSetList.getElement(keyframeSetList.getSelectionIndex()));
saveOnQuit();
mc.displayGuiScreen(null);
break;
@@ -198,6 +198,9 @@ public class GuiKeyframeRepository extends GuiScreen implements GuiReplayOverlay
this.drawString(fontRendererObj, I18n.format("replaymod.gui.duration")+": "+ DurationFormatUtils.formatDurationHMS(currentSetDuration),
loadButton.xPosition+2, removeButton.yPosition + 70, Color.WHITE.getRGB());
this.drawString(fontRendererObj, I18n.format("replaymod.gui.objects")+": "+currentSet.getCustomObjectCount(),
loadButton.xPosition+2, removeButton.yPosition + 90, Color.WHITE.getRGB());
}
if(message != null) {

View File

@@ -1,8 +1,6 @@
package eu.crushedpixel.replaymod.gui;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.assets.CustomImageObject;
import eu.crushedpixel.replaymod.assets.CustomObjectRepository;
import eu.crushedpixel.replaymod.assets.ReplayAsset;
import eu.crushedpixel.replaymod.gui.elements.*;
import eu.crushedpixel.replaymod.gui.elements.listeners.NumberValueChangeListener;
@@ -14,8 +12,6 @@ import eu.crushedpixel.replaymod.interpolation.KeyframeList;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import eu.crushedpixel.replaymod.replay.ReplayHandler;
import eu.crushedpixel.replaymod.utils.MouseUtils;
import eu.crushedpixel.replaymod.utils.ReplayFile;
import eu.crushedpixel.replaymod.utils.ReplayFileIO;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
@@ -26,7 +22,6 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.util.Point;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
@@ -377,18 +372,6 @@ public class GuiObjectManager extends GuiScreen implements GuiReplayOverlay.NoOv
}
ReplayHandler.setCustomImageObjects(objects);
if(objects.size() > 0) {
try {
File f = File.createTempFile(ReplayFile.ENTRY_CUSTOM_OBJECTS, "json");
ReplayFileIO.write(new CustomObjectRepository(objects), f);
ReplayMod.replayFileAppender.registerModifiedFile(f, ReplayFile.ENTRY_CUSTOM_OBJECTS, ReplayHandler.getReplayFile());
} catch(Exception e) {
e.printStackTrace();
}
} else {
ReplayMod.replayFileAppender.registerModifiedFile(null, ReplayFile.ENTRY_CUSTOM_OBJECTS, ReplayHandler.getReplayFile());
}
}
private void updateValuesForTransformation(Transformation transformation) {