salik Posted September 7, 2017 Share Posted September 7, 2017 Hi all, I apologize if this is a noob question. Currently I am trying to find out how to change the options in a drop-down menu. Say if there are 3 options, and I am trying to set the option to the second option, I tried doing node.parm('resolution').set(1) I got the following errors: return _hou.Parm_set(*args) TypeError: Cannot set a string parm to a int But if I tried to replace `1` with the string value of the second option, while there are no errors to be seen, the option in the drop down did not get change to the second option at all, it is still stuck at the default option. Any ideas? Quote Link to comment Share on other sites More sharing options...
f1480187 Posted September 7, 2017 Share Posted September 7, 2017 (edited) int_menu_parm.set(1) # Switches to second menu item i1. int_menu_parm.set('2') # Switches to third menu item i2. int_menu_parm.set('i0') # TypeError: Cannot set a numeric parm to a non-numeric value. int_menu_parm.set(1000) # Sets parm to integer 1000, fallbacks to i0. string_menu_parm.set(1) # TypeError: Cannot set a string parm to a int string_menu_parm.set('2') # Sets parm to string '2', fallbacks to i0. string_menu_parm.set('i0') # Switches to first menu item i0. string_menu_parm.set(1000) # TypeError: Cannot set a string parm to a int ordered_menu_parm.set(1) # Switches to second menu item i1. ordered_menu_parm.set('2') # OperationFailed: The attempted operation failed. Invalid menu item. ordered_menu_parm.set('i0') # Switches to first menu item i0. ordered_menu_parm.set(1000) # Sets parm to integer 1000, fallbacks to i0. You can inspect correct menu tokens if you open Edit Parameter Interface window. Same applies to VEX: numbers for integer menus, token names for string menus, both for ordered menus. Edited September 7, 2017 by f1480187 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.