Particle Emitter :

- fixed NPE when loading a ParticleEmitter from a j3o

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7942 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
rem..om 2011-07-29 07:12:19 +00:00
parent 821dc08553
commit 2b802d5272

View File

@ -1132,7 +1132,7 @@ public class ParticleEmitter extends Geometry {
meshType = ic.readEnum("meshType", ParticleMesh.Type.class, ParticleMesh.Type.Triangle); meshType = ic.readEnum("meshType", ParticleMesh.Type.class, ParticleMesh.Type.Triangle);
int numParticles = ic.readInt("numParticles", 0); int numParticles = ic.readInt("numParticles", 0);
this.setNumParticles(numParticles);
enabled = ic.readBoolean("enabled", true); enabled = ic.readBoolean("enabled", true);
particlesPerSec = ic.readFloat("particlesPerSec", 0); particlesPerSec = ic.readFloat("particlesPerSec", 0);
@ -1164,8 +1164,9 @@ public class ParticleEmitter extends Geometry {
default: default:
throw new IllegalStateException("Unrecognized particle type: " + meshType); throw new IllegalStateException("Unrecognized particle type: " + meshType);
} }
particleMesh.initParticleData(this, particles.length); this.setNumParticles(numParticles);
particleMesh.setImagesXY(imagesX, imagesY); // particleMesh.initParticleData(this, particles.length);
// particleMesh.setImagesXY(imagesX, imagesY);
particleInfluencer = (ParticleInfluencer) ic.readSavable("influencer", DEFAULT_INFLUENCER); particleInfluencer = (ParticleInfluencer) ic.readSavable("influencer", DEFAULT_INFLUENCER);
if (particleInfluencer == DEFAULT_INFLUENCER) { if (particleInfluencer == DEFAULT_INFLUENCER) {