Creating Qt Scripts
Using the Script Editor, you can create Qt scripts for Harmony.
For details about the scripting nodes,
You can also find the help files in the Script Editor view. From the Script Editor menu, select Help > Scripting Interface Documentation.
When you create a new scene, the TB_sceneCreated
script automatically sets the scene length to 60 frames and adds one of each of the following nodes: drawing element, composite, display and write.
You can find the script in the Script Editor window.
You can customize this script to fit your current project needs. This way, you can set the default scene length to any number of frames you want, or even decide which types of elements and nodes you want to be in your scene when you create it.
- From the top menu, select Windows > Script Editor.
The Script Editor view opens listing all the available JavaScript files.
- Do one o the folowing:
- From the Script Editor menu, select File > New Script
- In the Script Editor toolbar, click the New Script button.
- From the top menu, select Windows > Toolbars > Script Editor.
The New Script dialog box appears.
- Enter a name and click on OK.
- When working with Harmony Server, you must set the location where the script will be saved, either User level, Global level, Environment level, or Job level.
When working with Harmony Stand Alone, your custom scripts and default scripts are stored in:
- Windows:
- Toon Boom Harmony Premium: C:\Users\[user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Harmony\1400-scripts
- Toon Boom Harmony Advanced: C:\Users\[user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Advanced\1400-scripts
- Toon Boom Harmony Essentials: C:\Users[\user_name]\AppData\Roaming\Toon Boom Animation\Toon Boom Essentials\1400-scripts
- Mac OS X:
- Toon Boom Harmony Premium: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Harmony/1400-scripts
- Toon Boom Harmony Advanced: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Advanced/1400-scripts
- Toon Boom Harmony Essentials: /Users/[user_name]/Library/Preferences/Toon Boom Animation/Toon Boom Essentials/1400-scripts
On Mac OS X, the Library folder is a hidden folder. To display the display the folder, told down the Alt key.
- Linux:
- /home/[user_name]/Toon Boom Animation/Toon Boom Harmony/1400-scripts/
- /home/[user_name]/Toon Boom Animation/Toon Boom StageAdvanced/1400-scripts/
When working with Harmony Server, your custom scripts are stored in:
- Global: [Server_Name] > USA_DB > scripts
- Environment: [Server_Name] > USA_DB > environments > [environment_name]
- Job: [Server_Name] > USA_DB > jobs > [job name]
- User: [Server_Name] > USA_DB > users > [user_name] > stage > 1400-scripts
The name of your script appears in the File column of the Script Editor view.
- Click in the right side of the Script Editor and start writing your script. Try typing in the following script:
function add3dPathCol()
{
column.add(“ColumnName”, “3DPATH”);
}
For a tutorial on coding in JavaScript, refer to https://www.w3schools.com/js
For a detailed Harmony script interface documentation, refer to Harmony Script Interface Documentation
You can also find the help files in the Script Editor view. In the Script Editor menu, select Help > Scripting Interface Documentation.
- To check your syntax, click Verify.
A window opens with syntax information.
- To test your script, select the script you want to run from the File column.
- Do one of the following:
‣ | From the Script Editor toolbar, click the Run button. |
‣ | From the Script Editor menu, select Play/Debug > Run. |
A window opens to ask you for the target function to run. In the window, select the function you want to execute.
To avoid selecting the function every time you want to run your script, you can set a target function. In the Script Editor toolbar, click the Set Target button or select Play/Debug > Set Target from the Script Editor menu. In the Function column, select the function to target and press OK.
‣ | To stop the execution of your script, click the Stop Execution button. |
‣ | You may receive this message: Only functions that have been saved or are explicitly called will be executed. |
This usually occurs if you did not select the function you wanted to run from the File column before running the script. When this happens, click Save and run your script again.
‣ | You may also see this message on the right side of the Script Editor: |
This is because the software jumped to the <<Sandbox>> item in the Function column. The <<Sandbox>> is provided to test scripts without saving them. Simply click on your newly created script and run it again.