Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Last active April 22, 2024 01:34
Show Gist options
  • Save BigRoy/c37009a5399ea1172d8be5b284999578 to your computer and use it in GitHub Desktop.
Save BigRoy/c37009a5399ea1172d8be5b284999578 to your computer and use it in GitHub Desktop.
Maya USD define Usd Primitives on the stage using Python for MayaUsdProxyShape
# Tested December 21st, 2020
# This is just a test example of how one could use the USD Api against a mayaUsdProxyShape and its USD stage.
# Note: The outliner doesn't really like it when you change the stage
# so you might need to toggle shape display off and on to get it to update.
import mayaUsd
from maya import cmds
from pxr import Usd, UsdGeom
shape = cmds.ls(type="mayaUsdProxyShape", long=True)[0] # make sure to use long full paths
stage = mayaUsd.ufe.getStage('|world' + shape)
obj = UsdGeom.Xform.Define(stage, '/test_group')
@Michaelredaa
Copy link

The type name start with lower case letter, to be mayaUsdProxyShape

@BigRoy
Copy link
Author

BigRoy commented Oct 25, 2023

The type name start with lower case letter, to be mayaUsdProxyShape

Updated. Not sure why it worked for me at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment