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
16604 2 2-
- oat
- Member
- 479 posts
- Joined: 12月 2009
- オフライン
-
- tamte
- Member
- 9338 posts
- Joined: 7月 2007
- オフライン
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 - 2018年7月11日 12:44:58
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- mjdynamic
- Member
- 3 posts
- Joined: 1月 2016
- オフライン
-
- Quick Links


