Versions Compared

Key

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

Scripts can handle different tasks and therefore it is necessary to distinguish a few types. Within RealFlow there are three fundamental types:

  1. Batch scripts
  2. Simulation Flow scripts (aka "events scripts")
  3. Custom node scripts

Each of these types has its own editor window. Even if the windows appear different, they have some important similarities. The visual appearance of the scripting windows is controlled by RealFlow’s preferences, where you can adjust things like font type, syntax colours and folders for storing your programs:

Menu bar > File > Preferences > Script (Windows/Linux)

Menu bar > RealFlow > Preferences > Script (OS X)

Syntax highlighting is another important similarity. Whenever RealFlow detects an instruction or known function in your code, it will be coloured. For all scripting windows, RealFlow provides auto completion. This function helps you to complete a statement with the help of a drop-down menu. It appears when parts of a command are recognized and allows you to choose the desired function.

How to Apply Scripted Nodes?

When you have a close look at the available emitters, daemons, and RealWave modifiers, you will notice options like “Custom” or “Scripted”. This means that you have the option to write your own fluid emitters, apply your own forces, and calculate your own RealWave surface displacements.  To open the appropriate editor, look for:

Emitter > Node Params > Particles > Type > Custom

Available daemons > Scripted

RealWave node > Right mouse button menu > Add Wave > Scripted 

 

These different nodes have one thing in common: the “Edit” button. By clicking on this button, a new script editor will be opened which contains specific functions for each node type – it is not possible to mix or change these functions. For example, the updateWave( vertices, initPositions ) function should not be used inside a scripted daemon’s editor and vice versa.

With the custom particle type you will be able to define your own fluid emitter and its behaviour. The function calculates the forces between the individual particles and applies them to the fluid. For this purpose there is the computeInternalForces( emitter ) function. The scripted emitter is not a type of its own, like scripted daemons. It is a special particle type that is available with any emitter. You can choose from “Gas”, “Dumb”, “Elastic”, “Liquid” – and “Custom”: 

Node Params > Particles > Type > Custom

 

This implementation is much more convenient than completely customised emitters, because you do not have to create a certain shape for the particles to be generated from. You can use any available emitter type and shape, and only change the particle type.

...