magneto Posted November 15, 2011 Share Posted November 15, 2011 (edited) 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 November 15, 2011 by magneto Quote Link to comment Share on other sites More sharing options...
tmdag Posted November 15, 2011 Share Posted November 15, 2011 quick fix would be if(ch("../sign")==0, -1, 1) Quote Link to comment Share on other sites More sharing options...
magneto Posted November 15, 2011 Author Share Posted November 15, 2011 (edited) 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 November 15, 2011 by magneto Quote Link to comment Share on other sites More sharing options...
tmdag Posted November 15, 2011 Share Posted November 15, 2011 (edited) change your parameter to ordered menu and try eval as string `chs("../sign")` or hou.parm("../sign").evalAsString() Edited November 15, 2011 by tmdag Quote Link to comment Share on other sites More sharing options...
magneto Posted November 15, 2011 Author Share Posted November 15, 2011 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? Quote Link to comment Share on other sites More sharing options...
tmdag Posted November 15, 2011 Share Posted November 15, 2011 it worked for me, I'll send you scene once i get home (i cannot send anything from work ) Quote Link to comment Share on other sites More sharing options...
magneto Posted November 15, 2011 Author Share Posted November 15, 2011 it worked for me, I'll send you scene once i get home (i cannot send anything from work ) Thanks man, appreciate it. I wouldn't be able to open it at work anyway Quote Link to comment Share on other sites More sharing options...
magneto Posted November 16, 2011 Author Share Posted November 16, 2011 Hi tmdag, just tried your method and it works. Sorry in the example it was in the divisions field which cannot be negative that's why I didn't see it. But it was chs and the ordered menu like you said that did it. 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.