Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In the second stage all the entered or default values are translated into individual variables and can now be treated as any other variable and used for further calculations. Here, the emitter is created with a series of setParameter() statements.

Code Block
themeEclipse
languagepython
linenumberstrue
standard_emitter = scene.add_PB_Emitter(emitter_types[emitter_type])
standard_emitter.setParameter("Type", particle_types[particle_type])
standard_emitter.setParameter("Resolution", resolution)
standard_emitter.setParameter("Density", density)
standard_emitter.setName(name)

if (particle_type != 2):
    standard_emitter.setParameter("Int Pressure", intpres)
    standard_emitter.setParameter("Ext Pressure", extpres)
    standard_emitter.setParameter("Viscosity", viscosity)
    standard_emitter.setParameter("Surface Tension", tension)

...

It became necessary to introduce this differentation, because elastic particles do not provide parameters, like “Int Pressure”, “Ext Pressure”, “Viscosity” and “Surface Tension”. These settings are now only changed for non-elastic fluid types. The “!=” operator means“if

if particle_type is not

...

2

With the execution of the last statement, the emitter appears under "Nodes" with all previously defined settings and the script is finished. A program like that is perfectly suited for the batch scripts window. Another idea would be to add it to RealFlow’s scripts toolbar with a nice icon. From there it can be launched with a single mouse click.

...