Add common pathing code and SimplePathing module
This commit is contained in:
@@ -153,7 +153,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
public void onGuiClosed() {
|
||||
// TODO
|
||||
// if(!save) {
|
||||
// ReplayHandler.removeKeyframe(keyframe);
|
||||
// ReplayHandler.removeKeyframe(property);
|
||||
// ReplayHandler.addKeyframe(keyframeBackup);
|
||||
// ReplayHandler.selectKeyframe(keyframeBackup);
|
||||
// }
|
||||
@@ -218,8 +218,8 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// private static class GuiEditKeyframeMarker extends GuiEditKeyframe<Marker> {
|
||||
// private GuiAdvancedTextField markerNameInput;
|
||||
//
|
||||
// public GuiEditKeyframeMarker(Keyframe<Marker> keyframe) {
|
||||
// super(keyframe, ReplayHandler.getMarkerKeyframes());
|
||||
// public GuiEditKeyframeMarker(Keyframe<Marker> property) {
|
||||
// super(property, ReplayHandler.getMarkerKeyframes());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
@@ -227,7 +227,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// super.initGui();
|
||||
//
|
||||
// if (!initialized) {
|
||||
// String name = keyframe.getValue().getName();
|
||||
// String name = property.getValue().getName();
|
||||
// if (name == null) name = "";
|
||||
// markerNameInput = new GuiAdvancedTextField(fontRendererObj, 0, 0, 200, 20);
|
||||
// markerNameInput.hint = I18n.format("replaymod.gui.editkeyframe.markername");
|
||||
@@ -246,7 +246,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
//
|
||||
// @Override
|
||||
// public void onGuiClosed() {
|
||||
// keyframe.getValue().setName(markerNameInput.getText().trim());
|
||||
// property.getValue().setName(markerNameInput.getText().trim());
|
||||
// super.onGuiClosed();
|
||||
// }
|
||||
// }
|
||||
@@ -254,8 +254,8 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// private static class GuiEditKeyframeTime extends GuiEditKeyframe<TimestampValue> {
|
||||
// private GuiNumberInput kfMin, kfSec, kfMs;
|
||||
//
|
||||
// public GuiEditKeyframeTime(Keyframe<TimestampValue> keyframe) {
|
||||
// super(keyframe, ReplayHandler.getTimeKeyframes());
|
||||
// public GuiEditKeyframeTime(Keyframe<TimestampValue> property) {
|
||||
// super(property, ReplayHandler.getTimeKeyframes());
|
||||
// screenTitle = I18n.format("replaymod.gui.editkeyframe.title.time");
|
||||
// }
|
||||
//
|
||||
@@ -264,7 +264,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// super.initGui();
|
||||
//
|
||||
// if (!initialized) {
|
||||
// int time = keyframe.getValue().asInt();
|
||||
// int time = property.getValue().asInt();
|
||||
//
|
||||
// kfMin = new GuiDraggingNumberInput(fontRendererObj, 0, 0, 30, 0d, null, (double)TimestampUtils.timestampToWholeMinutes(time), false, "", 1);
|
||||
// kfSec = new GuiDraggingNumberInput(fontRendererObj, 0, 0, 25, 0d, 59d, (double)TimestampUtils.getSecondsFromTimestamp(time), false, "", 1);
|
||||
@@ -277,7 +277,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// KeyframeValueChangeListener listener = new KeyframeValueChangeListener(this) {
|
||||
// @Override
|
||||
// public void onValueChange(double value) {
|
||||
// keyframe.setValue(new TimestampValue(TimestampUtils.calculateTimestamp(
|
||||
// property.setValue(new TimestampValue(TimestampUtils.calculateTimestamp(
|
||||
// kfMin.getIntValue(), kfSec.getIntValue(), kfMs.getIntValue())));
|
||||
//
|
||||
// super.onValueChange(value);
|
||||
@@ -312,8 +312,8 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// private GuiNumberInput xCoord, yCoord, zCoord, pitch, yaw, roll;
|
||||
// private ComposedElement posInputs;
|
||||
//
|
||||
// public GuiEditKeyframePosition(Keyframe<AdvancedPosition> keyframe) {
|
||||
// super(keyframe, ReplayHandler.getPositionKeyframes());
|
||||
// public GuiEditKeyframePosition(Keyframe<AdvancedPosition> property) {
|
||||
// super(property, ReplayHandler.getPositionKeyframes());
|
||||
// screenTitle = I18n.format("replaymod.gui.editkeyframe.title.pos");
|
||||
// }
|
||||
//
|
||||
@@ -322,7 +322,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// super.initGui();
|
||||
//
|
||||
// if (!initialized) {
|
||||
// AdvancedPosition pos = keyframe.getValue();
|
||||
// AdvancedPosition pos = property.getValue();
|
||||
// xCoord = new GuiDraggingNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getX()), true);
|
||||
// yCoord = new GuiDraggingNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getY()), true);
|
||||
// zCoord = new GuiDraggingNumberInput(fontRendererObj, 0, 0, 100, null, null, RoundUtils.round2Decimals(pos.getZ()), true);
|
||||
@@ -336,7 +336,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// KeyframeValueChangeListener listener = new KeyframeValueChangeListener(this) {
|
||||
// @Override
|
||||
// public void onValueChange(double value) {
|
||||
// keyframe.setValue(new AdvancedPosition(xCoord.getPreciseValue(), yCoord.getPreciseValue(),
|
||||
// property.setValue(new AdvancedPosition(xCoord.getPreciseValue(), yCoord.getPreciseValue(),
|
||||
// zCoord.getPreciseValue(), new Float(pitch.getPreciseValue()), (float) yaw.getPreciseValue(),
|
||||
// (float) roll.getPreciseValue()));
|
||||
//
|
||||
@@ -378,7 +378,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
//
|
||||
// @Override
|
||||
// protected void drawScreen0() {
|
||||
// if (keyframe.getValue() instanceof SpectatorData) return;
|
||||
// if (property.getValue() instanceof SpectatorData) return;
|
||||
// drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.xpos"), left, virtualY + 27, Color.WHITE.getRGB());
|
||||
// drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.ypos"), left, virtualY + 57, Color.WHITE.getRGB());
|
||||
// drawString(fontRendererObj, I18n.format("replaymod.gui.editkeyframe.zpos"), left, virtualY + 87, Color.WHITE.getRGB());
|
||||
@@ -413,8 +413,8 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// public GuiEditKeyframeSpectator(Keyframe<AdvancedPosition> keyframe) {
|
||||
// super(keyframe, ReplayHandler.getPositionKeyframes());
|
||||
// public GuiEditKeyframeSpectator(Keyframe<AdvancedPosition> property) {
|
||||
// super(property, ReplayHandler.getPositionKeyframes());
|
||||
// screenTitle = I18n.format("replaymod.gui.editkeyframe.title.spec");
|
||||
// }
|
||||
//
|
||||
@@ -423,7 +423,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// super.initGui();
|
||||
//
|
||||
// if (!initialized) {
|
||||
// SpectatorData data = (SpectatorData)keyframe.getValue();
|
||||
// SpectatorData data = (SpectatorData)property.getValue();
|
||||
//
|
||||
// perspectiveButton = new GuiToggleButton(0, 0, 0, 200, 20, I18n.format("replaymod.gui.editkeyframe.spec.method")+": ", new String[]{
|
||||
// I18n.format("replaymod.gui.editkeyframe.spec.method.firstperson"),
|
||||
@@ -481,7 +481,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
//
|
||||
// @Override
|
||||
// public void onGuiClosed() {
|
||||
// SpectatorData data = (SpectatorData)keyframe.getValue();
|
||||
// SpectatorData data = (SpectatorData)property.getValue();
|
||||
// data.setSpectatingMethod(SpectatorData.SpectatingMethod.values()[perspectiveButton.getValue()]);
|
||||
// data.getThirdPersonInfo().shoulderCamDistance = shoulderDistanceInput.getPreciseValue();
|
||||
// data.getThirdPersonInfo().shoulderCamPitchOffset = shoulderPitchOffsetInput.getIntValue();
|
||||
@@ -506,7 +506,7 @@ public abstract class GuiEditKeyframe<T extends KeyframeValue> extends GuiScreen
|
||||
// @Override
|
||||
// public void onValueChange(double value) {
|
||||
// int realTimestamp = TimestampUtils.calculateTimestamp(parent.min.getIntValue(), parent.sec.getIntValue(), parent.ms.getIntValue());
|
||||
// parent.keyframe.setRealTimestamp(realTimestamp);
|
||||
// parent.property.setRealTimestamp(realTimestamp);
|
||||
//
|
||||
// ReplayHandler.fireKeyframesModifyEvent();
|
||||
// }
|
||||
|
||||
@@ -459,7 +459,7 @@ public class GuiObjectManager extends GuiScreen {
|
||||
// public void onValueChange(double value) {
|
||||
// NumberValue numberValue = new NumberValue(value);
|
||||
//
|
||||
// //if keyframe selected, overwrite its value
|
||||
// //if property selected, overwrite its value
|
||||
// if(toModify.contains(objectKeyframeTimeline.getSelectedKeyframe())) {
|
||||
// objectKeyframeTimeline.getSelectedKeyframe().setValue(numberValue);
|
||||
// } else {
|
||||
@@ -488,7 +488,7 @@ public class GuiObjectManager extends GuiScreen {
|
||||
// public void onValueChange(double value) {
|
||||
// Position position = new Position(xInput.getPreciseValue(), yInput.getPreciseValue(), zInput.getPreciseValue());
|
||||
//
|
||||
// //if keyframe selected, overwrite its value
|
||||
// //if property selected, overwrite its value
|
||||
// if(toModify.contains(objectKeyframeTimeline.getSelectedKeyframe())) {
|
||||
// objectKeyframeTimeline.getSelectedKeyframe().setValue(position);
|
||||
// } else {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
||||
//
|
||||
// //left mouse button
|
||||
// if(button == 0) {
|
||||
// ReplayHandler.selectKeyframe(closest); //can be null, deselects keyframe
|
||||
// ReplayHandler.selectKeyframe(closest); //can be null, deselects property
|
||||
//
|
||||
// // If we clicked on a key frame, then continue monitoring the mouse for movements
|
||||
// long currentTime = System.currentTimeMillis();
|
||||
@@ -241,7 +241,7 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
||||
// textureY = KEYFRAME_TIME_Y;
|
||||
// y += 5;
|
||||
// } else {
|
||||
// throw new UnsupportedOperationException("Unknown keyframe type: " + kf.getClass());
|
||||
// throw new UnsupportedOperationException("Unknown property type: " + kf.getClass());
|
||||
// }
|
||||
//
|
||||
// if (ReplayHandler.isSelected(kf)) {
|
||||
|
||||
@@ -58,11 +58,11 @@ public class AdvancedPositionKeyframeList extends KeyframeList<AdvancedPosition>
|
||||
// TimestampValue timestampValue = ReplayHandler.getTimeKeyframes().getInterpolatedValueForTimestamp(keyframeTimestamp, true);
|
||||
// int replayTimestamp = timestampValue == null ? 0 : timestampValue.asInt();
|
||||
// if(firstTimestamp == -1) firstTimestamp = replayTimestamp;
|
||||
// spectatorInterpolation.addPoint(keyframe, replayTimestamp);
|
||||
// spectatorInterpolation.addPoint(property, replayTimestamp);
|
||||
// if(iterator.hasNext()) {
|
||||
// keyframe = iterator.next();
|
||||
// found = keyframe.getValue() instanceof SpectatorData;
|
||||
// if(!found) completedKeyframes.add(keyframe);
|
||||
// property = iterator.next();
|
||||
// found = property.getValue() instanceof SpectatorData;
|
||||
// if(!found) completedKeyframes.add(property);
|
||||
// } else {
|
||||
// found = false;
|
||||
// }
|
||||
|
||||
@@ -54,7 +54,7 @@ public class SpectatorDataInterpolation {
|
||||
}
|
||||
thirdPersonInfoInterpolation.prepare();
|
||||
|
||||
//updating the spectator keyframe's position in the world to smoothly continue the path
|
||||
//updating the spectator property's position in the world to smoothly continue the path
|
||||
//with non-spectator position keyframes
|
||||
for(Pair<Integer, Keyframe<AdvancedPosition>> pair : points) {
|
||||
// TODO
|
||||
@@ -74,7 +74,7 @@ public class SpectatorDataInterpolation {
|
||||
// pair.getValue().getValue().apply(entityPosition);
|
||||
}
|
||||
|
||||
//feed the underlying keyframe list with AdvancedPosition Keyframes that are derived from the Spectator Keyframes
|
||||
//feed the underlying property list with AdvancedPosition Keyframes that are derived from the Spectator Keyframes
|
||||
underlyingKeyframes = new KeyframeList<AdvancedPosition>();
|
||||
int i = 0;
|
||||
int firstTimestamp = -1;
|
||||
|
||||
@@ -40,7 +40,6 @@ public class KeybindRegistry {
|
||||
replayModKeyBindings.add(new KeyBinding(KEY_RESET_TILT, Keyboard.KEY_K, "replaymod.title"));
|
||||
|
||||
replayModKeyBindings.add(new KeyBinding(KEY_CLEAR_KEYFRAMES, Keyboard.KEY_C, "replaymod.title"));
|
||||
replayModKeyBindings.add(new KeyBinding(KEY_KEYFRAME_PRESETS, Keyboard.KEY_X, "replaymod.title"));
|
||||
replayModKeyBindings.add(new KeyBinding(KEY_PATH_PREVIEW, Keyboard.KEY_H, "replaymod.title"));
|
||||
|
||||
replayModKeyBindings.add(new KeyBinding(KEY_SYNC_TIMELINE, Keyboard.KEY_V, "replaymod.title"));
|
||||
|
||||
@@ -55,8 +55,8 @@ public class PathPreviewRenderer {
|
||||
// AdvancedPosition previousPosition = null;
|
||||
//
|
||||
// int i = 0;
|
||||
// for(Keyframe<AdvancedPosition> keyframe : keyframes) {
|
||||
// int timestamp = keyframe.getRealTimestamp();
|
||||
// for(Keyframe<AdvancedPosition> property : keyframes) {
|
||||
// int timestamp = property.getRealTimestamp();
|
||||
// int nextTimestamp = timestamp;
|
||||
//
|
||||
// if(i+1 < keyframes.size()) {
|
||||
|
||||
@@ -168,38 +168,38 @@ public class ReplayHandler {
|
||||
// // TODO
|
||||
// }
|
||||
//
|
||||
// public static void addTimeKeyframe(Keyframe<TimestampValue> keyframe) {
|
||||
// timeKeyframes.add(keyframe);
|
||||
// selectKeyframe(keyframe);
|
||||
// public static void addTimeKeyframe(Keyframe<TimestampValue> property) {
|
||||
// timeKeyframes.add(property);
|
||||
// selectKeyframe(property);
|
||||
//
|
||||
// fireKeyframesModifyEvent();
|
||||
// }
|
||||
//
|
||||
// public static void addPositionKeyframe(Keyframe<AdvancedPosition> keyframe) {
|
||||
// positionKeyframes.add(keyframe);
|
||||
// selectKeyframe(keyframe);
|
||||
// public static void addPositionKeyframe(Keyframe<AdvancedPosition> property) {
|
||||
// positionKeyframes.add(property);
|
||||
// selectKeyframe(property);
|
||||
//
|
||||
// fireKeyframesModifyEvent();
|
||||
// }
|
||||
//
|
||||
// @SuppressWarnings("unchecked")
|
||||
// public static void addKeyframe(Keyframe keyframe) {
|
||||
// if(keyframe.getValue() instanceof AdvancedPosition) {
|
||||
// addPositionKeyframe(keyframe);
|
||||
// } else if(keyframe.getValue() instanceof TimestampValue) {
|
||||
// addTimeKeyframe(keyframe);
|
||||
// public static void addKeyframe(Keyframe property) {
|
||||
// if(property.getValue() instanceof AdvancedPosition) {
|
||||
// addPositionKeyframe(property);
|
||||
// } else if(property.getValue() instanceof TimestampValue) {
|
||||
// addTimeKeyframe(property);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void removeKeyframe(Keyframe keyframe) {
|
||||
// if(keyframe.getValue() instanceof AdvancedPosition) {
|
||||
// positionKeyframes.remove(keyframe);
|
||||
// } else if(keyframe.getValue() instanceof TimestampValue) {
|
||||
// timeKeyframes.remove(keyframe);
|
||||
// public static void removeKeyframe(Keyframe property) {
|
||||
// if(property.getValue() instanceof AdvancedPosition) {
|
||||
// positionKeyframes.remove(property);
|
||||
// } else if(property.getValue() instanceof TimestampValue) {
|
||||
// timeKeyframes.remove(property);
|
||||
// }
|
||||
// // TODO Marker
|
||||
//
|
||||
// if(keyframe == selectedKeyframe) {
|
||||
// if(property == selectedKeyframe) {
|
||||
// selectKeyframe(null);
|
||||
// }
|
||||
//
|
||||
@@ -485,14 +485,14 @@ public class ReplayHandler {
|
||||
//
|
||||
// int prevTime, prevRealTime;
|
||||
//
|
||||
// Keyframe<TimestampValue> keyframe = timeKeyframes.last();
|
||||
// Keyframe<TimestampValue> property = timeKeyframes.last();
|
||||
//
|
||||
// if(keyframe == null) {
|
||||
// if(property == null) {
|
||||
// prevTime = 0;
|
||||
// prevRealTime = 0;
|
||||
// } else {
|
||||
// prevTime = (int)keyframe.getValue().value;
|
||||
// prevRealTime = keyframe.getRealTimestamp();
|
||||
// prevTime = (int)property.getValue().value;
|
||||
// prevRealTime = property.getRealTimestamp();
|
||||
// }
|
||||
//
|
||||
// double speed = ignoreReplaySpeed ? 1 : ReplayMod.overlay.getSpeedSliderValue();
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.base.Optional;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.replaymod.pathing.serialize.LegacyKeyframeSetAdapter;
|
||||
import de.johni0702.replaystudio.PacketData;
|
||||
import de.johni0702.replaystudio.filter.ChangeTimestampFilter;
|
||||
import de.johni0702.replaystudio.filter.NeutralizerFilter;
|
||||
@@ -19,7 +20,6 @@ import eu.crushedpixel.replaymod.gui.elements.listeners.ProgressUpdateListener;
|
||||
import eu.crushedpixel.replaymod.holders.Keyframe;
|
||||
import eu.crushedpixel.replaymod.holders.KeyframeSet;
|
||||
import eu.crushedpixel.replaymod.holders.TimestampValue;
|
||||
import eu.crushedpixel.replaymod.utils.LegacyKeyframeSetAdapter;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
package eu.crushedpixel.replaymod.utils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import eu.crushedpixel.replaymod.assets.CustomImageObject;
|
||||
import eu.crushedpixel.replaymod.holders.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LegacyKeyframeSetAdapter extends TypeAdapter<KeyframeSet[]> {
|
||||
|
||||
public LegacyKeyframeSetAdapter() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyframeSet[] read(JsonReader in) throws IOException {
|
||||
List<KeyframeSet> sets = new ArrayList<KeyframeSet>();
|
||||
|
||||
in.beginArray();
|
||||
while(in.hasNext()) { //iterate over all array entries
|
||||
|
||||
KeyframeSet set = new KeyframeSet();
|
||||
List<Keyframe> keyframes = new ArrayList<Keyframe>();
|
||||
|
||||
in.beginObject();
|
||||
while(in.hasNext()) { //iterate over all object entries
|
||||
String jsonTag = in.nextName();
|
||||
|
||||
if("name".equals(jsonTag)) {
|
||||
set.setName(in.nextString());
|
||||
|
||||
//TODO: Adapt to new Spectator Keyframe system
|
||||
} else if("positionKeyframes".equals(jsonTag)) {
|
||||
in.beginArray();
|
||||
while(in.hasNext()) {
|
||||
Keyframe<AdvancedPosition> newKeyframe = new Keyframe<AdvancedPosition>();
|
||||
Integer spectatedEntityID = null;
|
||||
in.beginObject();
|
||||
while(in.hasNext()) {
|
||||
String jsonKeyframeTag = in.nextName();
|
||||
if("value".equals(jsonKeyframeTag) || "position".equals(jsonKeyframeTag)) {
|
||||
SpectatorData spectatorData = new Gson().fromJson(in, SpectatorData.class);
|
||||
newKeyframe.setValue(spectatorData.normalize());
|
||||
} else if("realTimestamp".equals(jsonKeyframeTag)) {
|
||||
newKeyframe.setRealTimestamp(in.nextInt());
|
||||
} else if("spectatedEntityID".equals(jsonKeyframeTag)) {
|
||||
spectatedEntityID = in.nextInt();
|
||||
}
|
||||
}
|
||||
|
||||
if(spectatedEntityID != null) {
|
||||
newKeyframe.setValue(newKeyframe.getValue().asSpectatorData(spectatedEntityID));
|
||||
}
|
||||
|
||||
in.endObject();
|
||||
|
||||
keyframes.add(newKeyframe);
|
||||
}
|
||||
in.endArray();
|
||||
|
||||
} else if("timeKeyframes".equals(jsonTag)) {
|
||||
in.beginArray();
|
||||
while(in.hasNext()) {
|
||||
Keyframe<TimestampValue> newKeyframe = new Keyframe<TimestampValue>();
|
||||
|
||||
in.beginObject();
|
||||
while(in.hasNext()) {
|
||||
String jsonKeyframeTag = in.nextName();
|
||||
if("timestamp".equals(jsonKeyframeTag)) {
|
||||
TimestampValue timestampValue = new TimestampValue(in.nextInt());
|
||||
newKeyframe.setValue(timestampValue);
|
||||
} else if("value".equals(jsonKeyframeTag)) {
|
||||
TimestampValue timestampValue = new Gson().fromJson(in, TimestampValue.class);
|
||||
newKeyframe.setValue(timestampValue);
|
||||
} else if("realTimestamp".equals(jsonKeyframeTag)) {
|
||||
newKeyframe.setRealTimestamp(in.nextInt());
|
||||
}
|
||||
}
|
||||
in.endObject();
|
||||
|
||||
keyframes.add(newKeyframe);
|
||||
}
|
||||
in.endArray();
|
||||
|
||||
} else if("customObjects".equals(jsonTag)) {
|
||||
CustomImageObject[] customObjects = new Gson().fromJson(in, CustomImageObject[].class);
|
||||
|
||||
set.setCustomObjects(customObjects);
|
||||
}
|
||||
}
|
||||
in.endObject();
|
||||
|
||||
set.setKeyframes(keyframes.toArray(new Keyframe[keyframes.size()]));
|
||||
sets.add(set);
|
||||
}
|
||||
in.endArray();
|
||||
|
||||
return sets.toArray(new KeyframeSet[sets.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JsonWriter out, KeyframeSet[] value) throws IOException {}
|
||||
}
|
||||
Reference in New Issue
Block a user