Its a circus out there



Home VOPs SOPs DOPs COPs POPs ROPs Expressions OSTips Shops Tools Lighting Python Pclouds HOT About

Bio Showreel GalleryHoudini.htmlVops.htmlSops.htmlDopsMain.htmlCops.htmlBlank.htmlRops.htmlExpressions.htmlOSTips.htmlShops.htmlTools.htmlLighting.htmlPointClouds.htmlHotOceanTookkit.htmlAbout.htmlBio.htmlShowreel.htmlGallery.htmlHoudini.htmlshapeimage_1_link_0shapeimage_1_link_1shapeimage_1_link_2shapeimage_1_link_3shapeimage_1_link_4shapeimage_1_link_5shapeimage_1_link_6shapeimage_1_link_7shapeimage_1_link_8shapeimage_1_link_9shapeimage_1_link_10shapeimage_1_link_11shapeimage_1_link_12shapeimage_1_link_13shapeimage_1_link_14shapeimage_1_link_15shapeimage_1_link_16shapeimage_1_link_17shapeimage_1_link_18



Template Group is the overall node ie a NULL  parmTemplate is the actual parmeters do this as a test : -

Python in a HDA :- Example a simple bundle Maker

If you want to use python in your HDA you need to store it in a python module. Which is hou.pwd(). Then we have our code which is hda.Module. Then you make a function call ie make_bundle() so we can call back a python script. So when we press the button python knows what script we are calling in this case make_bundle().

The  call back script you would add :- something like hou.pwd().hdaModule().make_bundle()

Create the parameters you need in your HDA using the standard methods. The button that will execute the python will be using the call back section of the HDA. The parameters are just used to store user values. ie you want in this case to define a pattern for the bundle maker.


def make_bundle():

    me = hou.pwd()


    for mParmNum in range(me.evalParm('bundles')):

        name = me.evalParm('name' + str(mParmNum))

        pattern = me.evalParm('bunpat' + str(mParmNum))

        print name, pattern

        if name not in [ for bundle in hou.nodeBundles()]:


        thisBundle = hou.nodeBundle(name)



        nodeLs =  [ node.path() for node in thisBundle.nodes()]

        me.parm("bundle_test_string_"+ str(mParmNum)).set( ' '.join(nodeLs) )

The set()

function called and i am just displaying information in a parameter so

you can have one more example of something you need to know how to do,set the value of a parameter.As the code loops the number of the bundle steps up from 0 to however many bits you have added to your multi parm. "me" has been set to this object that is this bundle maker,  we are specifying the particular parameter called bundle_test_string_ plus the number of the current parameter we are looping through. then we are running that parameters set() function to set a string. that string is the list node Ls that has had it's parts opened out and joined together with a ' ' aka a space.

Scene file rse_py_bundlemaker.hip

On the scripts tab of the HDA .Next you need to add a python module to contain the code as per the image below.

Python in a HDA :- Ends

A Simple example that uses findEnds. Used in production to get a list of nodes at the end of a tree of nodes similar to the example it returns the full path. The node is inserted into the tree just to gather information which can then of course be read anywhere thats needed.

My Python Notes :-

Examples / notes on using Python in HDA’s and from the shelf.

Share a shelf :- Save a shelf to a set location > name said shelf. Alter the Houdini env file and add the full path to be search “&’’ this and default

HOUDINI_TOOLBAR_PATH  =/Volumes/linux_drive/Houdini_Mprojects/some_shelftools;&

HOUDINI_OTLSCAN_PATH =/Volumes/linux_drive/Houdini_Mprojects/otls:$HFS/houdini/otls


Code # For Python Module

def myOnCreatedFunction(kwargs) :

   print kwargs

   import hou

   meText= str(kwargs["node"].path())

   me = hou.node(meText)


def endsList():

   master = hou.pwd()

   ends = []



   return ' '.join(ends)

def findEnds(master,ends):

     if len(master.outputs()) == 0:

         ends.append(master.path()) # condition 1


         for kid in master.outputs():

             ends = findEnds(kid,ends)

     return ends

# Code for OnInputChanged


Using opinputpath(“.”,0) you can automatically read the the name of the node plugged in ie the input. The wrist in this scene reads the listed generated by the

grab names otl

`chs(opinputpath(".",0) + "/fingers")`

Scene file rse_py_listfingers.hip

Otl rse_grabnames_v001.otl

# print a list to the shell the groups from a selected node

if len(hou.selectedNodes()) == 0:

    #If the user has not selected a node ask them to

    hou.ui.displayMessage(" please select a node",title = "Houdini")


#create a new variable that equals the selected node

    curNode = hou.selectedNodes()[0]


    primGroups = curNode.geometry().primGroups()

    for prim in primGroups:


# create env light

obj = hou.node("/obj")

n = obj.createNode("envlight", "lgt_env")


p = n.parmTuple("light_color").set((0.756,0.828,0.9))

p = n.parm("env_map").set("$HFS/houdini/pic/DOSCH_SKIESV2_01SN_lowres.rat")

## evaluate a parameter

>>> box = hou.node('/obj/geo1/box1')

>>> p = box.parm('type')

>>> print box.evalParm('type')



# list all the parms in a given node using forloop

>>> box = hou.node('/obj/geo1/box1')

>>> p = box.parm('type')

>>> for parm in box.parms():

...          print












#example file show how to remove a node from a list




# Select the object node

sel= hou.selectedNodes()

# Get children as a list instead of a standard tuple

childs = list(sel[0].children())

#remove from list and destroy node by using list comprehension as a filter

[(childs.remove(child), child.destroy())

    for child in childs

        if == 'file1'


##  print to terminal the names of select nodes

print hou.selectedNodes()[0].name

## if statement to select and print node name

if len(hou.selectedNodes()) == 0:

    print "please select a node"


    print hou.selectedNodes()[0].name()

Python Snippets

# create empty geo node

obj = hou.node("/obj")

n = obj.createNode("geo", "box_obj")


p = n.parmTuple("t").set((2,0.5,0))

selected = n.setSelected(True)

sel = hou.selectedNodes()

childs = list(sel[0].children())

[(childs.remove(child), child.destroy())

    for child in childs

        if == 'file1'


selected = n.setSelected(False)

### create box node inside

b = n.createNode("box")

b.parmTuple('size').set((1, 1, 1))

# for loop to add a node to another node by name

for i in hou.node("/obj/geo1").children() :

if i.type().name() == "delete" :