Autodesk / Autodesk/maya-usd

Saving layers/stage from MayaUsdProxyShape does not author Up Axis

Open
#3,510 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**

There currently doesn't seem to be a way via the UI to set a root layer or layer's up axis in the Layer Editor for a MayaUsdProxyShape. Maya uses the Y-axis as up axis by default I suppose (since Maya is oriented that way) however still it'd be good practice to include the up-axis in the exported layer as an authored opinion. And it should still be up to user control to set a different up axis if needed.

**Steps to reproduce**
Steps to reproduce the behavior:
1. Create a new empty Maya USD Proxy Shape.
2. Create few layers
3. Save root layer and extra layers
4. None of the layers have an authored up axis.

**Expected behavior**

Likely best to at least have the root layer default to an authored Y up axis (if created new) and better even to expose functionality to set it it via the UI (and also easily visualize the up-axis if needed)

**Attachments**

n/a

**Specs (if applicable):**
- OS & version n/a
- Maya version 2024.2
- Maya USD 0.26.0

**Additional context**

[Related conversation on USD Alliance Forum](https://forum.aousd.org/t/validating-files-for-reality-composer-pro/1039/2?u=bigroynl) with @spiffmon pointing out it's [likely lacking due to oversight](https://forum.aousd.org/t/validating-files-for-reality-composer-pro/1039/6?u=bigroynl) and thus report here, et voila.

Maya USD does author an opinion when doing export selected from regular maya geometry, but not from a maya usd proxy shape.

It might also be that the feature does exist for maya usd proxy shape but it's just missed by me where it's at.

**Workaround**

For now a temporary workaround would be to author the opinion via the USD Python API, e.g.

```python
# 1. Select a MayaUsdProxyShape or select Usd Prim via Maya UFE
# 2. Run this script to set stage root layer up axis to Y-axis
from maya import cmds
import mayaUsd
from pxr import UsdGeom

def get_selected_stage():
for path in cmds.ls(selection=True, ufeObjects=True, long=True):
proxy = path.split(",", 1)[0]
stage = mayaUsd.ufe.getStage("|world" + proxy)
if stage:
return stage
raise RuntimeError("No proxy found in selection")

stage = get_selected_stage()
axis: UsdGeom.Tokens = UsdGeom.Tokens.y
print(f"Setting up axis for '{stage.GetRootLayer().GetDisplayName()}' to {axis}")
UsdGeom.SetStageUpAxis(stage, axis)
```

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.