From 99a1f167a67e03130c5a304a125600adc47d8169 Mon Sep 17 00:00:00 2001 From: mondogo24 <167080436+mondogo24@users.noreply.github.com> Date: Mon, 30 Mar 2026 15:30:06 +0200 Subject: [PATCH 1/2] Fix typo serialization key in AbstractCinematicEvent (#2449) The serialization key, for the class's field `initialDuration`, should has been `initialDuration` but `initalDuration` was written. --- .../cinematic/events/AbstractCinematicEvent.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java b/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java index 85bae7c857..831852a1cb 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java @@ -292,7 +292,7 @@ public void write(JmeExporter ex) throws IOException { OutputCapsule oc = ex.getCapsule(this); oc.write(playState, "playState", PlayState.Stopped); oc.write(speed, "speed", 1); - oc.write(initialDuration, "initalDuration", 10); + oc.write(initialDuration, "initialDuration", 10); oc.write(loopMode, "loopMode", LoopMode.DontLoop); } @@ -306,7 +306,15 @@ public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); playState = ic.readEnum("playState", PlayState.class, PlayState.Stopped); speed = ic.readFloat("speed", 1); - initialDuration = ic.readFloat("initalDuration", 10); + // Originally, "initialDuration" was serialized with the name "initalDuration". + // The next code ensure backward compatibility. + initialDuration = ic.readFloat("initialDuration", -1); + if (initialDuration < 0) { + initialDuration = ic.readFloat("initalDuration", -1); + if (initialDuration < 0) { + initialDuration = 10; + } + } loopMode = ic.readEnum("loopMode", LoopMode.class, LoopMode.DontLoop); } From d1aef55dfb2f83eb165310676bf53fe0982ddd7b Mon Sep 17 00:00:00 2001 From: mondogo24 <167080436+mondogo24@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:58:47 +0200 Subject: [PATCH 2/2] 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> --- .../jme3/cinematic/events/AbstractCinematicEvent.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java b/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java index 831852a1cb..b7661c631e 100644 --- a/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java +++ b/jme3-core/src/main/java/com/jme3/cinematic/events/AbstractCinematicEvent.java @@ -306,15 +306,8 @@ public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); playState = ic.readEnum("playState", PlayState.class, PlayState.Stopped); speed = ic.readFloat("speed", 1); - // Originally, "initialDuration" was serialized with the name "initalDuration". - // The next code ensure backward compatibility. - initialDuration = ic.readFloat("initialDuration", -1); - if (initialDuration < 0) { - initialDuration = ic.readFloat("initalDuration", -1); - if (initialDuration < 0) { - initialDuration = 10; - } - } + // Maintain backward compatibility for a typo in the serialization key "initalDuration". + initialDuration = ic.readFloat("initialDuration", ic.readFloat("initalDuration", 10)); loopMode = ic.readEnum("loopMode", LoopMode.class, LoopMode.DontLoop); }