mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-01 22:16:01 +00:00
0.3.0
This commit is contained in:
1 parent
d2a217509f
commit
4d8f896cdf
90 files changed
+2345
-720
No files matched your search
@@ -5,6 +5,8 @@ import com.moulberry.flashback.FlashbackGson;
|
||||
import com.moulberry.flashback.keyframe.Keyframe;
|
||||
import com.moulberry.flashback.keyframe.KeyframeType;
|
||||
import com.moulberry.flashback.keyframe.handler.KeyframeHandler;
|
||||
import com.moulberry.flashback.keyframe.types.CameraKeyframeType;
|
||||
import com.moulberry.flashback.keyframe.types.CameraOrbitKeyframeType;
|
||||
import com.moulberry.flashback.visuals.ReplayVisuals;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -31,6 +33,7 @@ public class EditorState {
|
||||
public int exportEndTicks = -1;
|
||||
|
||||
public UUID audioSourceEntity = null;
|
||||
public Set<UUID> hideDuringExport = new HashSet<>();
|
||||
|
||||
public void setKeyframe(int trackIndex, int tick, Keyframe keyframe) {
|
||||
if (trackIndex >= this.keyframeTracks.size()) {
|
||||
@@ -146,14 +149,14 @@ public class EditorState {
|
||||
}
|
||||
|
||||
public void applyKeyframes(KeyframeHandler keyframeHandler, float tick) {
|
||||
EnumSet<KeyframeType> applied = EnumSet.noneOf(KeyframeType.class);
|
||||
Set<KeyframeType<?>> applied = new HashSet<>();
|
||||
for (KeyframeTrack keyframeTrack : this.keyframeTracks) {
|
||||
// Ignore lines that are disabled
|
||||
if (!keyframeTrack.enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
KeyframeType baseType = keyframeTrack.keyframeType == KeyframeType.CAMERA_ORBIT ? KeyframeType.CAMERA : keyframeTrack.keyframeType;
|
||||
KeyframeType<?> baseType = keyframeTrack.keyframeType == CameraOrbitKeyframeType.INSTANCE ? CameraKeyframeType.INSTANCE : keyframeTrack.keyframeType;
|
||||
|
||||
// Already applied a keyframe of this type earlier, skip
|
||||
if (applied.contains(baseType)) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface EditorStateHistoryAction {
|
||||
|
||||
void apply(EditorState editorState);
|
||||
|
||||
record SetKeyframe(KeyframeType type, int trackIndex, int tick, Keyframe keyframe) implements EditorStateHistoryAction {
|
||||
record SetKeyframe(KeyframeType<?> type, int trackIndex, int tick, Keyframe keyframe) implements EditorStateHistoryAction {
|
||||
@Override
|
||||
public void apply(EditorState editorState) {
|
||||
if (this.trackIndex < editorState.keyframeTracks.size()) {
|
||||
@@ -31,7 +31,7 @@ public interface EditorStateHistoryAction {
|
||||
@Override
|
||||
public SetKeyframe deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
KeyframeType type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
KeyframeType<?> type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
int trackIndex = jsonObject.get("trackIndex").getAsInt();
|
||||
int tick = jsonObject.get("tick").getAsInt();
|
||||
Keyframe keyframe = context.deserialize(jsonObject.get("keyframe"), Keyframe.class);
|
||||
@@ -51,7 +51,7 @@ public interface EditorStateHistoryAction {
|
||||
}
|
||||
}
|
||||
|
||||
record RemoveKeyframe(KeyframeType type, int trackIndex, int tick) implements EditorStateHistoryAction {
|
||||
record RemoveKeyframe(KeyframeType<?> type, int trackIndex, int tick) implements EditorStateHistoryAction {
|
||||
@Override
|
||||
public void apply(EditorState editorState) {
|
||||
if (this.trackIndex < editorState.keyframeTracks.size()) {
|
||||
@@ -66,7 +66,7 @@ public interface EditorStateHistoryAction {
|
||||
@Override
|
||||
public RemoveKeyframe deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
KeyframeType type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
KeyframeType<?> type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
int trackIndex = jsonObject.get("trackIndex").getAsInt();
|
||||
int tick = jsonObject.get("tick").getAsInt();
|
||||
return new RemoveKeyframe(type, trackIndex, tick);
|
||||
@@ -84,7 +84,7 @@ public interface EditorStateHistoryAction {
|
||||
}
|
||||
}
|
||||
|
||||
record AddTrack(KeyframeType type, int trackIndex) implements EditorStateHistoryAction {
|
||||
record AddTrack(KeyframeType<?> type, int trackIndex) implements EditorStateHistoryAction {
|
||||
@Override
|
||||
public void apply(EditorState editorState) {
|
||||
if (this.trackIndex <= editorState.keyframeTracks.size()) {
|
||||
@@ -96,7 +96,7 @@ public interface EditorStateHistoryAction {
|
||||
@Override
|
||||
public AddTrack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
KeyframeType type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
KeyframeType<?> type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
int trackIndex = jsonObject.get("trackIndex").getAsInt();
|
||||
return new AddTrack(type, trackIndex);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public interface EditorStateHistoryAction {
|
||||
}
|
||||
}
|
||||
|
||||
record RemoveTrack(KeyframeType type, int trackIndex) implements EditorStateHistoryAction {
|
||||
record RemoveTrack(KeyframeType<?> type, int trackIndex) implements EditorStateHistoryAction {
|
||||
@Override
|
||||
public void apply(EditorState editorState) {
|
||||
if (this.trackIndex < editorState.keyframeTracks.size()) {
|
||||
@@ -127,7 +127,7 @@ public interface EditorStateHistoryAction {
|
||||
@Override
|
||||
public RemoveTrack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
KeyframeType type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
KeyframeType<?> type = context.deserialize(jsonObject.get("keyframe_type"), KeyframeType.class);
|
||||
int trackIndex = jsonObject.get("trackIndex").getAsInt();
|
||||
return new RemoveTrack(type, trackIndex);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
package com.moulberry.flashback.state;
|
||||
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import com.moulberry.flashback.editor.ui.ReplayUI;
|
||||
import com.moulberry.flashback.keyframe.Keyframe;
|
||||
import com.moulberry.flashback.keyframe.handler.KeyframeHandler;
|
||||
import com.moulberry.flashback.keyframe.KeyframeType;
|
||||
import com.moulberry.flashback.keyframe.handler.KeyframeHandler;
|
||||
import com.moulberry.flashback.keyframe.handler.MinecraftKeyframeHandler;
|
||||
import com.moulberry.flashback.keyframe.handler.ReplayServerKeyframeHandler;
|
||||
import com.moulberry.flashback.keyframe.impl.TimelapseKeyframe;
|
||||
import com.moulberry.flashback.keyframe.interpolation.SidedInterpolationType;
|
||||
import com.moulberry.flashback.keyframe.types.TimelapseKeyframeType;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class KeyframeTrack {
|
||||
|
||||
public final KeyframeType keyframeType;
|
||||
public final KeyframeType<?> keyframeType;
|
||||
public TreeMap<Integer, Keyframe> keyframesByTick = new TreeMap<>();
|
||||
public boolean enabled = true;
|
||||
|
||||
public KeyframeTrack(KeyframeType keyframeType) {
|
||||
public KeyframeTrack(KeyframeType<?> keyframeType) {
|
||||
this.keyframeType = keyframeType;
|
||||
}
|
||||
|
||||
@@ -26,7 +28,7 @@ public class KeyframeTrack {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.keyframeType == KeyframeType.TIMELAPSE) {
|
||||
if (this.keyframeType == TimelapseKeyframeType.INSTANCE) {
|
||||
return this.tryApplyKeyframesTimelapse(t, tick);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user