Running a python script after a hip file is loaded

   7403   1   1
User Avatar
Member
77 posts
Joined: Nov. 2007
Offline
I'm finding myself in trouble with the $HIP variable–all my resource reference are set with it so paths don't break. But the problem is when my render queue manager runs hython on a remote server, $HIP points to $HFS/houdini/bin and all hell breaks loose.

So I'm trying to execute this script after the hip file loads so $HIP is set correctly.

path = hou.hipFile.name()
hipDir = path.rsplit(“/”,1)
hou.hscript(“set HIP=” + hipDir)


I can't figure out where to put this script to run it automatically at the start of a hip session. Any ideas?
User Avatar
Member
1390 posts
Joined: July 2005
Offline
IndyZoneCo
I'm finding myself in trouble with the $HIP variable–all my resource reference are set with it so paths don't break. But the problem is when my render queue manager runs hython on a remote server, $HIP points to $HFS/houdini/bin and all hell breaks loose.

So I'm trying to execute this script after the hip file loads so $HIP is set correctly.

path = hou.hipFile.name()
hipDir = path.rsplit(“/”,1)
hou.hscript(“set HIP=” + hipDir)


I can't figure out where to put this script to run it automatically at the start of a hip session. Any ideas?

I don't think you can set $HIP. It just points to directory when hip file is saved, so it wouldn't have much sense. Once hip file is loaded, your $HIP should be properly set.

If you need to do something before the actual scene is loaded, you can use $JOB variable or anything else present in your environment. Render Manager usually runs a script which setup a whole environment before call mantra.

As to executing script on launch, 123.py (or 456.py for loading scene) placed somewhere in houdini's path ($HOME/houdinix.x/scripts or $JOB/scripts or $HSITE/scripts) does the job. Hard to say which place is right for you.


hth,
sy.
  • Quick Links