Jump to content

switch menu content


ben

Recommended Posts

Hi,

I'm sure this is an easy one but I'm stuck.

I want to switch a menu content according to a toggle.

post-5378-130010288882.jpg

I've tried this for the menu I want to update :

if (../null1/toogleMenu == 0) then
    opmenu -l ../null1 menu1
else
    opmenu -l ../null1 menu2
endif

but it doesn't work...

How would you do that ?

thx

toggleMenu.hipnc

Link to comment
Share on other sites

Call back on the toggle script like this works for setting the first menu1 menu list:

if ($script_value == "on"); then; opparm . menu1 (0); else; opparm . menu1 (1); endif

You need to supply semicolons as line returns as the callbacks only support a single line.

You can echo any variable or state for debugging using the message command like this:

message $script_value

When off you see it returns "off" and returns "on" when on. Test for that.

$script_value returns the current value of the parameter being executed.

If you wish this toggle to run callbacks on target parameters, use the -C option to opparm. See the help usage for opparm.

Edited by old school
Link to comment
Share on other sites

Thx Jeff.

That help, but I'm still looking for a solution to my problem.

Maybe I was unclear :

I have 3 menus A, B, C and a toggle.

And according to the toggle I want populate menu C with content of A or B.

Or another possibility could be :

have only 2 menus and a toggle

and according to the toggle make menu A or menu B invisible

Attached file is real life case.

ben

Link to comment
Share on other sites

Here's what I'd do.

Toggle still controls switch, but scripted menu parm looks at toggle to determine which node to use and then copies the menu items from that nodes parameter. The menu parms then reference the one menu. There can be issues with changing the input if you have an unequal amount of geometry files available from each input but you just need to change the drop down menu to an actual valid entry and the error clears up. You could also guard against this with a simple expression on the menu parms to check to see if the index is valid or not and clamp or adjust accordingly.

toggleMenu.hipnc

Edited by graham
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...