So far we have been talking about standard data types, how to build loops and call individual particles, and the way you can differentiate between options with if and else. You have also learned how to create a new vector and heard something about the “get” statement. With “get” you are able to directly access certain values and parameters, such as position, rotation, mass, friction or even particle-based properties, like density or velocity. That is an interesting feature, because you can read out the values, store them in lists, vectors or scalars, and perform different kinds of calculations with them. But that is only one half of the story, because there has to be a way to assign the new values back to the relevant object or particle. For this purpose, RealFlow offers the "set" statement. “Get” and “set” often appear together, but they are not necessarily linked. Some of the “get” statements you have seen so far are:
string getEmitter()
string getObject()
string getParameter()
vector getPosition()
vector getVelocity()
The syntax of “set” is pretty much the same as with get statements. The list of get instructions is relatively long, but fortunately the concept behind this function is rather easy and for some statements there is a counterpart with “set”:
Code Block | ||||
---|---|---|---|---|
| ||||
float getDensity() -> setDensity(float) vector getVelocity() -> setVelocity(vector) int getFps() -> setFps(int) |
Regarding the getParameter()
and setParameter()
instructions, the concept is a little bit different, though. The parameters are exactly the ones you can find under "Node Params" and written as an argument – this means that it will be enclosed within the brackets. Just prepare an easy scene with an emitter and an internal object, and open the object’s "Particle Fluid Interaction" panel. There you can find many of the object’s properties and they can easily be translated into get and set statements, because you simply have to use the property’s name.
...
A very important issue concerns vector parameters and compatibility with RealFlow 4. Whenever you have to deal with individual components of a vector, a certain notation is required. As already mentioned, a vector always conists of a trio of values:
Position = [ 5.0, 2.3, 1.6 ]
In case you want to set the values with an appropriate attribute, you have to use the following syntax:
...