Particle Designer Issues

I have been using Particle Designer and it’s great. However, about half the time, exported files just fail in Corona.

I have tracked down a couple of the problems:

  1. If particleLifespan == 0.0, then Corona fails

  2. If some values are strings instead of numbers (e.g., “1.0”) then Corona fails.

Here’s a small python script that fixes a .json exported from Particle Designer. Save it as fix_json.py and run “python fix_json.py myfile.json”

import json, sys

def fixvalue(v):

    try: return float(v)

    except: return v

fname = sys.argv[1]

jd = json.load(open(fname))

jdf = dict((k,fixvalue(v)) for k,v in jd.items())

if jdf[‘particleLifespan’] == 0: jdf[‘particleLifespan’] = 0.05

json.dump(jdf, open(fname,‘w’))

I had a similar problem, I’ll give it try, nice find, thanks!

Thanks for flagging these @hgbrian, I’ll report them to engineering.

Brent

@hgbrian:

It’s invalid for “maxParticles”, or “particleLifespan”, to be zero.

Tomorrow’s daily build will contain a change that will gracefully handle this situation by setting “maxParticles” to 1 and “particleLifespan” to 0.05.

As far as strings (“1.0”) vs numbers (1.0). Can you provide a Particle Designer project file that I can use to reproduce this problem? I’d also like to know which version of the Particle Designer tool you’re using.

Thanks,

Albert

Hi Albert,

the example I used was simply the “Hell Fire 1” example particle designer file. 

Here it is:

https://www.dropbox.com/s/molx7dx5ywzwmm5/hellfire_test.pdproject

If you export as json, you should see this:

{“startColorAlpha”:1,“startParticleSizeVariance”:“76.82”,“startColorGreen”:0.5152422,“sourcePositionx”:160,“sourcePositiony”:240,“rotatePerSecond”:0,“radialAcceleration”:“0.00”,“yCoordFlipped”:-1,“emitterType”:“0”,“blendFuncSource”:“770”,“finishColorVarianceAlpha”:“0.00”,“rotationEnd”:“0.00”,“startColorVarianceBlue”:“0.00”,“rotatePerSecondVariance”:201.32,“particleLifespan”:“0.0000”,“minRadius”:0,“configName”:“hellfire_test”,“tangentialAcceleration”:-0,“rotationStart”:“0.00”,“startColorVarianceGreen”:“0.00”,“speed”:“29.86”,“minRadiusVariance”:0,“finishColorVarianceBlue”:“0.00”,“finishColorBlue”:0,“finishColorGreen”:0,“blendFuncDestination”:“1”,“finishColorAlpha”:1,“sourcePositionVariancex”:“210.31”,“startParticleSize”:“151.58”,“sourcePositionVariancey”:"-64.00",“startColorRed”:1,“finishColorVarianceRed”:“0.00”,“textureFileName”:“hellfire_test.png”,“startColorVarianceAlpha”:“0.00”,“maxParticles”:“590”,“finishColorVarianceGreen”:“0.00”,“finishParticleSize”:“0.00”,“duration”:"-1.00",“startColorVarianceRed”:“0.00”,“finishColorRed”:0,“gravityx”:“0.00”,“maxRadiusVariance”:15.79,“finishParticleSizeVariance”:“0”,“gravityy”:44.27,“rotationEndVariance”:“90.00”,“startColorBlue”:0.2313443,“rotationStartVariance”:“0.00”,“speedVariance”:“470.60”,“radialAccelVariance”:“180.00”,“textureImageData”:"",“tangentialAccelVariance”:-0,“particleLifespanVariance”:“1.5000”,“angleVariance”:-0,“angle”:-90,“maxRadius”:142.11}

You can fix this json file by changing the string values to numbers and setting particleLifespan to >0. If you just set the particleLifespan to “0.05” or 0.05 then it does not work. The Particle Designer app seems to be inconsistent with the string thing.

Brian

