Delanimation

Delano Athias - Animator

Selecting Nodes with Identical Names with Python in Houdini

In this lesson, we will learn how Python can be used to select nodes with similar patterns in Houdini. Level: Beginner to Intermediate

#Import Houdini's Command Module
import hou
#Store path to Subnet in variable "rig"
rig = hou.node("/obj/Rig")
#For Loop - iterate through network, in search of nodes that match pattern "*_anim"
for ctrl in rig.glob("*_anim"):
    #Select all nodes that match pattern "*_anim" | NOTE: ctrl.setSelected(1, 0) also works :)
    ctrl.setSelected(True, clear_all_selected=False)