Pass name of HDA parm to function in callback script?

   1385   2   0
User Avatar
Member
39 posts
Joined: Feb. 2017
Offline
Is it possible to access the name of the button pressed when executing it's callback script?

I have an HDA with a multiparm block: each new block gets some user customization options which will modify SOPs inside the HDA, the results of which will be written to disk.

I need that write stage to happen in 2 ways: first as a batch, which is easy to do by parsing the multiparm block and getting all the instances. Second is by a button on each block itself to write that single instance to disk.

The function I'd attach to the individual buttons needs to know which block is being operated on though -- is there a way of passing something simple like hou.pwd().parm("self")? Or is this more complicated?
User Avatar
Member
106 posts
Joined: June 2011
Offline
Hi there!

You could access the current parameter being executed using kwargs.

def your_callback_function(kwargs):
   node = kwargs['node']
   parm = kwargs['parm']

Hope it helps

-J
User Avatar
Member
39 posts
Joined: Feb. 2017
Offline
Yes, thank you -- this is exactly what I needed. I had a hunch kwargs would be related but I've had trouble figuring out how to phrase searches to learn what data they pass in this circumstance.

This also gives me insight on what to research to solve a bunch of related questions so double thank you for that!
  • Quick Links