cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Root Name Compatibility in USD Exporter

Custom Root Name Compatibility in USD Exporter

Currently, while Omniverse can open USD files with any root name (e.g., "Root"), its native convention is to use "World" as the root prim name. This can lead to inconsistencies or unexpected results when importing USD files exported from 3ds Max.

Proposal:

  • Update the USD Exporter to allow users to specify the root prim name manually for better compatibility with Omniverse.

  • Alternatively (or additionally), introduce a dropdown option to select the target platform, which would automatically set the appropriate root name based on the chosen platform (e.g., "World" for Omniverse).

Implementation Example:

local usdOptions = USDExporter.CreateOptions()
-- Set Gprim root name
usdOptions.RootPrimPath = "/" + txt_rootName.text

This would be a simple but impactful change to improve interoperability and user experience when working with Omniverse or other platforms with custom root names.

Fully Working Example:

try (
    try (
        cui.unregisterDialogBar SimpleUSDExportRollout
        destroyDialog SimpleUSDExportRollout
    ) catch()

    rollout SimpleUSDExportRollout "Simple USD Exporter" width:350 height:100
    (
        group "USD Export Settings" (
            edittext txt_rootName "Prim Path:" text:"/World" fieldWidth:260 height:20
            checkbox chk_exportSelected "Export Selected Objects Only" checked:false
        )
        
        button btn_export "Export USD" width:330 height:35 align:#center

        on btn_export pressed do
        (
            -- Prompt for save location
            local exportPath = getSaveFileName caption:"Save USD File" filename:"export.usd" types:"USD Files (*.usd)|*.usd|All Files (*.*)|*.*|"
            
            if exportPath == undefined then
            (
                messageBox "Export cancelled!" title:"Export" beep:true
                return false
            )
            
            try (
                -- Create the USD export options
                local usdOptions = USDExporter.CreateOptions()
                
                -- Set Prim path
                usdOptions.RootPrimPath = txt_rootName.text
                
                -- Basic options (setting reasonable defaults)
                usdOptions.FileFormat = #binary
                usdOptions.UpAxis = #y
                usdOptions.Meshes = true
                usdOptions.TimeMode = #current
                
                -- Perform the export based on export scope selection
                local exportSelected = chk_exportSelected.checked
                
                if exportSelected then
                (
                    if selection.count == 0 then
                    (
                        messageBox "No objects selected for export!" title:"Warning" beep:true
                        return false
                    )
                    
                    -- Export selected objects
                    USDExporter.ExportFile exportPath exportOptions:usdOptions contentSource:#selected
                )
                else
                (
                    -- Create a node list of all objects in the scene
                    local allNodes = for obj in objects collect obj
                    
                    -- Export all objects as a node list
                    USDExporter.ExportFile exportPath exportOptions:usdOptions contentSource:#nodeList nodeList:allNodes
                )
                
                messageBox "USD export completed successfully!" title:"Export Complete"
            ) catch (
                messageBox ("Export failed: " + (getCurrentException())) title:"Error" beep:true
            )
        )
    )
    
    -- Create the dialog
    createDialog SimpleUSDExportRollout 350 120 style:#(#style_titlebar, #style_sysmenu, #style_border)
    
) catch (
    messageBox ("Error: " + (getCurrentException())) title:"Script Error" beep:true
)

 

2 Comments
shawnolson
Alumni
Status changed to: Future Consideration
 
shawnolson
Alumni

Thank you for the suggestion. We have toyed with exposing the option in the UI. We'll add it to considerations for a future update.

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea