Set Variables Question

   3426   4   0
User Avatar
Member
8 posts
Joined: April 2017
Offline
Hi Everyone.

Currently, we are setting variables in the shell for a session of Houdini. However, we would like these ENV variables to persists with the shot after it is created. Currently, if we set “myshotpath = c:\temp\” the variable works inside of that session of Houdini, but I would like that Env to save with the file, so if it is opened on another machine, or a renderer, the value of that env variable exists.

Currently, once the file is closed, it seems to lose all those env assignments.

Is this possible? (In Windows7)

Thanks
Fred
User Avatar
Member
2658 posts
Joined: June 2008
Offline
Each HIP file carries with it a python file located under menu Windows/Python Source Editor. Just put your code in there and it will run when the file is opened on any machine. Look into how to set environment variables for python.
Using Houdini Indie 20.5
Windows 11 64GB Ryzen 16 core.
nVidia 3060RTX 12BG RAM.
User Avatar
Member
8 posts
Joined: April 2017
Offline
I could use a little more clarification.

I would like our launcher to write out some system variables for a new Houdini scene at the time of launch to use, and to keep with the scene file on save. I want this to all at Launch time, without user interaction at all. There are only a few env variables that need to be passed, but I need them to be persistent with the scene from then on.

I thought this would be a good use of the 123.py and 456.py, but those two files seem to be for global environment variables, not shot specific variables. ?
User Avatar
Member
2658 posts
Joined: June 2008
Offline
Just give it a try. Put a print statement in the Python Source Editor. Save your HIP file. Close Houdini. Open your HIP file and you should see the print statement appear in the console.

NOTE: On OSX and perhaps Linux you may have to launch Houdini via the console to see the console output but the script runs just the same even if you don't view the print.
Edited by Enivob - Aug. 10, 2017 08:40:28
Using Houdini Indie 20.5
Windows 11 64GB Ryzen 16 core.
nVidia 3060RTX 12BG RAM.
User Avatar
Member
8184 posts
Joined: Sept. 2011
Offline
Most facility pipelines I have used have some sort of ‘set shot’ command that runs the scripts needed to invoke an environment with all the required variables initialized. It is somewhat outside the scope of Houdini.
  • Quick Links