Jan-Philipp Koch
Jan-Philipp Koch

Reputation: 157

Maya Python get reference paths

Hey I am writing a tool that reads all current references in the scene. Iam creating a textfield and radiobuttons for each of the references. Now I want to check the filepath of the reference for newer versions. If there is a new version it should paint the textfield yellow.

How do I get the paths for each reference? I wonder if there is any build in thing in maya which gives the path to a reference currently loaded in maya. I want to check within the loop below for each reference in referenceList

#get references
referenceList = cmds.ls(rf = True)

for reference in referenceList:
    print reference

    cmds.textField(reference)
    cmds.radioCollection()
    cmds.radioButton(label = '')
    cmds.radioButton(label = '')
    cmds.textField(reference, edit = True, text = reference)

    # newVersionFound = False
    if newVersionFound == True:
        cmds.textField(reference, edit = True, backgroundColor = [0.6,0.5,0])

If there is no quick solution I will probably go with building the path string based on the reference name since our pipeline would allow this.

Greetings, and have a nice day!

Upvotes: 2

Views: 5373

Answers (1)

Jan-Philipp Koch
Jan-Philipp Koch

Reputation: 157

Uff can I downvote my own question?

Solution: referenceQuery does what i want.

cmds.referenceQuery('reference', filename = True)

Upvotes: 7

Related Questions