Autodesk / Autodesk/maya-usd

Importing and exporting a material / shader does not respect "Include Namespaces" turned off

Open
#3,088 1 comment 1 reaction 1 assignee Claimed by @santosg87 View on GitHub
bug
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 9h
Merged PRs (30d)
17

Description

**Describe the bug**

When a USD file is imported in a namespace, and then exported again with "Include Namespaces" turned off, the namespace is still included in the name of the exported shader.

**Steps to reproduce**

Steps to reproduce the behavior:

1. Create the input file or open the `cube_namespace.usda` in the attached zip file:
1. Open a new scene
2. Create a simple `polyCube`
3. "Export all..." with "USD Export" with default settings:

![image](https://github.com/Autodesk/maya-usd/assets/5596079/81e27c9e-493b-4287-89d9-49fd04fe8374)

4. Rename the `Material` prim to `MyShadingGroup` (so we can easily track it)
2. Create a new empty scene
3. Import the usda file with default settings in a new namespace:

![image](https://github.com/Autodesk/maya-usd/assets/5596079/89b96176-4848-44f5-b132-e4eaff3f294b)

4. Note that the shader is in the expected namespace:


![image](https://github.com/Autodesk/maya-usd/assets/5596079/61976573-b395-4603-95ad-b1fb3a5c3f53)

6. Export the scene again with "Include Namespaces" turned off:

![image](https://github.com/Autodesk/maya-usd/assets/5596079/eb0fa879-0391-4264-a136-2190f45b142d)

7. Inspect the created USDA file and note that the namespace is included:

```usd
def Scope "mtl"
{
def Material "test_MyShadingGroup"
{
token outputs:surface.connect =

def Shader "test_MyShadingGroup_standardSurface"
{
uniform token info:id = "UsdPreviewSurface"
float inputs:clearcoat = 0
float inputs:clearcoatRoughness = 0.1
color3f inputs:diffuseColor = (0.4, 0.4, 0.4)
color3f inputs:emissiveColor = (0, 0, 0)
float inputs:ior = 1.5
float inputs:metallic = 0
normal3f inputs:normal = (1, 1, 1)
float inputs:roughness = 0.4
color3f inputs:specularColor = (1, 1, 1)
token outputs:displacement
token outputs:surface
}
}
}
```

Note the incorrect name with the prepended `test_`.

**Expected behavior**

The name should not be prepended with the namespace of a material/shader when it is exported with "Include Namespaces" turned off.

**Attachments**

* [cube_namespace.zip](https://github.com/Autodesk/maya-usd/files/11478834/cube_namespace.zip): The input and output USD files.

**Specs (if applicable):**

* OS & version Windows 10
* Maya version Maya 2022
* Maya USD commit v0.23.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.