In the Creating a project and registering Waveform file to a Cue tutorial, we showed how to create data such as projects and Cues using CRI Atom Craft Robot.
In this tutorial, we will write a Script to change the Volume of the created Cue to preview.
This tutorial uses the project created in the Creating a project and registering Waveform file to a Cue tutorial.
If you do not have this project, go back to Creating a project and registering Waveform file to a Cue 」 tutorial.
Select "Script list..." in the Script menu to display the Script list window.
Click the New button in the Script list window to create a Script file with the name below:
Save location of Script | Script file name |
---|---|
tutorials [CRI] | tutorial03-1_edit_and_preview.py |
Double-click the created Script to open by Run the Script from the Script Editor .
In order to get an overview of the Script in the Script list window, write the Script description as follows:
Once you have written the Script description, import the following modules to work with CRI Atom Craft in your Script.
In addition to the Project Module to work with the project data of CRI Atom Craft, import the Preview Module to preview.
To edit the parameters for Cue, you need to get the object for the target Cue.
There are two primary ways to get an object:
This section will act as a review for the hierarchical structure. We will show how to use the following function to get the Cue to trace the Work Unit object by each level.
This method is useful if you understand the hierarchical structure of how to trace a Cue.
For the method to get by search, refer to the Object acquisition and list operation tutorial.
Use the following function to get the order of Work Unit, Cue Sheet folder, Cue Sheet and Cue.
Function name | Description |
---|---|
get_workunit | Gets a Work Unit |
get_cuesheet_rootfolder | Gets the Cue Sheet root folder of Work Unit |
get_child_object | Gets the child object by specifying the parent object |
Write a script to get the Cue using these functions will be as follows:
To get an object by following a hierarchical structure, you first need to get a starting object called the root object.
The root object of the object structure that contains the Cue object is a Work Unit object.
You can get a Work Unit object by specifying the "Work Unit name" in the get_workunit function.
This section gets a Work Unit by specifying "WorkUnit_Tutorial" in the Work Unit name.
Next, get the Cue Sheet root folder from Work Unit using the get_cuesheet_rootfolder function.
From the Cue Sheet root folder, the get_child_object function is used to get objects by tracing the Cue Sheet folder, Cue Sheet, Cue and hierarchy.
You can change the parameter after getting a Cue.
Use the following function to change the Cue's volume parameter.
Function name | Description |
---|---|
set_value | Sets the parameter of the specified object |
To "Change the Cue Volume to 0.5", use the following function:
The function set_value is a general-purpose function used to change parameters.
Specify "Target object information", "Parameter field name" and "Parameter value" to use the set_value function.
For details about the parameter field names that correspond to each parameter fields for each object, refer to Parameter reference .
Before running the Script, make sure that the volume of the Cue "gun1_High" is 1.0.
After the confirmation is done, press the Run button to execute the script.
You can check that the volume of the Cue "gun1_High" has changed to 0.5.
Finally, use the following function in Preview Module to perform Cue preview.
Function name | Description |
---|---|
start_playback_cue | Starts preview playback of the specified Cue |
The start_playback_cue function is a simple preview function that performs preview playback by specifying the Cue.
The Script to preview the Cue "gun1_High" whose volume was changed is as follows:
This concludes the scripting portion of this tutorial.
Save and run the Script.
If the Script runs successfully, it will change the Volume of "gun1_High" Cue to 0.5 and perform preview playback.