M9. Command-line Interface
With the SGX Studio Maya plugin, you can use MEL and Python commands to create custom scripts for exporting animation generated by SGX.
The plugin has three commands:
sgx_load_character
sgx_import
sgx_export
sgx_load_character
Loads the character control file for the target character rig in the scene.
Syntax
MEL:
sgx_load_character -c character_control_file [-n target_namespace]
Python:
cmds.sgx_load_character(c=character_control_file, [n=target_namespace])
Option | Description |
---|---|
| The path of the character control file. |
| The namespace, if any, to which the character control file should be retargeted. |
sgx_import
Imports a single event file as keyframed animation on the character rig. Equivalent to single import in the plugin GUI. This must be preceded by sgx_load_character
.
Syntax
MEL:
sgx_import -i event_file [-a]
Python:
cmds.sgx_import(i=event_file, a={0,1})
Option | Description |
---|---|
| The event to import. |
| Import audio. |
sgx_export
Converts a batch of event files into desired format(s). Equivalent to batch export in the plugin GUI. This must be preceded by sgx_load_character
.
Syntax
MEL:
sgx_export -i input_path -o output_directory -f output_formats [-a] [-b] [-s] [-p playblast_options]
Python:
cmds.sgx_export(i=input_directory, o=output_directory, f=output_formats, a={0,1}, b={0,1}, s={0,1}, p=playblast_options)
Options:
Option | Description |
---|---|
| The input path, which may be either: a directory containing the input event files, or a file containing a list of event file paths. |
| The path of the directory to which the exported output should be saved. |
| Comma-separated list of export formats including one or more of |
| Playblast options in a comma-separated list: |
| Export audio. |
| Bake animation from higher-level controls to deformers (joints, blendshapes, etc.). Relevant only for FBX export. |
| Only export selected elements of the scene. |
Example
Here is an example of the batch export command using all of the options:
MEL:
sgx_export -i "C:/my_input" -o "C:/my_output" -f "maya,playblast" -a -b -s -p "600,800,avi,none,persp"
Python:
cmds.sgx_export(i="C:/my_input", o="C:/my_output", f="maya,avi", a=1, b=1, s=1, p="600,800,avi,none,persp")
Headless use
All plugin commands may be passed to Maya in headless mode. See Maya’s documentation on running Maya on the command line. Note that any quotes or forward slashes in the command string must be escaped in the command string passed to Maya.