maya-usd
maya-usd copied to clipboard
Import fails silently when not specifying type on crate version 0.8.0
When importing a crate file with a version specifier greater than 0.7.0, the contents of the file are not imported and no error reported or exception raised. (Tested in maya 2024.1 / maya-usd 25.0 and 2022.5 / maya-usd 25.0)
Steps to reproduce
- Unzip the included example somewhere on the test host
- Launch Maya, ensure maya-usd plugin is loaded
- Execute the python
cmds.file("/path/to/example/crate_0_8_0.usdc", i=True)
(replacing the path with the location of the unzipped example files) - Note that the contents of the scene are unchanged.
Expected behavior
- Execute the python
cmds.file("/path/to/example/crate_0_7_0.usdc", i=True)
(replacing the path with the location of the unzipped example files) - Note that the
/World/Cube
prim is imported, and you can see the cube if you frame it in the viewport. - Note that the two crate files tested with above differ only at byte 10 (the minor version byte in the header), and are otherwise identical:
>fc.exe /b crate_0_7_0.usdc crate_0_8_0.usdc
Comparing files crate_0_7_0.usdc and crate_0_8_0.usdc
00000009: 07 08
crate_0_8_0.usdc opens as expected in usdview:
Note that crate 0.8.0 was introduced in USD 19.03.
Attachments crate_examples.zip
Specs: All repros on Windows 10 19045.3570 Repro'd in:
- Maya 2022 / maya-usd 25.0 (4b49448)
- Maya 2024 / maya-usd 25.0 (4b49448)
I am able to load those examples using the latest versions of Maya (2022.5 and 2024.2) using maya-usd 0.26.0. Possibly the USD versions were updated and / or patched to support crate 0.9.0 now, @santosg87 ?
I wanted to update this with some additional findings -- after chatting with @gelshoffNV, I think the reason he was not seeing the same behavior is because he was doing this through the UI and specifying USD Import
in the Files of Type
dropdown.
With this clue, I discovered that I'm able to successfully import/reference the previously failing USD files by adding the kwarg type="USD Import"
to my cmds.file()
calls. While this is a viable workaround for our team, I still believe that there's an unexpected behavior here. I'm wondering if this relates to something funky in the MPxFileTranslator
implementation, or related to this previous issue? (Note that I am able to repro in 2024.1)
It is very surprising to me that the crate version affects the behavior, since as far as I can tell UsdMayaImportTranslator::identifyFile()
makes no attempt to inspect the contents of the file, only the extension.
During debugging I also discovered that the UI and cmds.file()
behave differently, and that the file extension and crate version both affect the outcome. See the matrix below showing the behavior I observed in Maya 2022.5 / maya-usd 0.26.0
Note again that adding the
type="USD Import"
kwarg or selecting USD Import
in the Files or Type
dropdown ensures successful import/reference in all cases.