Skip to content

Querying stage selection python #1566

Answered by kxl-adsk
daviddeacon asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @daviddeacon,

Not sure if you have any preferences in APIs, but here is one way that allows you to get to USD APIs and then list attributes with it.


from mayaUsd.lib import proxyAccessor as pa
import mayaUsd.lib as mayaUsdLib

from pxr import Usd


shapePath, sdfPath = pa.getSelectedDagAndPrim()
    
stage = mayaUsdLib.GetPrim(shapePath).GetStage()
primPath = Sdf.Path(sdfPath)
prim = stage.GetPrimAtPath(primPath)
print(prim.GetAttributes())

Cheers,
KxL

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@daviddeacon
Comment options

Answer selected by daviddeacon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants