pythonnuke

How can I find all ReadGeo nodes in a Nuke script?


I'm trying to write code to find all "ReadGeo" nodes and find its file path.

Right now my code opens my script and looks for "ReadGeo" nodes, but any ReadGeo nodes created in Nuke manually aren't found.

But, ReadGeo nodes created with code are found

def copyreadgeo(projid,scriptid):
    nuke.scriptOpen(farmbarn + '/' + projid + '/' + scriptid)
    #nuke.createNode("ReadGeo")
    for node in nuke.allNodes(recurseGroups=True):
        if node.Class() == "ReadGeo":
            print node.fullName(), ':', node['file'].value()

Solution

  • Updated: August 30, 2020.

    In The Foundry NUKE 12.2v2 ReadGeo nodes is a ReadGeo2 class.

    enter image description here

    Here's a working code:

    import nuke
    
    for node in nuke.allNodes():
        if node.Class() == "ReadGeo2":
            node.setSelected(True)
    
    print(nuke.selectedNodes())
    

    enter image description here