I have an ordered menu with each of its “Token” associated with a string “Label”. (image 08 )
May I ask how can I use either Hscript or Python to get the Label string once I select an item from the menu?
I tried the following but it always return the numerical index or the token value of the menu item selected … (image 09 & 10)
Thank you very much!
how to get the "label" of an item in ordered menu
14007 2 2- oat
- Member
- 479 posts
- Joined: Dec. 2009
- Offline
- tamte
- Member
- 8449 posts
- Joined: July 2007
- Offline
something like this:
EDIT: updated formatting as it was lost over time
parm = hou.pwd().parm("case_name_list") value = str(parm.eval()) # convert to string since you have ordered menu if value in parm.menuItems(): index = parm.menuItems().index(value) return parm.menuLabels()[index] else: return "value %s not found in menu" % value
EDIT: updated formatting as it was lost over time
Edited by tamte - July 11, 2018 12:44:58
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- mjdynamic
- Member
- 3 posts
- Joined: Jan. 2016
- Offline
-
- Quick Links