Jump to content

How to have a menu with internal integer values?


magneto

Recommended Posts

Hi,

In my custom OP, I am trying to create a named menu with items "Positive", "Negative" and provide values like 1, and -1, respectively. I tried using an Integer item in the parameters tab of the Edit Operator Type properties dialog, with a defined menu and tokens with 1 and -1, but when I use it in the expressions, it doesn't work.

If I turn it into a float, it works but then I lose the menu.

Here is a simple case that shows the problem. The line's distance is multiplied by my menu item value but it seems the value I get from the menu is the order of them (index), instead of my tokens.

Any ideas?

Thanks.

custom_line.otl

Edited by magneto
Link to comment
Share on other sites

quick fix would be if(ch("../sign")==0, -1, 1)

Thanks tmdag, I now know how to use ifs inside expressions. But would also be cool if this is doable without an if.

Am I misinterpreting the tokens? I thought they can be any value you want, when you access the parameter.

Edited by magneto
Link to comment
Share on other sites

change your parameter to ordered menu and try eval as string `chs("../sign")` or hou.parm("../sign").evalAsString()

Thanks tmdag, just tried it to chs("../sign") after changing it to an ordered menu, but same result. Didn't try hou.parm but I assume it does the same thing?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...