Skip to content

Commit d1aef55

Browse files
Refactor read(...) function in AbstractCinematicEvent.java
Simplifies the previous code in the `read(...)` function on class `AbstractCinematicEvent`. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 99a1f16 commit d1aef55

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,8 @@ public void read(JmeImporter im) throws IOException {
306306
InputCapsule ic = im.getCapsule(this);
307307
playState = ic.readEnum("playState", PlayState.class, PlayState.Stopped);
308308
speed = ic.readFloat("speed", 1);
309-
// Originally, "initialDuration" was serialized with the name "initalDuration".
310-
// The next code ensure backward compatibility.
311-
initialDuration = ic.readFloat("initialDuration", -1);
312-
if (initialDuration < 0) {
313-
initialDuration = ic.readFloat("initalDuration", -1);
314-
if (initialDuration < 0) {
315-
initialDuration = 10;
316-
}
317-
}
309+
// Maintain backward compatibility for a typo in the serialization key "initalDuration".
310+
initialDuration = ic.readFloat("initialDuration", ic.readFloat("initalDuration", 10));
318311
loopMode = ic.readEnum("loopMode", LoopMode.class, LoopMode.DontLoop);
319312
}
320313

0 commit comments

Comments
 (0)