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 five commands:
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. |
| Print help. |
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. |
| Print help. |
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. |
| Print help. |
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")
sgx_import_pose
Approximates the current rig pose as a muscle pose, for use in expressions. See Importing expression poses. This must be preceded by sgx_load_character
. Typically followed by a call to sgx_add_expression
(see below).
Syntax
MEL:
sgx_import_pose
Python:
cmds.sgx_import_pose()
Options:
Option | Description |
---|---|
| Print help. |
sgx_add_expression
Adds an expression to a particular expression group, using the current muscle pose (see Adding expressions).
Syntax
MEL:
sgx_add_expression -e expression_group
Python:
cmds.sgx_import_pose(e=expression_group)
Options:
Option | Description |
---|---|
| The expression group to which to add the new expression, in path format (e.g. |
| Print help. |
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.