Design a site like this with WordPress.com
Get started

[Code] Houdini Python snippets

Useful snippets stored for use later

  • HDA callback button scripts
    • Initialize Presets button
    • Run all processes button

HDA callback button scripts

Initialize Presets button

In callback function of button parameter, write:

hou.phm().initialize()

In the menu tab of parameter, create a key-value menu

In Python module of hda:

def initialize(pnode='.', key=None): cnode = hou.node(pnode)      if key == None: 
          key = cnode.parm("preset").evalAsString() 
          #print(key) 
     else: 
          cnode.parm("preset").set(key) 
     ### Set Parameters 
     if key == "1": 
          #...

Run all processes button

In “Cook” button parameter callback script, write:

hou.phm().cook()

In Python module of hda:

def cook():
     node = hou.pwd() 
     #print(hou.pwd())
     node.parm('execute1').pressButton()
     node.parm('execute2').pressButton()
     node.parm('execute3').pressButton()
     #...

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: