Python and RealFlow
This chapter starts with an obvious disadvantage: you have to learn a programming language to make use of RealFlow’s Python features. The good news is that Python strongly reminds of written English. Another reason for its good readability is the code’s structure – blanks and indents make it easier to follow a program’s listing. Unfortunately, these indents are a very common source of errors, but they are an important concept of Python.
The main question is what does scripting actually mean? Basically, a program or script is a list of instructions that’s executed to achieve a certain result. The instructions have to follow a certain directive, a logical sequence, which is called "syntax“. So what is the difference between a program and a script? A program has to be translated into a “language” that can be understood by the computer. There are two methods:
- Translating the code before execution => Compiling
- Translating the code during execution => Interpreting
Scripts are interpreted and that is the main difference between languages like C or Java and packages like Python or Perl.
Since Python was not created for or because of RealFlow, the language does not have functions or instructions for fluid or dynamics simulation by default. The programmers at Next Limit Technologies had to develop certain modules and extensions to implement RealFlow’s set of instructions into Python. This is a very complex and heavy task, because the user needs access to almost all of RealFlow’s functions and data structures. The modules can be used to manipulate emitters, create custom force fields, modify rigid body dynamics parameters, work with RealWave surfaces, and control soft body dynamics features.