Running a script from a button on a HDA

   10610   3   1
User Avatar
Member
517 posts
Joined: Dec. 2013
Offline
Hi All,

I'm trying to add a button to my character's HDA that runs a python script but I can't figure out how to get it working. It works fine as a toolbar script.
Im not sure whether to store the script on the disk and access that somehow, or if there's a way to bake the script into the HDA.
Can someone give me a little help getting started with this?

Thanks,
Pete
User Avatar
Member
8551 posts
Joined: July 2007
Online
you can define your script in Scripts section on your HDA (Type Properties…)
https://www.sidefx.com/docs/houdini/ref/windows/optype#scripts [sidefx.com]
and you can use parameter callback to refer to it, then any time your parameter is changed (like button pressed) it will run the script
https://www.sidefx.com/docs/houdini/hom/locations#parameter_callback_scripts [sidefx.com]

you can as well pass kwargs dictionary to the called function so that you have access to important data like node or parm it was called from etc.

here is a quick example:

Attachments:
parmCallbackExample__1_0.hda (3.7 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
517 posts
Joined: Dec. 2013
Offline
Thanks Tamte, I'll check that out!
User Avatar
Member
517 posts
Joined: Dec. 2013
Offline
Hey Tamte,
Just getting my head around it all now.
Thanks heaps for the file and links!
P.
  • Quick Links