comment 0

Find all parms referencing this parm

The "Find Node" in 16.5 is really good, I use it quite a lot. But when I want to find all nodes, whose (any) Raw Parameter references Source Volume's "scale_velocity", then I have to know the name of the Parameter. Wildcard in the "Raw Parameter" in the Find Node filter is not accepted.

One way to find all the parms, which reference the "scale_velocity" is the Parm.parmsReferencingThis() function. But the "Find Node" has great usability, it selects and auto-focuses nodes.  So I have written a script, which finds all the references, prints them in the console and generates a pattern as it is required by the Find Node form (http://www.sidefx.com/docs/houdini/network/find.html). Then I just Paste it from Clipboard to the Find Node.

I have also added the functionality to the PARMmenu.xml in a similar way, as Juraj Tomori describes it on his great blog.

def find_parm(parmname) :

    if parmname == None :
        text = hou.ui.readInput("Search text:", buttons=("Search", "Cancel"))[1]
    else :
        text = parmname

    container     = wf_selection.container()
    nodes         = container.allSubChildren()
    pattern       = ''
    pattern_count = 0

    print '----    found:   ----'
    for node in nodes :
        parms = node.parms()
        for parm in parms :
            raw = parm.rawValue()
            if raw.find(text) > -1 :
                if pattern_count > 0 :
                    pattern   += ' | '
                pattern       += parm.name() + '~=*' + text + '*'
                pattern_count += 1
                print 'NODE: ' + str(node) + '   // PARM: ' + parm.description() + "   // RAW: " + raw
    print '--------------------------'

    hou.ui.copyTextToClipboard(pattern)

 

Leave a Reply