shadowst17 Posted June 14, 2019 Share Posted June 14, 2019 Hi guys, I've got a button strip with multi selection. How can I get which items are selected in python? Evaluating the parameter adds them all up into a single number. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
ikoon Posted June 14, 2019 Share Posted June 14, 2019 Hi Dominic, it is called bitfield, here is the description how to use it: http://www.sidefx.com/docs/houdini/hom/locations.html#button_strip_scripts Another example: I have a Button strip, the Callback script I have: hou.phm().strip_to_tokens(kwargs['parm'], kwargs['node']) Then in scripts, PythonModule: def strip_to_tokens(parm, node): bitfield = parm.eval() tokens = parm.parmTemplate().menuItems() pitch_tuple = [token for n, token in enumerate(tokens) if bitfield & (1 << n)] pitch_tuple_string = ' '.join( (map( str , pitch_tuple ) ) ) node.parm("enable_pitches_tuple").set(pitch_tuple_string) 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.