network_parm

flag_render ()

Sets the render flag to the selected node.
My hotkey for this function: Ctrl+Ins

flag_display ()

This function remembers the previously flagged node and unflags to it. I like to walk through the nodes and preview different states of the stream. Houdini has its own logic to “unflag” the Display Flag. It doesn’t jump back to its last position. I customized my own unflagging to the previously flagged node. If you like it, you may use my function (and hotkey it). Or you may customize it to fit your needs, for example always unflag to the last node.
My hotkey for this function: Ins

flag_bypass ()

Sets the bypass flag to all selected nodes.
My hotkey for this function: Ctrl+Del

flag_template ()

Sets the template flag to all selected nodes.
My hotkey for this function: Ctrl+Shift+Ins

autoscope_off ()

I use this function for the Geo Node, because I dont like to have TRS autoscoped, without being animated.

opencl_container ()

Goes through all the parms and if the parm is "opencl", it sets it on.

source code

the following code is maintained also on my github
thank you, great people, I couldn't do this without you.

import hou
import toolutils
import wf_selection

def flag_template_all_off () :
    parmnode = wf_selection.parmnode()
    container = parmnode.parent()
    for node in container.children():
        node.setTemplateFlag(False)
        node.setSelectableTemplateFlag(False)


def light_link () :
    parm_names = ["light_enabled","light_enable","ogl_enablelight"]
    expression = '''flag_parent = hou.pwd().parent().isGenericFlagSet(hou.nodeFlag.Display)
flag_this   = hou.pwd().isGenericFlagSet(hou.nodeFlag.Display)
if flag_parent and flag_this :
    return 1
else :
    return 0'''

    for light in hou.selectedNodes() :
        for parm_name in parm_names :
            try :
                parm = light.parm(parm_name)
                parm.setExpression(expression, language=hou.exprLanguage.Python) 
                light.setUserData("nodeshape", "light")
            except:
                parm_doesnt_exist = 1


def flag_render () :
    for node in hou.selectedNodes():
        node.setRenderFlag(not node.isRenderFlagSet())


def flag_display () :
    parmnode = wf_selection.parmnode()
    containername = parmnode.parent().name()

    nodetype = "multiflag"

    if hou.sopNodeTypeCategory() == parmnode.parent().childTypeCategory():
        nodetype = "singleflag"

    if hou.dopNodeTypeCategory() == parmnode.parent().childTypeCategory():
        nodetype = "singleflag"

    ################################
    ## unflag to the last flagged ##
    ################################

    if nodetype == "singleflag":

        # get this
        if len(hou.selectedNodes()) == 0:
            thisnode = parmnode
        else:
            thisnode = hou.selectedNodes()[0]
        thispath = thisnode.path()

        # get last
        lastpath = hou.getenv("unflagged", thispath)
        try:
            #node exists
            if hou.node(lastpath).parent().name() != containername:
                lastpath = thispath
        except:
            #node was deleted / renamed
            lastpath = thispath
        
        # get flag
        flagpath = hou.getenv("flag", thispath)
        try:
            #node exists    
            if hou.node(flagpath).parent().name() != containername:
                flagpath = thispath
        except:
            #node was deleted / renamed
            flagpath = thispath

            
        try:
            flag = hou.node(thispath).isDisplayFlagSet()
        except:
            flag = 2
            

        if flag == 0 :
        
            # setting clean
            setpath = thispath
            unflag = flagpath
            hou.putenv("unflagged", unflag )

            # set
            hou.putenv("flag", setpath )    
            setnode = hou.node( setpath )
            setnode.setDisplayFlag(True)

        if flag == 1 :
        
            # setting flagged
            setpath = lastpath
            unflag = thispath
            hou.putenv("unflagged", unflag )

            # set
            hou.putenv("flag", setpath )    
            setnode = hou.node( setpath )
            setnode.setDisplayFlag(True)

    ################################
    ####  not SOP, just toggle  ####
    ################################

    if nodetype == "multiflag":
        # none is selected
        if len(hou.selectedNodes()) == 0:
            parmnode.setDisplayFlag(not parmnode.isDisplayFlagSet())

        # for all selected    
        for node in hou.selectedNodes():
            try:
                node.setDisplayFlag(not node.isDisplayFlagSet())
            except:
                hasnoflag = True


def flag_bypass () :
    for node in hou.selectedNodes():
        node.bypass(not node.isBypassed())


def flag_template () :
    for node in hou.selectedNodes():
        node.setTemplateFlag(not node.isTemplateFlagSet())


def autoscope_off () :
    default_autoparms = ["tx","ty","tz","rx","ry","rz","sx","sy","sz"]
    for node in hou.selectedNodes() :
        for autoparm in default_autoparms:
            try:
                parm = node.parm(autoparm)
                parm.setAutoscope(False)
            except:
                print "parm [" + autoparm +"] doesn't exist"



def opencl_container () :
    container = wf_selection.container()
    nodes = container.allSubChildren()
    for node in nodes:
        if not node.isInsideLockedHDA():
            parms = node.parms()
            for parm in parms:
                if parm.name()=='opencl':
                    try:
                        parm.set(1)
                    except hou.PermissionError: 
                        pass