View Full Version : Convert Particle Instancer to meshes

03 March 2010, 07:13 PM
Hey everyone, so my goal is to write a mel script that will convert instanced particles to animated objects.

I have used the nsUninstancer plugin and it worked great, but unfortunately it is for an older version of Maya. I basically am going to try to recreate it in mel (even though it will be much slower).

The issue I am having is this:
If you have a random object index (objIndexPP) assigned to the particles, and the particles have a short lifespan, depending on how you set them up[0] could be emitted, then die, then be emitted again. This could lead to mesh1 being instanced to particle 0, then perhaps mesh2 instanced to particle 0 when it is birthed again. This is proving to be somewhat tricky when you are trying to bake the particles out to meshes.

Granted, it could be setup in the particle to avoid this situation, but I want to make the script as robust as possible and try to have it be smart enough to overcome this issue.

So my question is:
How would you guys go about tracking when the particle dies (when lifespan is set to constant, not lifespanPP), and your approach to baking this out.

My idea is to run through the sim, and store each vector position in a string array, where each index corresponds to each particle id. So every 3 values represent the xyz postion of the particle. I am also thinking of having another string array for each particle object at every frame and querying what mesh is assigned to that particle and storing the value.

I am having a tough time trying to determine when a particle has died and it has been birthed again. I suppose checking if the age is < the previous frame could work, just wondering if you guys had a more elegant solution.

Thanks again!

05 May 2010, 08:36 PM
:cry: No replies . . . well I will continue on with what I was trying to do. If I get any progress I will post my results.

CGTalk Moderation
05 May 2010, 08:36 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.