I am trying to avoid using machine level package references and instead use hip file references.
Unfortunately the
$HIP
folder is not checked for package json (as far as I know anyway, tried creating a ‘packages’ subfolder), and $HIP
environment variable is only set after the packages are loaded.I have a work around, but it is a little messy.
So I wondered if I was missing a few setup tricks that would allow me to avoid some mess.
My current work around:
- Launch Houdini from command line with setting an Environment Variable dynamically set to the hip file's directory
- Add a package json file to a machine level packages directory that using the hip file directory Environment Variable
- Add package json files referencing the shared project packages
To make it clearer
Terminal will automatically set
PWD
. So I will be lazy for now and just launch from the hip file's folder.open scene.hiplc
In a global packages folder (for example
~/Library/Preferences/houdini/18.0/packages
) add:{
"env": [
{
"SCENE_HIP_DIR": "$PWD"
}
],
"package_path" : [
"$SCENE_HIP_DIR/packages"
]
}
In the scene folder add:
{
"env": [
{
"COMMON_DIR": "$SCENE_HIP_DIR/../Common"
}
],
"package_path" : [
"$COMMON_DIR/packages"
]
}
In the top level Common folder:
{
"env": [
{
"COMMON_SOME_CHILD_DIR": "$COMMON_DIR/SomeChild"
}
],
"path": "$COMMON_DIR",
"package_path" : [
"$COMMON_SOME_CHILD_DIR/packages"
]
}
In the common child subfolders (maybe having sub packages is going to far):
{
"path": "$COMMON_SOME_CHILD_DIR"
}
Problems with this:
- Needs to have scene opened from a script; or at least opened from command line
- Still need to have a global package file setup. I could setup this in the launch script but I think that would make things a sudo command
- Minor issue: potential Environment Variable name clashes.
Any suggestions on what I may have missed?