Selecting menu item in OTL callback?
2648 4 2- JordanWalsh
- Member
- 143 posts
- Joined: Feb. 2012
- Offline
- graham
- Member
- 1909 posts
- Joined: Nov. 2006
- Offline
- JordanWalsh
- Member
- 143 posts
- Joined: Feb. 2012
- Offline
- JordanWalsh
- Member
- 143 posts
- Joined: Feb. 2012
- Offline
Ok, now im having some logic/timing problems in my setup.
I want a a global variable to save a number, lets call it $VERSION.
I want to be able to change this number with a menu on a node so in the callback script ive put this:
hou.hscript('setenv VERSION = ‘+ hou.pwd().parm(’Version').eval())
Which works fine.
The issue is when I select another node with this property, I want the version parameter to sync up with the Global $VERSION value.
There dosent seem to be an event handler to allow for changing the parameter when the menu is shown.
I did try adding it to a menu script but that seems to get called at the wrong time.
This is what I had in the Menu Script:
hou.pwd().parm('Version').set(hou.expandString('$VERSION'))
return
Is there a way I can link the parameter to the global?
I want a a global variable to save a number, lets call it $VERSION.
I want to be able to change this number with a menu on a node so in the callback script ive put this:
hou.hscript('setenv VERSION = ‘+ hou.pwd().parm(’Version').eval())
Which works fine.
The issue is when I select another node with this property, I want the version parameter to sync up with the Global $VERSION value.
There dosent seem to be an event handler to allow for changing the parameter when the menu is shown.
I did try adding it to a menu script but that seems to get called at the wrong time.
This is what I had in the Menu Script:
hou.pwd().parm('Version').set(hou.expandString('$VERSION'))
return
Is there a way I can link the parameter to the global?
- graham
- Member
- 1909 posts
- Joined: Nov. 2006
- Offline
The kind of behavior I think you're looking for isn't something that can really be achieved. Houdini does keep track of dependencies between parameters and variables and can forcibly update them with the ‘varchange’ command, but that is only useful if your parameter is actually set to $VERSION, which you menu most likely isn't.
An alternative might be to have your callback actually set the parameters on every node instance of the same type rather than trying to store the version somewhere and have it applied elsewhere automatically. This would be more straight forward.
You could also remove the menu and have the concept of a control node that would have the menu and set the variable on change. Your other nodes would be hard coded to $VERSION and would pic up the change to the master node via varchange.
An alternative might be to have your callback actually set the parameters on every node instance of the same type rather than trying to store the version somewhere and have it applied elsewhere automatically. This would be more straight forward.
You could also remove the menu and have the concept of a control node that would have the menu and set the variable on change. Your other nodes would be hard coded to $VERSION and would pic up the change to the master node via varchange.
Graham Thompson, Technical Artist @ Rockstar Games
-
- Quick Links