Scripting#

USD Python Binding#

USD Python Bindings are available with the installation of the 3ds Max Omniverse Connector.

3DS Max Plugin Script APIs#

Currently we only support 3ds Max ms script for accessing the 3ds Max Omniverse Connector.

Connect to server#

Check Connection Status#

nvOmniverse.IsConnected()

Set User Name and Log in#

To make sure that you log in to right server you can call the following script command step by step.

Set User Name#

nvOmniverse.UserName = "tester"

Log In#

nvOmniverse.ServerUrl = "my-server:1234"

Disconnect#

nvOmniverse.Disconnect()

Save Current Logging Information#

nvOmniSaveInitSettings()

Connect to Server#

nvOmniverse.Connect()

Export Usd#

If you want to export the USD to OMNIVERSE®, you can call script command:

nvOmniverse.CreateURL "/Users/aatest/cone.usd"

Exporting Options#

We have script API SetOptionVar and GetOptionVar to set and read options. Options are not only used for exporting. They can also be used in other cases. Both option and value are string type and case sensitive. Even if the value is “3” or “true”, they are strings, not integer or bool! And only string “true” is treated as True. Other values will be treated as False.

Setting up Export Mode Types

nvOmniverse.SetOptionVar "export_mode"   "1"

Note

“1” is for Static Prop.

Script commands for setting the export animation options.

--nvomniverse.SetOptionVar "use_animation"
--nvomniverse.SetOptionVar "ani_start_frame"
--nvomniverse.SetOptionVar "ani_end_frame"

Check Current Value#

nvOmniverse.GetOptionVar "export_mode"

Set Export Collection Types#

nvOmniverse.SetOptionVar "selection_mode"

Note

“1” is for Export All; “2” for Export Selected; “3” for Export Visible.

Include MDL checkbox#

nvOmniverse.SetOptionVar "include_mdl"  "true"

Note

“true” is string and case sensitive.

Copy MDL option drop-down list#

nvOmniverse.SetOptionVar "mdl_copy_option" "1"

Note

“1” for Default. “2” for Include Dependencies. “3” for CSV Mapping File.

Include USD Preview Surface#

nvOmniverse.SetOptionVar "include_usd_preview_surface" "true"

Camera#

nvOmniverse.SetOptionVar "include_camera"  "true"

Light Option#

nvOmniverse.SetOptionVar "include_light" "true"

Instance Option#

nvOmniverse.SetOptionVar "export_instances"  "true"

Set Axis option#

nvOmniverse.SetOptionVar "up_axis"   "y"

Note

“z” is for Z Up and “y” is Y Up. Case sensitive.

Enable Batch Export (Former Split Into Files Option)#

nvOmniverse.SetOptionVar "enable_split_files"

Set Batch Export Mode#

nvomniverse.SetOptionVar "split_files_option" 1

Note

“1” is for References and “2” is for Payloads.

Also Save 3DS Max#

nvOmniverse.SetOptionVar "upload_max_file" "true"

Import Usd#

If you want to import one Usd on OMNIVERSE®, you can call this script:

nvOmniverse.OpenURL "/Users/aatest/cone.usd"

Settings Panel Options#

Enable Cache#

nvOmniverse.SetOptionVar "enable_cache" "true"

Auto Sign In on Startup#

nvOmniverse.SetOptionVar "auto_sign_in_on_start"

Echo OMNIVERSE® Feedback in Script Editor#

nvOmniverse.SetOptionVar "echo_feedback"

Enable Renaming for Invalid Names and Duplicated Names.#

nvOmniverse.SetOptionVar "enable_renaming"

Export Paths#

nvOmniverse.SetOptionVar "export_objects_subfolder" "props"

Material Mapping File#

nvOmniverse.SetOptionVar "export_material_mapping_file_path" "path to csv file"

Embedded MDL option#

nvomniverse.SetOptionVar "omniverse_embed_materials" "true"

Destination Template Path#

nvOmniverse.SetOptionVar "export_dest_mdl_template_path" "/Users/aatest/ani"

Silent Warning Dialogs#

nvomniverse.EnableMessageBox = false