mayaUsd.lib.SchemaApiAdaptor is not triggered when importing a Material (and related) prims
- Dominant language
- Wolfram Language
- Stars
- 905
- Forks
- 223
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 17
Description
**Describe the bug**
When importing a USD file containing a `Mesh` with a `Material`, any registered `SchemaApiAdaptor` is not triggered for the `Material` and related concepts.
**Steps to reproduce**
Steps to reproduce the behavior:
1. Load the `metadata_plugin.py` by unzipping `plugin.zip` and adding it to the `MAYA_MODULE_PATH`
2. Import `textured_cube.usda` from the `asset.zip`
3. Note that the adaptor logic was only called for the Mesh and not for the material or texture:

**Expected behavior**
My registered `SchemaApiAdaptor` is triggered for the `Material` and other child prims, so it would print the following as well:
```
cuba_initialShadingGroup: CanAdaptForImport
cuba_initialShadingGrouppCube: ApplySchemaForImport
cuba_initialShadingGroup | cuba_initialShadingGrouppCube1: CopyFromPrim
```
Or some variation of it.
**Attachments**
* [example_plugin.zip](https://github.com/Autodesk/maya-usd/files/11445243/example_plugin.zip): Code to show the encountered bug
* [asset.zip](https://github.com/Autodesk/maya-usd/files/11444877/asset.zip): simple cube used to illustrate the issue
**Specs (if applicable):**
- OS & version: Windows 10
- Maya version: Maya 2020, 2022, 2023
- Maya USD commit SHA: dev at b2e4736c83ce5e3f8deebc4fcf0729a8174f3d3d
**Additional context**
The context for wanting to run `SchemaApiAdaptor` instances for our `Material` prims is that we have a custom API schema that indicates the prim contains specific `AssetInfo`, we copy this data to Maya in a structured format that allows the artists to inspect it, and if necessary update it. Because the `SchemaApiAdaptor` is not triggered, the metadata is not correctly copied, which leads to issues down the line of our pipeline/workflow.
From my understanding, the `Material` is interpreted as a `shadingEngine` node, which inherits from the `entity` type so it should work, however when debugging Maya-USD, I saw that the shader network is actually read as part of the `Mesh` reader, and then later on visited again. I am not sure if this has an impact on the current behavior.
The current workaround I see is to implement logic in a chaser that explicitly retrieves any `Material` by following the links in meshes/shapes, and then finding the corresponding created Maya nodes. This leads to a lot of low-level logic that I believe should instead be provided by Maya-USD, so ideally I would not need to resort to such an approach.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.