All of RealFlow's available node parameters are accessible through scripting – values can be read and set. The concept behind parameter manipulation is the same for all node types:
- Specify, the node you want to change.
- To read a value, get the parameter through its name.
- To set a value, address the parameter through its name and specify the new value.
In pseudo-code, the common instructions are:
Code Block |
---|
sceneNode = scene.getNodeType("node_name")
sceneNode.setParameter("parameter_name")
sceneNode.setParameter("parameter_name", value) |
getNodeType()
has to be substituted through a node-specific command, e.g.get_DY_Domain("DY_"), getObject("Sphere01"), getDaemon("Drag_Force01")
, etc.parameter_name
is the name of the parameter as shown in the node's "Node Params" panel, for example"Strength", "Visibility", "Dynamics", "Velocity"
, and so on.value
depends on the node's parameter type. Values can vectors, integers, strings, floats, or Booleans (True
orFalse
). Strings have to be written in quotes, e.g."Active rigid body"
Examples:
Code Block |
---|
gravityDaemon = scene.getDaemon("Gravity01")
capsuleObject = scene.getObject("Capsule01")
hybridoEmitter = scene.get_HY_Emitter("HY_Emitter01")
sceneCamera = scene.getCamera("SceneCamera01")
gravityDaemon.setParameter("Strength", 3.6) # Float
capsuleObject.setParameter("Dynamics", "Soft body") # String
hybridoEmitter.setParameter("Visibility", False) # Boolean
sceneCamera.setParameter("Width", 1280) # Integer |
With loops it is possible to perform changes on parameters for several nodes at once:
Code Block |
---|
sceneObjects = scene.getObjects()
for singleObject in sceneObjects:
singleObject.setParameter("Color", Vector.new(255, 0, 0))
singleObject.setParameter("Dynamics", "Active rigid body")
singleObject.setParameter("Mass", 10.75)
singleObject.setParameter("Cell size", 0.25) |