Autodesk / Autodesk/maya-usd

[EMSUSD-2138] correct way to use exportMaterialCollections

Open
#4,116 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 9h
Merged PRs (30d)
17

Description

### Discussed in https://github.com/Autodesk/maya-usd/discussions/4020

Originally posted by **willDTF** November 29, 2024
I need to export USD from maya with material collection assigned to objects

reading usd-maya [documentation](https://github.com/Autodesk/maya-usd/blob/dev/lib/mayaUsd/commands/Readme.md#command-flags-1), I need exportMaterialCollections and according to this [ticket resolved](https://github.com/Autodesk/maya-usd/pull/2442), i dont need to setup materialCollectionsPath argument. so i tried :

`cmds.mayaUSDExport( exportMaterialCollections=True, file=usdFilePath, )`

this doesn't work, no collection are created. then :

`cmds.mayaUSDExport( materialCollectionsPath='/Mtl', exportMaterialCollections=True, file=usdFilePath, )`

same result. i tried many variations, without success. The only step forward i've made is with :

`cmds.mayaUSDExport( exportCollectionBasedBindings=True, exportMaterialCollections=True, file=usdFilePath, ) `
material collections is created with the addition of exportCollectionBasedBindings, but no objects are in the collections

`cmds.mayaUSDExport( exportCollectionBasedBindings=True, exportMaterialCollections=True, file=usdFilePath,materialCollectionsPath='/Mtl' )`
gives the same result that the previous, collections exist but empty

How can I properly export a USD file with material collections assigned ?

thank you

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/mayaUsd/commands/Readme.md and the discussion linked from issue 4116, then review PR 2442 for the intended exportMaterialCollections behavior. Reproduce the listed mayaUSDExport calls with objects assigned to material collections and compare whether collections and memberships appear in the exported USD. Done means the expected invocation or the export behavior is established and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.