Can't load particle effect

What's the stack trace?

No in this part:


} catch(Exception err) {
                System.out.println("Error loading .jme file:" + err);
                System.out.println("URL was: " + fileURL);
                return null;   // Could allow it to return an empty node, less harsh on errors that way.
            }


Put a "err.printStackTrace();" inside it and it will tell you on what line of code the error happens.

Looks to me like an incompatibility… Like you're writing the particle effect with an older version of jme (for example) then trying to read it with the new version.

No, I'm using RenParticleEditor, from jME2. I made it today!

Sorry but I think you're wrong… You exported the file using RenParticleEditor compiled before rev 4558 where moluva removed the write(NULL_OBJECT) (which is Integer) you can see the change here:

http://code.google.com/p/jmonkeyengine/source/diff?spec=svn4558&r=4558&format=side&path=/trunk/src/com/jme/util/export/binary/BinaryOutputCapsule.java



You're reading (I think) using jME2 SVN version, so the BinaryInputCapsule expects a String and gets an Integer.

You should run RenParticleEditor from your local copy, rather than using the demos on the jME site (which seems to be what you're using).



What I am even more surprised about though, is how lightCombineMode can be null, considering its always set and setting null is disallowed.

I have some problems compiling RenParticleEditor from jME2 Source code, can you send me it ready-for-use?

I'd suggest that isn't a very good idea. Like momoko_fan suggested, there's a very good chance that your problems are caused by a difference between the version of jME your loading code is running on, and the version you saved it against.



If that's so then saving out of a particle editor someone else compiled is a recipe for more frustration.



Don't build around errors - fix whatever is the problem compiling RenParticleEditor, then copy the loading code directly out of that same source code, and there's every chance it will work.

Ok, but how can I get the effects source code, after building it on RenParticleEditor? Is there some option there, like Show source code?

GustavoBorba said:

Ok, but how can I get the effects source code, after building it on RenParticleEditor? Is there some option there, like Show source code?

RenParticleEditor does not create source code. The saved binaries just contain all settings of the needed particle geometry and when you import the file the settings are loaded into newly created objects. After loading the geometry or node (depending on wether you have multiple layers in RenParticleEditor) with the binary importer you can explore the settings of the loaded particle geometry however.

Sorry I'm too noob with particles, and my enlish is not good. Can you please say me how can I explore the settings? like you said. I don't know how to make this code work. Help please! If I can't load the explosion, maybe create it by hand ?

My suggestion was to get the code for loading particles, not for the particles themselves which as normen says isn't saved.


Loading ----
Always fall back to what you know works:

  • Run RenParticleEditor from source code <- Get this working first

  • Load your effect into the editor <- Get this working

  • Now you know for sure that the code you're running can load the effect you're using.

  • You have the source code so just find the bit that does loading, and copy it.


Hint: At a glance it looks like it is in the method showOpenDialog()

--- Creating (alternative to loading, don't need both - pick the one you prefer) ---

  • Check out TestParticleSystem in jmetest.effects

  • You will see code that creates a particle effect

  • Using code like this, set parameters like you did in the editor. They're the same parameters, editor is just a GUI.

I preffered makeing it by hand. I only have this in my script:



       

ParticleMesh explosion = ParticleFactory.buildParticles("Explosion", 80);

        explosion.setLocalTranslation(50, 1, 50);

        explosion.setEmissionDirection(new Vector3f(0.0f, 1.0f, 0.0f));

        explosion.setMaximumAngle(FastMath.PI);

        explosion.setSpeed(1f);

        explosion.setMinimumLifeTime(600.0f);

        explosion.setStartSize(3.0f);

        explosion.setEndSize(7.0f);

        explosion.setStartColor(new ColorRGBA(1.0f, 0.312f, 0.121f, 1.0f));

        explosion.setEndColor(new ColorRGBA(1.0f, 0.24313726f, 0.03137255f, 0.0f));

        explosion.setControlFlow(false);

        explosion.setInitialVelocity(0.02f);

        explosion.setParticleSpinSpeed(0.0f);

        explosion.setRepeatType(Controller.RT_CLAMP);

        explosion.forceRespawn();





But this doesn't make the explosion shows.

You have to attach the Mesh to the scene to see it 


rootNode.attachChild(explosion);
rootNode.updateRenderstate();

Thanks! The finally touch now:



I made the explosion it's looking pretty nice :DDDDD! But I want it to make It like a dome (half of a sphere), not a sphere.



Thanks (: