Saving ParticleSystem -> detachAllChildren()?


I found a strange call to detachAllChildren() in the ParticleSystem.write()

    public void write(JMEExporter e) throws IOException {

This makes my particles go away after saving them. Is this a bug ?


not sure what the idea behind this was

Are you going to commit a fix ?

Better post a patch in the contribution depot.

I'm not doing anything with jME currently, i'd have to take a closer look to check if there are no sideeffects.

Assuming it is a bug, this doesn't affect me (since I am so far not using ParticleSystem), and nobody else is complaining so I'm personally not going to spend half a day researching and fixing it.  You can very likely get somebody to work the problem on your terms if you sponsor the work at industry standard pay rate.  Otherwise, some tips follow for working on it yourself.

Study the CVS and/or Subversion history (log) for all changes involving detachAllChildren().  Do a code search and find out wherever else detachAllChildren() is called (will just be inside the one class if it's private).  The committer should have made meaningful CVS/Subversion comments when he committed, you'll get an idea about what code is affected, and you will know the identity of the author.  If you don't understand the implementation or whatever, communicate with the author if you can track them down.

If you make up a patch, before posting make sure to run some jmetest demos which work the area in question, and make sure the unit tests run cleanly.  Post patches or other contributions to the relevant (2.x or 3.x) Contrib. Depot forum.

All the particles get re-created and re-attached in initializeParticles() (look at, so I think the children are detached on save so the save file doesn't have particles that will just be replaced on load.

However, they also need to be re-created when you call write(), or else they will disappear. Just call initializeParticles() again and that should bring them all back.

The write method should probably call initializeParticles() when it is done. It would need some testing to be certain.

@Sploreg: thanks for the hint.

@Blaine: thanks, aggreed.