Is it possible to add python callback to an HDA's parm without modifying the HDA Definition?

   2019   5   2
User Avatar
Member
390 posts
Joined: Jan. 2012
Offline
I want to add a default python callback to all parm's on an hda that don't already have a callback set. Ideally I'd like to do this in OnCreated, but the only way I can see to add a callback is by modifying the parm templates in the asset definition. I'd rather not modify the asset definition.

If not, is there anything similar to Node's addEventCallback for parms?

I am open to even hacky ways of achieving this.


thanks!
.
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
I would also love to know how to do this!

I'd like to add a callback onto a standard rop geometry sop node to determine when a string parameter changes.
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
ahh its here

http://www.sidefx.com/docs/houdini/hom/hou/Node.html#addEventCallback [www.sidefx.com]

def name_changed(node, event_type, **kwargs):
    print("The geometry object is now named", node.name())

hou.node("/obj/geo1").addEventCallback((hou.nodeEventType.NameChanged, ), name_changed)
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
but what you want is hou.nodeEventType.ParmTupleChanged to find all altered parms.
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
User Avatar
Member
390 posts
Joined: Jan. 2012
Offline
Andrew Graham
hou.nodeEventType.ParmTupleChanged
This is perfect! I scanned through that page today and can't believe I missed it. Thank you!!
.
User Avatar
Member
150 posts
Joined: Feb. 2009
Offline
I just found though that callbacks added this way wont persist between houdini sessions, so if anyone has a recommended solution for that I'd love to know.

The only hack I can think of is adding callbacks on scene load, but that seems so diiiirty.
https://openfirehawk.com/ [openfirehawk.com]
Support Open Firehawk - An open source cloud rendering project for Houdini on Patreon.
This project's goal is to provide an open source framework for cloud computing for heavy FX based workflows and allows end users to pay the lowest possible price for cloud resources.
  • Quick Links