Jump to content

HOM - How to get the button parameter name when the button is pressed.


djbyun

Recommended Posts

Graham,

I tried to use kwargs['parm_name'] or kwargs['parm'].name(). But they didn't work. The only thing which worked in Python Module was kwargs['type']. Would you mind showing an example code for getting the button parmaters name when I push it?

Thanks.

DJ

Link to comment
Share on other sites

kwargs shows lots of information for me when printed from the callback field:

{'node': <hou.ObjNode of type null at /obj/null1>, 'script_value0': '1', 'script_value': '1', 'script_multiparm_index': '-1', '
script_multiparm_nesting': '0', 'script_parm': 'myparm', 'parm': <hou.Parm myparm in /obj/null1>, 'parm_name': 'myparm'}

If you are trying to access this information inside a function in the PythonModule, you would need call the function from the callback field and pass kwargs as the function argument. kwargs inside a PythonModule only gives you the node type information, as you've seen.

button_test.hip

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...