Jump to content

Recommended Posts

I am sorry to bring back this zombie question about this topic again

I probably read all the posts on internet about the topic and the houdini doc as well, but I am now more confused than before :unsure:

Question A)

What I'd like to do is to configure my houdini system path variables in order to follow this priority for OTL scan and scripts too (like 123 ... 456 ... etc):

1) a shot

example:

d:/projects/supercoolproj/seq1/shot3/otls

d:/projects/supercoolproj/seq1/shot3/scripts

...

2) a sequence

example:

d:/projects/supercoolproj/seq1/otls

d:/projects/supercoolproj/seq1/scripts

...

3) a show

example:

d:/projects/supercoolproj/otls

d:/projects/supercoolproj/scripts

...

4) houdini

$HOME/houdini12.5/otls

$HOME/houdini12.5/scripts

$HOME/houdini12.5/..

...

Basically the deeper the directory structure, the higher the override priority with elements with the same file name.

Now, so far only the 4) works.

My current status is the following:

... I copied and pasted the directories created by houdini at install time in

d:/data/Houdini/prefs/houdini12.1

d:/data/Houdini/prefs/houdini12.5

... and created a system variable HOME pointing to d:/data/Houdini/prefs

So far, Houdini can find all the otls i store in

$HOME/houdiniXX.X/otls

Can someone help me to setup $HOME/houdini12.5/houdini.env to follow the priorities illustrated at the beginning of the message or point me to some documentation that clearly explains it ?

p.s.

I am on Windows 8

thank you in advance for any possible help on this :)

Edited by mrWolf

Share this post


Link to post
Share on other sites

Update :

I managed to understand how it works modifying the file

houdini.env

JOB="C:/data/HOUDINI/projects"
HOUDINI_OTLSCAN_PATH="$JOB/otls;@/otls"

Now I would like to update the otl scan path accordingly to the hip file i am loading into houdini (variable $HIP) following a certain directory structure for the project i am working on.

I tried to include it here

HOUDINI_OTLSCAN_PATH="$HIP/otls;$JOB/otls;@/otls"

But obviously houdini doesn't know how to expand $HIP before actually opening a hip file, so the path ends up wrong

>>> os.environ["HOUDINI_OTLSCAN_PATH"]
'/otls;C:/data/HOUDINI/projects/otls;@/otls'

Is there a way to force an update and refresh of the otl scan path every time a new hip file is loaded ?

I prefer not to execute some python script outside of Houdini in order to set the project (changing some global variable) and then launch houdini, if possible.

Share this post


Link to post
Share on other sites

If you want different OTL files per scene that you open just store the OTL within the scene file (an option when you save). Otherwise the best option would be to set the environment variable prior to opening Houdini. Many pipelines will set environment variables before opening an application with specifics like the sequence, shot, and so forth to manage where other files like caches and renders go so it would make sense to handle the OTL path the same way (unless there's no pipeline established). There might be a way to do what you want, maybe check with SESI support?

Share this post


Link to post
Share on other sites

Luke,

yes I've been using that approach in many studios. It's a good one since it makes the whole pipeline aware about the job environment , not only houdini and many other reasons of course.

I am just trying to understand how the wheel works and maybe reinvent it a little bit, as usual eheh :)

And here it comes another question:

I am aware that I can access and modify a 'shell' houdini variable using

os.envir[<variable>"]=...

But i noticed that this deals with the variables at os level. So, for instance, variables like $HIP are not updated in real time in this environment when you load a new hip file.

hou.expandString(<variable>)

... works great in terms or retrieving $HIP in real time.

But I didn't find a way to write into an environment variable (for instance "HOUDINI_OTLSCAN_PATH") and make the current houdini session aware of this change.

Share this post


Link to post
Share on other sites

But I didn't find a way to write into an environment variable (for instance "HOUDINI_OTLSCAN_PATH") and make the current houdini session aware of this change.

Well, that's not really how it works at least from the shell and process perspective. It would need to be set prior to launching the process, hence outside of Houdini. The Houdini way to change a variable after loading would be through the "Aliases and Variables" interface from the Edit menu. Those can be changed or listed with the Hscript command "set" but I'm not sure if it has a Python equivalent yet (could run Hscript commands from Python using hou.hscript).

Share this post


Link to post
Share on other sites
But obviously houdini doesn't know how to expand $HIP before actually opening a hip file, so the path ends up wrong

If you bring up a Houdini Command Line Tools shell, and run "hconfig -ap", you get this help at the top

 Special characters in path definition are:
	 @ - Typically expands to the HOUDINI_PATH. Thus, if the
			 HOUDINI_PATH was set to:
			 $HIP
			 $HFS/houdini
			 $HOME/houdini
			 a path defined as "@/vex" would expand to the paths
			 $HIP/vex
			 $HFS/houdini/vex
			 $HOME/houdini/vex
	 = - This expands to the $HIP variable. This path will always
			 point to where the currently loaded hip resides.
	 &amp; - The ampersand character expands to the "default" path.
			 For example, to add a directory to the a path without
			 worrying about what the default path should actually be,
			 simply set the path to: "/mypath;&amp;". This will search
			 the "/mypath" path first, then search the default path.
	 ^ - Some paths are used for multiple directories. For
			 example, the HOUDINI_VEX_PATH is used to define the
			 search path for Surface, Displacement, Sop, etc. VEX
			 shaders. For VEX, the ^ symbol expands to the shader
			 type. Thus, if the HOUDINI_VEX_PATH variable is set to
			 something like "/usr/local/vex;$HOME/vex/^", when
			 loading Surface shaders, the following directories will
			 be scanned:
			 /usr/local/vex
			 $HOME/vex/Surface
			 and if Sop shaders are being searched for, the
			 following paths will be searched:
			 /usr/local/vex

Summary: Use =

Share this post


Link to post
Share on other sites

@luke

After reading a bit more the documentation and other forum posts, I realized what you mean with that. I was searching a way to refresh houdini otl path on the fly during an houdini session. I understand it's not particularly healthy or useful other than indulging the joy of finding a hack :) Closing houdini, changing the job enviromnent with a script and relauching houdini is historically and for good reasons the best way to go for sure, I agree with you.

@edward

Man it works great ! Thank you so much :)

So, to sum, in my environ.env file I have the following now:

JOB="C:/data/HOUDINI/projects"
HOUDINI_OTLSCAN_PATH="=/otls;$JOB/otls;@/otls"

So now the otls are scanned with this priority:

1 - $HIP/otls

2 - $JOB/otls

3 - whatever else/otls

I created a shelf tool with the following script that insures that the new otl scan path is updated with the current hip file (it basically removes otls that disappear from the path, and loads new otls):

hou.hscript("otrefresh -r")
for f in hou.hda.loadedFiles():
	 hou.hda.reloadFile(f)

note:

in the documentation it's written that otrefresh is now obsolete and we should use

hou.hda.reloadFile()

hou.hda.loadedFiles()

After a couple of tests I realized that this is true if we remain in the same domain of files and paths already in use.

If $HIP changes, then 'otrefresh -r' is still needed to update otl scan path but alone won't be enough to get rid of old paths or otls that are not anymore in the newly refreshed otl scan path. That's why I had to put both in the shelf tool.

Thank you a lot for your help Luke and Edward !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×