Skip to content

Get prim's world transform via python? #2425

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

You must be logged in to vote

Always the way, post the question then end up working it out myself. So will answer my own question for others to find.

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

from pxr import Usd, Sdf, UsdGeom
from mayaUsd import schemas as mayaUsdSchemas


import mayaUsd.ufe
import mayaUsd.lib
import ufe

def getPrimXForm():
    stagePath, sdfPath = pa.getSelectedDagAndPrim()
        
    print ("shapePath = "+stagePath)
    print ("sdfPath = "+sdfPath)
    
    stage = mayaUsdLib.GetPrim(stagePath).GetStage()
        
    primPath = Sdf.Path(sdfPath)
    print (primPath)

    prim = stage.GetPrimAtPath(primPath)
    Xformable = UsdGeom.Xformable(prim)

    xform = …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
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
1 participant