Samples

This section describes the "CRI Atom Craft Robot" sample script functionalities included in this CRI Atom Craft package.

Sample type

Sample name Sample file name Whether to use user variables
Check for duplicate Cue IDs check_overlap_cueid.py No
Check for duplicate Cue names check_overlap_cuename.py No
Copy and paste AISAC graph copy_and_paste_aisac.py Yes
Copy & paste the Automation copy_and_paste_automation.py Yes
Create a Switch Cue from Selector. create_switch_type_cue_from_selector.py Yes
Enumerates the audio files used in the Cue Sheet listup_audiofiles_in_cuesheet.py No
Enumerates the Cues with are not part of a specific Category listup_category_not_registered_cue.py Yes
Enumerates the Materials which exist only in one Material folder listup_files_exist_oneside_folder.py No
Remove the specified Category from selected Cues remove_category.py Yes
Replace Category in selected Cues replace_category.py Yes
Search for odd Materials search_different_materials.py Yes


Sample execution

All sample scripts are for local execution and are executed by the following methods:

  • Select from "samples [CRI]" folder in the "Script list" window to run
  • Select and run from "Script" menu > "samples [CRI]" submenu

    Running the sample

All sample scripts are for local execution and can be executed in the following way:

  • In the "Script List" window, select from the "samples [CRI]" folder and run
  • Select from the "samples [CRI]" submenu of the "Script" menu and run it.
criatom_tools_atomcraft_api_samples_run.png


The script displayed with icons in the script list and menu use the user variable function for the Script Editor.
To make the script work properly, you need to set the user variables using the Script Editor.
For details about settings, refer to the description of each sample script.

Location of sample files

Sample script file is in the following folder:

  • macOS (for Ver.3.44 series)
    ~/Documents/CRIWARE/CriAtomCraft/samples/robot/344/local/Python
    (The above number next to "robot" is the version number of the tools in macOS.)
  • Windows
    cri\tools\criatomex_v3\win\samples\robot\local\Python

Use the modified sample code if necessary.
When modifying the sample code, it is recommended to copy the specified user Script search path.
The reasons are as follows:

  • macOS: The contents of the sample Script folder are overwritten when updating the sub-minor version of the tool (zz part of x.yy.zz).
  • Windows: Because the sample Script folder is directly under the tool, it may be overwritten by mistake when updating the tool or may be time-consuming when sharing settings between multiple tools.



Check for duplicate Cue IDs

check_overlap_cueid.py

This sample script checks if there are Cues with duplicate Cue IDs in the Cue Sheet selected in the project tree.
If multiple Cue Sheets are selected, checks for duplicates will only be applied to the first Cue Sheet.
If duplicates are found, the information for the corresponding Cue is output to the Script log window and the csv file.

Functions used in the sample

Function name Description Module
get_selected_objects Gets the object selected in the project tree Project Module
find_objects Performs recursive search to get the matched object in list format Project Module
get_value Gets the value of the specified object Project Module
get_object_path Gets the path string of the object Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module
get_child_objects Gets multiple child objects by specifying the parent object Project Module



Check for duplicate Cue names

check_overlap_cuename.py

This sample script checks if there are Cues with duplicate Cue names in the Cue Sheet selected in the project tree.
If multiple Cue Sheets are selected, only the first Cue Sheet will be checked for duplicates.
If duplicates are found, the information for the corresponding Cue is output to the Script log window and the csv file.

Functions used in the sample

Function name Description Module
get_selected_objects Gets the object selected in the project tree Project Module
find_objects Performs recursive search to get the matched object in list format Project Module
get_value Gets the value of the specified object Project Module
get_object_path Gets the path string of the object Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module
get_child_objects Gets multiple child objects by specifying the parent object Project Module



Copy and paste AISAC graph

copy_and_paste_aisac.py

This sample Script pastes the AISAC graph from the source AISAC into the destination AISAC.
Since user variables are used in the Script Editor, please set the following user variables and click the "Apply" button before executing.

User Variables Description Variable Types
SOURCE_AISAC Copy source AISAC object object
DEST_SEQUENCE Paste destination AISAC object object
AUTOMATION_GRAPH_TYPE AISAC graph type to copy and paste string

If the same type of graph exists in the paste destination AISAC, it will not be overwritten by the paste process.

Functions used in the sample

Function name Description Module
get_aisac_graph Gets the AISAC graph Project Module
get_value Gets the value of the specified object Project Module
copy_object Copies the object Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Copy & paste the Automation

copy_and_paste_automation.py

This sample script pastes the Automation of the copy source Sequence object to the paste destination Sequence object.
Since user variables are used in the Script Editor, please set the following user variables and click the "Apply" button before executing.

User Variables Description Variable Types
SOURCE_SEQUENCE Copy source Sequence object (Cue or Track) object
DEST_AISAC Paste destination Sequence object (Cue or Track) object
AISAC_GRAPH_TYPE Automation type to copy and paste string

If the same type of graph exists in the paste destination Sequence object, it will not be overwritten by the paste process.

Functions used in the sample

Function name Description Module
get_automation Gets an Automation Project Module
get_value Gets the value of the specified object Project Module
copy_object Copies the object Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Create a Switch Cue from Selector.

create_switch_type_cue_from_selector.py

This sample Script creates a Switch Cue and applies a Selector Label to the Track using the highlighted Selector.
Since user variables are used in the Script Editor, please set the following user variables and click the "Apply" button before executing.

