This quick start guide gives you an overview of RealFlow's Python scripting capabilities.
You will learn how to define and assign variables, work with different data types like integers or vectors, address RealFlow parameters, perform calculations, and loop through individual particles or scene nodes.
A long list of example scripts helps you to get started.
Available Python Commands
RealFlow provides an interface to the Python programming language. All RealFlow-specific Python commands are described in the SDK (Software Development Kit):
RealFlow > Help > Scripting Reference
There you will find a long list of classes and each class has its own, specific set of commands.
Variable Names
When you assign names to variables you should only use the following characters:
- A-Z, a-z, 0-9, and the underscore _
- Avoid special characters like ä, É, ∂, §, ß, etc.
- If you want to separate a variables name use the underscore, e.g.
gravity_strength
. - Never use blanks, colons, or dots!
- Python is case-sensitive and there is a difference between
emitter_resolution
andEmitter_Resolution
.
Leading Spaces and Indents
Python code is structured through leading spaces and indents. For obvious reasons they are the most common source of syntax errors.
This code example prints out a syntax error:
Code Block |
---|
sceneObjects = scene.getObjects()
for singleObject in sceneObjects:
scene.message(singleObject.getName()) |
And here the working code:
Code Block |
---|
sceneObjects = scene.getObjects()
for singleObject in sceneObjects:
scene.message(singleObject.getName()) |