Parm callbacks and environment variables

   1337   2   0
User Avatar
Member
59 posts
Joined: April 2006
Offline
I have a custom HDA with an Integer parm that has a callback script defined for it. If I set the value of this parm to an environment variable like $VEHICLE_ID (I guess this becomes an hscript expression), and then change $VEHICLE_ID in a textport like this:

/ -> setenv -g VEHICLE_ID = 5
/ -> varchange

I see that the evaluated value of this parm is now 5, but the change in value does not trigger the parm's callback script to run.

How can I get the callback script to run when the parm's value changes as a result of a change to the global variable that is set as its expression/value?

Thanks!
User Avatar
Member
106 posts
Joined: June 2011
Offline
Callback scripts don't get triggered if the parameter is changed programatically.

You can use hou.Parm.pressButton() to force run the callback script.

-J
Edited by jjayakumar - Nov. 22, 2019 05:43:08
User Avatar
Member
4 posts
Joined: Feb. 2016
Offline
I ran into this problem too. My scene is rendered without GUI via hython and the environment variables are setup after the scene loads. However, I don't have access to the hython scripts, so I need my HDA to react to the changes automatically. I tried putting my callback code in OnLoad on my HDA, but the problem is that this executes when the scene loads (BEFORE hython has updated the variables).

$MYENV/somefile.json <-- Needs to execute code to re-import the data when the ENV changes programatically.

If anyone knows a way/hack to force the node to recook in response to the ENV change, it would be of great help!

Thanks.
  • Quick Links