User Variables Description Variable Types
SELECTOR Selector set to the Cue object
CUE_NAME Cue name to create string
MATERIAL_FOLDER (Optional) Material folder used for registering waveform regions object

Select where the Cues will be created (Cue Sheet or Cue folder), such as in the project tree. If you specify a Material folder, the Material whose name most closely matches the label name is registered as the waveform region.

If a Cue with the same name already exists in the Cue creation destination, it will not be overwritten by the new Cue.
Material search only performed under the specified folder.

Functions used in the sample

Function name Description Module
get_selected_objects Gets the objects selected, for example in the project tree Project Module
get_child_objects Gets multiple child objects by specifying the parent object Project Module
get_value Gets the value of the specified object Project Module
create_object Creates an object by specifying a type Project Module
set_value Sets the parameter of the specified object Project Module
create_waveform_region Creates a waveform region Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Enumerates the audio files used in the Cue Sheet

listup_audiofiles_in_cuesheet.py

This sample script enumerates the audio files used in the selected Cue Sheet (for example in the project tree).
It outputs the names and file paths of the audio files in the script log window.

Functions used in the sample

Function name Description Module
find_objects Recursively searches and gets all objects that match the condition Project Module
get_selected_objects Gets the selected objects, for example in the project tree Project Module
get_value Gets the value of the specified object Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Enumerates the Cues with are not part of a specific Category

listup_category_not_registered_cue.py

This sample script finds which ones of the selected Cues (for example in the project tree) are not part of the specified category.
It outputs the name of these Cues on the script log window.
Since the user variables are used in the Script Editor, please set these user variables and click the "Apply" button before executing.

User Variable Description Variable Types
SEARCH_CATEGORY Category to search object

Functions used in the sample

Function name Description Module
get_selected_objects Gets the objects selected, for example in the project tree Project Module
get_value Gets the value of the specified object Project Module
get_categories Gets the categories assigned to the Cue Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Enumerates the Materials which exist only in one Material folder

listup_files_exist_oneside_folder.py

This sample script enumerates the Materials which exist only in one of the two Material folders selected (for example in the project tree).
It uses the relative path from the selected folder to determine if the Materials are the same.
Select the two Material folders to compare before running the script.

Functions used in the sample

Function name Description Module
find_objects Recursively searches and gets all objects that match the condition Project Module
get_selected_objects Gets the selected objects, for example in the project tree Project Module
get_object_path Gets the path of the object as a string Project Module
get_value Gets the value of the specified object Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Remove the specified Category from selected Cues

remove_category.py

This script removes the specified Category from the Cues selected, for example in the project tree.
Since user variables are used in the Script Editor, please set the following user variables and click the "Apply" button before executing.

User Variables Description Variable Types
REMOVE_CATEGORY Category to delete object

Functions used in the sample

Function name Description Module
get_selected_objects Gets the objects selected in the project tree Project Module
get_value Gets the value of the selected object Project Module
get_categories Gets the categories assigned to the Cue Project Module
set_categories Assign categories to the Cue Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Replace Category in selected Cues

replace_category.py

This script replaces one of the Categories of the Cue selected, for example in the project tree.
Since user variables are used in the Script Editor, please set the following user variables and click the "Apply" button before executing.

User Variables Description Variable Types
REPLACE_FROM Replace source Category object
REPLACE_TO Replace destination Category object

Functions used in the sample

Function name Description Module
get_selected_objects Gets the objects selected in the project tree Project Module
get_value Gets the value of the specified object Project Module
get_categories Gets the categories assigned to the Cue Project Module
set_categories Assign categories to the Cue Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Search for odd Materials

search_different_materials.py

This sample script search for "odd" Materials under the selected Material folders in the project tree.
It will output the names of the Materials which are considered as "odd" to the Script log window.

A Material is considered as "odd" if its settings are different from the majority of the other Materials.
More specifically, if the proportion of Materials with the same settings is smaller than BORDER_RATIO, the Material(s) will be considered as "odd".
Judgement is based on the following criteria:

Since the user variable function for the Script Editor is used, please set the following items as user variables and click the "Apply" button before executing.

User Variables Description Variable Types
BORDER_RATIO The ratio used to determine "oddness" number

Functions used in the sample

Function name Description Module
find_objects Recursively searches and gets all objects that match the condition Project Module
get_selected_objects Gets the objects selected in the project tree Project Module
get_actual_value Gets the current parameter value of the specified object. Project Module
get_value Gets the parameter value of the specified object Project Module
warning Outputs the warning log Debug Module
log Outputs the standard log Debug Module



Start profiler log collection (remote execution)

start_profiler_logging.py

This sample script will make an in-game connection to the target application during remote execution and collect profiler logs.

In addition, the acquired logs are output in CSV format.

Functions used in the sample

Function Name Description Module
open_project Opens the specified project. Project Module
start_ingame_preview Start an in-game connection to a specified IP address Preview Module
stop_ingame_preview End the in-game connection Preview Module
start_profiler_logging Start profiling. Profiler module
stop_profiler_logging Stops profiling. Profiler module
export_alllog_to_csv Export all profiled logs in CSV format Profiler module
initialize Initializes the communication function Connection Module
finalize Terminate the communication function Connection Module
connect Connect to CRI Atom Craft Connection Module
disconnect Disconnect from CRI Atom Craft Connection Module
warning Outputs warning logs Debug Module
log Outputs standard logs Debug Module