EffectTrack : fixed isssue where an IllegalArgumentExceptio was wrongly raised when removing the spatial from the kill particle control

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9842 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 12 years ago
parent cb06858534
commit 54313302be
  1. 5
      engine/src/core/com/jme3/animation/EffectTrack.java

@ -88,11 +88,14 @@ public class EffectTrack implements ClonableTrack {
@Override @Override
public void setSpatial(Spatial spatial) { public void setSpatial(Spatial spatial) {
super.setSpatial(spatial); super.setSpatial(spatial);
if (spatial != null) {
if (spatial instanceof ParticleEmitter) { if (spatial instanceof ParticleEmitter) {
emitter = (ParticleEmitter) spatial; emitter = (ParticleEmitter) spatial;
} else { } else {
throw new IllegalArgumentException("KillParticleEmitter can only ba attached to ParticleEmitter"); throw new IllegalArgumentException("KillParticleEmitter can only ba attached to ParticleEmitter");
} }
}
} }
@ -371,7 +374,7 @@ public class EffectTrack implements ClonableTrack {
emitter = (ParticleEmitter) in.readSavable("emitter", null); emitter = (ParticleEmitter) in.readSavable("emitter", null);
emitter.setParticlesPerSec(0); emitter.setParticlesPerSec(0);
//if the emitter was saved with a KillParticleControl we remove it. //if the emitter was saved with a KillParticleControl we remove it.
emitter.removeControl(KillParticleControl.class); // emitter.removeControl(KillParticleControl.class);
length = in.readFloat("length", length); length = in.readFloat("length", length);
startOffset = in.readFloat("startOffset", 0); startOffset = in.readFloat("startOffset", 0);
} }

Loading…
Cancel
Save