`cmds.mayaUSDExport` + `stripNamespace=True` still writes a `defaultPrim` with a namespace
- Dominant language
- Wolfram Language
- Stars
- 905
- Forks
- 223
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 17
Description
**Describe the bug**
`cmds.mayaUSDExport(..., stripNamespace=True, ...)` is supposed to strip namespaces off of Prims, and it does, but it doesn't strip the namespace off of `defaultPrim`. You can literally have a layer that looks like this:
```usd
#usda 1.0
(
defaultPrim = "some_namespace:foo"
)
def Mesh "foo"
{
}
```
The `defaultPrim` points to an invalid root Prim. It should be `defaultPrim = "foo"`
**Steps to reproduce**
```python
from maya import cmds
from pxr import Sdf
cmds.file(newFile=True, force=True)
namespace = "my_namespace"
if not cmds.namespace(exists=namespace):
cmds.namespace(add=namespace)
node, _ = cmds.polyCube()
new_node = f"{namespace}:{node}"
cmds.rename(node, new_node)
node = new_node
path = r"C:\Users\my_user\temp\fake_layer.usda"
cmds.select(node, replace=True)
# data = {"selection": True, "stripNamespaces": True, "file": path, "defaultPrim": "blah"} # NOTE: This writes without a namespace, which is correct
data = {"selection": True, "stripNamespaces": True, "file": path} # NOTE: This creates an invalid export
cmds.mayaUSDExport(**data)
layer = Sdf.Layer.FindOrOpen(path)
print(layer.defaultPrim) # Prints "my_namespace:pCube1". It should print "pCube1"
```
- Run the code above and observe the printed value. It should be `"pCube1"` but it's `"my_namespace:pCube1"` instead.
**Expected behavior**
- `layer.defaultPrim` should say `"my_namespace:pCube1"`
**Specs (if applicable):**
- OS & version: Windows 10
- Maya version: Maya 2025
- Maya USD commit SHA **I don't know how to query this**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.