From 865c380b4e89080100d95fad9ed56db355f9420b Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Fri, 29 Jul 2011 17:30:03 +0000 Subject: [PATCH] Particle Emitter : - Changed cloning method to clone(boolean cloneMaterial), and added a clone() method that calls clone(true). The missing clone(boolean) method was preventing the particle emitter to be correctly cloned when loading it from a j3o file yielding weird results. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7946 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/core/com/jme3/effect/ParticleEmitter.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/engine/src/core/com/jme3/effect/ParticleEmitter.java b/engine/src/core/com/jme3/effect/ParticleEmitter.java index e8c278fd5..389c6280c 100644 --- a/engine/src/core/com/jme3/effect/ParticleEmitter.java +++ b/engine/src/core/com/jme3/effect/ParticleEmitter.java @@ -150,7 +150,12 @@ public class ParticleEmitter extends Geometry { @Override public ParticleEmitter clone() { - ParticleEmitter clone = (ParticleEmitter) super.clone(); + return clone(true); + } + + @Override + public ParticleEmitter clone(boolean cloneMaterial) { + ParticleEmitter clone = (ParticleEmitter) super.clone(cloneMaterial); clone.shape = shape.deepClone(); // Reinitialize particle list @@ -331,7 +336,7 @@ public class ParticleEmitter extends Geometry { particles[i] = new Particle(); } //We have to reinit the mesh's buffers with the new size - particleMesh.initParticleData(this, particles.length); + particleMesh.initParticleData(this, particles.length); particleMesh.setImagesXY(this.imagesX, this.imagesY); firstUnUsed = 0; lastUsed = -1; @@ -1132,7 +1137,7 @@ public class ParticleEmitter extends Geometry { meshType = ic.readEnum("meshType", ParticleMesh.Type.class, ParticleMesh.Type.Triangle); int numParticles = ic.readInt("numParticles", 0); - + enabled = ic.readBoolean("enabled", true); particlesPerSec = ic.readFloat("particlesPerSec", 0); @@ -1147,6 +1152,7 @@ public class ParticleEmitter extends Geometry { startSize = ic.readFloat("startSize", 0); endSize = ic.readFloat("endSize", 0); worldSpace = ic.readBoolean("worldSpace", false); + this.setIgnoreTransform(worldSpace); facingVelocity = ic.readBoolean("facingVelocity", false); selectRandomImage = ic.readBoolean("selectRandomImage", false); randomAngle = ic.readBoolean("randomAngle", false); @@ -1197,6 +1203,7 @@ public class ParticleEmitter extends Geometry { // loaded separately control = getControl(ParticleEmitterControl.class); control.parentEmitter = this; + } } }