Unable to move `mtl` materials into group above a sublayer or reference
- Dominant language
- Wolfram Language
- Stars
- 905
- Forks
- 223
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 17
Description
**Describe the bug**
I'd like to set up an asset building workflow where in a layer I can apply look overrides and make sure the materials end up in my asset hierarchy `/{asset}/mtl` however when creating materials they default to `/mtl`
However, I can't seem to move those _into_ the correct place in the hierarchy due to:
Loading this `cube.usda`:
```
#usda 1.0
(
defaultPrim = "asset"
metersPerUnit = 0.01
upAxis = "Y"
)
def Xform "asset" (
kind = "component"
)
{
def Scope "geo"
{
def Mesh "cube"
{
uniform bool doubleSided = 1
float3[] extent = [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4]
point3f[] points = [(-0.5, -0.5, 0.5), (0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (-0.5, -0.5, -0.5), (0.5, -0.5, -0.5)]
}
}
}
```
As a sublayer gives me:

Assigning a material then gives me:

The material I created and assigned in my look layer that is above the loaded model:

I cannot seem to reparent the `/mtl` to `/asset/mtl` to move into the correct place.
However, I can create materials just fine directly in `/asset` or `/asset/mtl` if I try so manually.
Additionally - I can also reparent the `/mtl/UsdPreviewSurface1` into another path that is not from a sublayer _or reference_ but as soon as I try to put it on there Maya is not happy and gives me:
```
// Error: line 1: Cannot reparent [mtl]. It would orphan opinions on the layer [cube.usda].
```
Which seems weird since that file doesn't have opinions there - of course the material itself has `over` bindings to `asset/geo/cube` but still removing the assignment and then moving it also doesn't work.
However, if I create the `asset/mtl/UsdPreviewSurface1` and then **after** add the model layer I can assign it fine and it's at the correct location so it is totally feasible to from that layer in USD data define opinions there. Unfortunately there's just something in Maya USD disallowing making those edits.
**Steps to reproduce**
Steps to reproduce the behavior:
1. Sublayer or reference a model file into an asset layer
2. In a new layer write materials into the asset's location (e.g. `/asset/mtl`) - I can't make this work
**Expected behavior**
It should be more trivial to allow reparenting or moving it around into the location I want it to be.
Also, bonus points if I can force by default the materials to go there for this USD Stage so I don't even need to reparent and that artists need less 'fixing' this.
Or better question; what is a good approach to load an `asset.usd` or `model.usd` and start contributing my look opinions into the default prim (e.g. `/root` or `/{asset_name}` depending on the USD asset structure) so the asset can be referenced elsewhere? (which requires referencing the (default) prim into another prim; and thus `/mtl` should be encapsulated within it, right?)
**Attachments**
If applicable, add screenshots, sample files, etc to help explain your problem.
**Specs (if applicable):**
- OS & version: Windows 10
- Maya version: Maya 2024.1
- Maya USD release: 0.25.0
**Additional context**
I also tried muting the `cube.usda` layer and then moving the materials, but unfortunately that's not allowed either:
```
// Warning: line 1: The position of some objects may have moved due to non-transformable objects being reparented.
// Warning: Cannot reparent prim "/Scope1" because there is at least one muted layer.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.