@@ -292,7 +292,7 @@ public void write(JmeExporter ex) throws IOException {
292292 OutputCapsule oc = ex .getCapsule (this );
293293 oc .write (playState , "playState" , PlayState .Stopped );
294294 oc .write (speed , "speed" , 1 );
295- oc .write (initialDuration , "initalDuration " , 10 );
295+ oc .write (initialDuration , "initialDuration " , 10 );
296296 oc .write (loopMode , "loopMode" , LoopMode .DontLoop );
297297 }
298298
@@ -306,7 +306,15 @@ 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- initialDuration = ic .readFloat ("initalDuration" , 10 );
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+ }
310318 loopMode = ic .readEnum ("loopMode" , LoopMode .class , LoopMode .DontLoop );
311319 }
312320
0 commit comments