Working with Commands
The “Commands Manager” offers the possibility of adding custom commands to RealFlow. “Custom” means that you have to create/write a graph or a Python script to describe the command's functionality. Each time the command is used, RealFlow launches your program and executes the code. Typical examples of custom commands are Python scripts for changing a scene nodes' parameters, saving images, doing initial calculations, adding objects etc.
To do this, you have access to graphs and Python editors where the source code is entered. Alternatively you can load an already existing graph or script file, and define it as a command. Graph files wear an RFG or XML extension, scripts have a RFS or PY suffix.
New commands are created/attached with the “Add” button in the “Commands Manager” window. A click on it reveals a small context menu:
There are four options to create a new custom command. Regardless of which “Add” option you are going to use, there is one thing they have in common: you always have access to the command's source code. You can open the associated code at any time and change, extend, or shorten it. C++ plugins, on the other hand, do not provide access to their source code, and are therefore treated differently. This is the reason they do not appear in the “Add” button's context menu. Once you have chosen the desired type a window is opened where you can specify the command's properties. The functions of this dialogue are explained separately here.
Adding Graphs
“Add new graph”. This option creates an empty graph that will be embedded inside RealFlow. “Embedded” means that you will not have access to this command via a XML or text editor.
The graph will be part of RealFlow unless you remove it from the “Commands Manager”.
“Add new graph from file”. In contrast to “Add new graph”, this function uses a reference to an external RFG or XML file (a reference can be seen as link). Here, the graph will not be embedded inside RealFlow and if you delete or shift the graph’s file to another location the command cannot be executed again.
To create a graph and save it to disk, you can open the “Batch Graph” editor from the “Layout” menu. From there, the graph can be saved anywhere on your hard disk. You also have the possibility of converting an embedded graph and storing it to disk: choose a graph from the list and click on “Edit”. In the appearing window you will find a button, named “Save to file and convert to reference”. The button stores the embedded graph and now you are able to exchange it with other users or use it with another copy of RealFlow (if you have a floating license, for example). In the appearing dialogue you will be used where the file should be stored, and if you want to reuse its current “Class ID”.
Adding Scripts
“Add new Python script” works exactly as its “Add new graph” counterpart, but here, a Python editor is opened. The same applies for “Add new Python script from file”. To create and store a Python script, please use the “Batch Script” editor from the “Layout” menu.
Adding C++ Plugins
If you are a plugin developer or want to use external plugins as a command you might ask yourself how this is actually done? The “Add” button does not provide any options to load and attach a plugin. The reason is that C++ plugins are treated separately, because they cannot be embedded. Plugins are stand-alone applications with compiled code and there is no possibility of editing the program.
But, a plugin can be used as a command anyway. To do this, the plugin has to be installed in the appropriate subdirectory of RealFlow's “plugin” folder:
plugins > cmds
When the plugin has been installed correctly it will appear in the “Command Manager”. To find it quickly, enter “c++” in the “Filter” field (without quotation marks). The result will show the plugin. If does not appear, please check whether it is located in the correct folder.