Can I trigger "Action Button" script on a paramater from Python?

   4594   3   2
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
I want to trigger the action button script of a parameter from a Python tool.

In my example the action button of a group node basegroup parameter.

I thought it would be something like:
hou.parm('hou.parm('/obj/box_object1/group1/basegroup').pressButton()
but that does not seem to work.
I guess I need a different path to it. Any ideas?
User Avatar
Member
191 posts
Joined: Oct. 2018
Offline
Maybe there's another way to trigger it, but from the help file for pressButton: “Emulates clicking a button parameter to trigger its callback script.” So that will only execute the callback script. Is this specifically for a group selection, or a custom hda?

This will work if you add a button to the group node and use it in the callback script. Or you can specify your node from whatever python you're putting it in.

import soputils; node = hou.pwd(); kwargs = {'node' : node, 'geometrytype' : node.parmTuple('grouptype'), 'parmtuple' : node.parmTuple('basegroup'), 'inputindex' : 0, 'ordered' : node.parm('ordered').eval()}; soputils.selectGroupParm(kwargs)
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
I guess it was primarily for group selection and in general my idea was to reduce the amount of code I would have to duplicate.

I was hoping that since the action button is a button, it's just a button that I can talk to directly.
I expected something like:

hou.parm('hou.parm('/obj/box_object1/group1/basegroup/button').pressButton()

to get to the basegroup's button. There might be no such thing.
User Avatar
Member
191 posts
Joined: Oct. 2018
Offline
Yeah, I didn't see another way of triggering the action button. Maybe it's a good feature request if it doesn't exist already
  • Quick Links