Skip to content

multiple prims selected, getting their prim paths #3438

Closed Answered by sanders3d
sanders3d asked this question in General
Discussion options

You must be logged in to vote

So I finished the tool. It was horrible to find information or docs how to do it. I'm sharing it here and hope that someone can make my tool a bit nicer and with better ( read: pretty ) code.

import mayaUsd
import ufe

def replace_ref():
    #replaces references with the last selected reference
    selection = ufe.GlobalSelection.get()
    rawItem = selection.back().getRawAddress()
    prim = mayaUsd.ufe.getPrimFromRawItem(rawItem)
    main_usd_file = prim.GetPrimStack()[1].layer.identifier
    for item in selection:  
        rawItem = item.getRawAddress()
        prim = mayaUsd.ufe.getPrimFromRawItem(rawItem)
        primpath = prim.GetPrimPath()
        usd_file= prim.GetPrimStack()[1]…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sanders3d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant