I have a problem with our builders setup. On the builders I am generating a simple .env file which I am passing to HAPI_Initialize. It contains some custom variables + HOUDINI_PACKAGE_DIR, as we are storing our packages outside of Documents\houdini18.0\packages.
I know that the env file is being read properly by HAPI as I can print my custom vars during cooking and they contain the right values. However the package does not seem to be loaded! We are missing hdas as the otl path was not updated with the one from our package
I can also say that the env file is correct as if I put its content to the C:\Users\heya\Documents\houdini18.0\houdini.env and launch HoudiniFX, the package gets loaded and everything is working, not when triggered from HAPI though
I have also tried using hapi: HAPI_SetServerEnvString(m_Session, “HOUDINI_PACKAGE_DIR”, “D:\mypath\packages;&;”);
When cooking I can print the HOUDINI_PACKAGE_DIR variable, its there. But ignored.
If I copy the package file to C:\Users\user\Documents\houdini18.0\packages, it all starts working, however does not meet my requirement of loading the packages from some other location.
I've responded to your bug about this, but posting it here for others as well:
By design, HOUDINI_PACKAGE_DIR is only supported when set in the process environment before launching Houdini or HARS (i.e. HAPI server). It is not supported when specified via houdini.env. The reason is that the packages are processed before houdini.env, and are in fact, meant to replace houdini.env.
Another option is to start the HARS server manually (instead of using HAPI_StartThriftNamedPipeServer or HAPI_StartThriftSocketServer) in a new process with the HOUDINI_PACKAGE_DIR environment variable set beforehand. Then connect to it with HAPI_CreateThriftNamedPipeSession or HAPI_CreateThriftSocketSession. So basically you have your own version of HAPI_StartThriftNamedPipeServer / HAPI_StartThriftSocketServer, where you can set up your own environment for it.
For those of you using Shotgun Desktop to launch Houdini, you will have to set the environment variables in the “Before App Launch Hook” python script ( in the project configuration )