Accessing RealFlow Nodes

Each node inside RealFlow, regardless of whether it is imported or native, can be accessed with scripting. The nodes are stored in variables to make their attributes accessible. That is the only way in which parameters and settings can be altered using scripting. From such an object, stored in a variable, it is possible to call selected attributes. These attributes are the ones you can find under a node’s "Node Params" window. It is important to bear in mind that all objects and properties follow a certain hierarchy that is part of Python’s notation. The highest ranking element is the RealFlow scene. Once an object has been added to a scene, it is considered as a part of it, for example a circle emitter. The next thing is that each node has an individual name - in this case it would be "Circle01". With a so-called “get” method we can access the emitter:

emitter = scene.get_PB_Emitter("Circle01")

 

This could be read as: “Get the Circle01 node from the current scene and store it in the emitter variable”. In this case, the emitter variable is a scalar, because there is only one value stored. RealFlow provides special get methods for each basic node. Here are some of them:

object_node = scene.getObject("object_name") 
daemon_node = scene.getDaemon("daemon_name") 
camera_node = scene.getCamera("camera_name")
mesh_node   = scene.getParticleMesh("mesh_name")
wave_node   = scene.getRealwave("wave_name")
domain_node = scene.get_HY_GridDomain("domain_name")
mist_node   = scene.get_HY_Mist("mist_name") 

 

The names are simply the particular names from the node window. If the name inside the brackets and the affected node name are not identical, a syntax error will occur. Please note that they always have to stand within quotation marks, unless you are using a variable to define the name:

object_name = "Vase01"
object_node = scene.getObject(object_name)

or

object_node = scene.getObject("Vase01")

 

It is not possible to get emitters with getObject() or meshes with getRealwave(), and so on. Each method is restricted to a certain object type. From the notation above you can see that the emitter “Circle01” is part of the scene. Following this idea, one could also say that the parameters are part of the emitter, for example position:

emitter  = scene.get_PB_Emitter("Circle01")
position = emitter.get_PB_Parameter("Position")

 

With this construction you can access the position of the object that is stored under emitter: “Circle01”. If you take a look at the position parameter, you can see that it consists of three coordinates X, Y and Z. A variable with three coordinates or scalars is called a vector. If you want to read out or manipulate the individual values of the position vector, you have to follow the known concept:

emitter    = scene.get_PB_Emitter("Circle01")
position   = emitter.getParameter("Position")
position_x = position.getX()
position_y = position.getY()
position_z = position.getZ()

 

Now the X, Y, and Z position values are stored in individual variables and they are ready to be used for further calculations and manipulation. This concept is valid for all the other node types in RealFlow, e.g. cameras or objects.