And I am using a Particle Designer 2.0.5.1 (3651

I likewise was using the “Hell Fire 1” shared example.  Changing the values from strings to numbers, and having a non-zero lifespan also worked for me.  Here is my original project that was not working…

http://forums.coronalabs.com/topic/46290-example-of-exported-particle-designer-emitter-not-working/

I am using the latest Particle Designer 2.0.5.1

We have identified a problem with a few of the shared emitters in PD 2.0 which produce strings for numbers. The problem is due to some corrupt data in some shared emitters. Once we have fixed the data just running PD will cause the updates to get synched and the problem will be solved.

As soon as the DB has been updated I’ll post another comment.

Thanks

Mike

The emitter DB has been updated. When you next run PD it will sync the entire DB again as we have updated all the emitters to make sure there are no problems floating around. Once the update is complete none of the shared emitters will generate strings for output hopefully fixing the problems people have seen. It can take a couple of minutes to re-sync after which all the shared emitters will have been corrected.

Thanks

Mike

Hey guys.  It looks like this has been fixed, but I wanted  you to know that I have a tool for loading ‘Particle Designer’ files and generating an emitter that will also handle these issues by checking for legal values and fixing them when they are not legal.

This tool also allows you to:

  • Load the emitter data and image file from any folder (not necessarily the same).
  • Dynamically (at call time) change any parameters.  Ex: You might want to tune duration to different values and with this loader you can do that in the same single-line you use to load and build the emitter.
  • Load alternative textures for an emitter definition.
  • Load alternative emitter formats (not so important for PD2 users).

You can find out more on my site if you’re interested.  Look for the ‘Universal Emitter Loader’ (aka PEX Tools).  

You can read the docs here if you’re interested.

Some example calls, just for your edification: 

------------------------------------------------------------------ -- 1. Simplest example (load emitter and particle from root folder) -- local emitter = pex.loadPD2( nil, 200, 100, "Comet.json" ) ------------------------------------------------------------------ -- 2. Load emitter and particle from subfolder (automatically modifies path for particle) -- local emitter = pex.loadPD2( nil, 200, 100, "emitters/ParticleDesigner2/Comet.json", { texturePath = "emitters/ParticleDesigner2/" } ) ------------------------------------------------------------------ -- 3. Same as above, but different texture in same folder -- local emitter = pex.loadPD2( nil, 200, 100, "emitters/ParticleDesigner2/Comet.json", { texturePath = "emitters/ParticleDesigner2/", altTexture = "texture.png" } ) ------------------------------------------------------------------ -- 4. Same as above, but load alternative texture -- local emitter = pex.loadPD2( nil, 200, 100, "emitters/ParticleDesigner2/Comet.json", { altTexture = "images/star.png" } ) ------------------------------------------------------------------ -- 5. Override parameters -- local emitter = pex.loadPD2( nil, 200, 100, "emitters/ParticleDesigner2/Comet.json", { altTexture = "images/star.png", duration = 3.0, particleLifespan = 1.0, particleLifespanVariance = 0.5 } )  

One more quick post.  I double checked and used ‘mlcraigs’ emitter output and was able to load and create it with these two lines:

(The key was using the ‘fixNumbers’ option):

local emitter1 = pex.loadPD2( nil, 240, 160,                               "emitters/ParticleDesigner2/big\_flames.json",                               { texturePath = "emitters/ParticleDesigner2/", fixNumbers = true } ) local emitter1 = pex.loadPD2( nil, 400, 40,                               "emitters/ParticleDesigner2/fire.json",                               { texturePath = "emitters/ParticleDesigner2/", fixNumbers = true } ) 

https://www.youtube.com/watch?v=Quuef0owBUI&feature=youtu.be&hd=1

@roaminggamer – this tool looks very useful

I had a similar problem, I’ll give it try, nice find, thanks!

Thanks for flagging these @hgbrian, I’ll report them to engineering.

Brent

@hgbrian:

It’s invalid for “maxParticles”, or “particleLifespan”, to be zero.

Tomorrow’s daily build will contain a change that will gracefully handle this situation by setting “maxParticles” to 1 and “particleLifespan” to 0.05.

As far as strings (“1.0”) vs numbers (1.0). Can you provide a Particle Designer project file that I can use to reproduce this problem? I’d also like to know which version of the Particle Designer tool you’re using.

Thanks,

Albert

Hi Albert,

the example I used was simply the “Hell Fire 1” example particle designer file. 

Here it is:

https://www.dropbox.com/s/molx7dx5ywzwmm5/hellfire_test.pdproject

If you export as json, you should see this:

{“startColorAlpha”:1,“startParticleSizeVariance”:“76.82”,“startColorGreen”:0.5152422,“sourcePositionx”:160,“sourcePositiony”:240,“rotatePerSecond”:0,“radialAcceleration”:“0.00”,“yCoordFlipped”:-1,“emitterType”:“0”,“blendFuncSource”:“770”,“finishColorVarianceAlpha”:“0.00”,“rotationEnd”:“0.00”,“startColorVarianceBlue”:“0.00”,“rotatePerSecondVariance”:201.32,“particleLifespan”:“0.0000”,“minRadius”:0,“configName”:“hellfire_test”,“tangentialAcceleration”:-0,“rotationStart”:“0.00”,“startColorVarianceGreen”:“0.00”,“speed”:“29.86”,“minRadiusVariance”:0,“finishColorVarianceBlue”:“0.00”,“finishColorBlue”:0,“finishColorGreen”:0,“blendFuncDestination”:“1”,“finishColorAlpha”:1,“sourcePositionVariancex”:“210.31”,“startParticleSize”:“151.58”,“sourcePositionVariancey”:"-64.00",“startColorRed”:1,“finishColorVarianceRed”:“0.00”,“textureFileName”:“hellfire_test.png”,“startColorVarianceAlpha”:“0.00”,“maxParticles”:“590”,“finishColorVarianceGreen”:“0.00”,“finishParticleSize”:“0.00”,“duration”:"-1.00",“startColorVarianceRed”:“0.00”,“finishColorRed”:0,“gravityx”:“0.00”,“maxRadiusVariance”:15.79,“finishParticleSizeVariance”:“0”,“gravityy”:44.27,“rotationEndVariance”:“90.00”,“startColorBlue”:0.2313443,“rotationStartVariance”:“0.00”,“speedVariance”:“470.60”,“radialAccelVariance”:“180.00”,“textureImageData”:"",“tangentialAccelVariance”:-0,“particleLifespanVariance”:“1.5000”,“angleVariance”:-0,“angle”:-90,“maxRadius”:142.11}

You can fix this json file by changing the string values to numbers and setting particleLifespan to >0. If you just set the particleLifespan to “0.05” or 0.05 then it does not work. The Particle Designer app seems to be inconsistent with the string thing.

Brian

And I am using a Particle Designer 2.0.5.1 (3651

I likewise was using the “Hell Fire 1” shared example.  Changing the values from strings to numbers, and having a non-zero lifespan also worked for me.  Here is my original project that was not working…

http://forums.coronalabs.com/topic/46290-example-of-exported-particle-designer-emitter-not-working/

I am using the latest Particle Designer 2.0.5.1

We have identified a problem with a few of the shared emitters in PD 2.0 which produce strings for numbers. The problem is due to some corrupt data in some shared emitters. Once we have fixed the data just running PD will cause the updates to get synched and the problem will be solved.

As soon as the DB has been updated I’ll post another comment.

Thanks

Mike

The emitter DB has been updated. When you next run PD it will sync the entire DB again as we have updated all the emitters to make sure there are no problems floating around. Once the update is complete none of the shared emitters will generate strings for output hopefully fixing the problems people have seen. It can take a couple of minutes to re-sync after which all the shared emitters will have been corrected.

Thanks

Mike