Updating environment variables

   3049   2   1
User Avatar
Member
49 posts
Joined: Feb. 2016
Offline
I am trying to update the environment variable in houdini like $WEDGE with a parameter interface
I created a version of HDA and set this function as the callback of value field
def set_var():
    node = hou.pwd()
    var = node.parm('variable').eval()
    value = node.parm('value').eval()
    hou.putenv(var, str(value))
So when you change the values it will update the environment variable too.
The problem is other node in the scene doesn't know it was changed and doesn't reload and show a new result.
Anyone know a way to fix it?

Using the window update the values instantly

Setting variable with python doesn't update the nodes
Edited by benC - Oct. 18, 2018 21:04:03

Attachments:
setGlobalEnv_default.gif (519.2 KB)
setGlobalEnv_python.gif (328.5 KB)

User Avatar
Member
731 posts
Joined: Dec. 2006
Offline
Use “varchange”. This will update the nodes. I don't see a Python equivalent, so you'll have to use hscript.

http://www.sidefx.com/docs/houdini/commands/varchange.html [www.sidefx.com]
Sean Lewkiw
CG Supervisor
Machine FX - Cinesite MTL
User Avatar
Member
49 posts
Joined: Feb. 2016
Offline
mrCatfish
Use “varchange”. This will update the nodes. I don't see a Python equivalent, so you'll have to use hscript.

http://www.sidefx.com/docs/houdini/commands/varchange.html [www.sidefx.com]

This is what I want. Thanks mrCatfish!

def set_var():
    node = hou.pwd()
    var = node.parm('variable').eval()
    value = node.parm('value').eval()
    hou.putenv(var, str(value))
    hou.hscript('varchange')
  • Quick Links