I have made a little script which create correctly named folders and sub-folders.
I have added a line which create an empty hip file (pretty dummy way to do it: Houdini warns me that it's not a correct scene but nicely launch it anyway and complete it).
My problem is that I would like to set some variables on the fly:
Example:
my script is launched in C:/PROJECTS/ and create a folder "MYSHOT", inside there is a sub folder named "3D", inside it there is another subfolder named "WIP" and inside it (finally) there is my hip file "myshot_v001.hip". so basically:
C:/PROJECTS/MYSHOT/3D/WIP/myshot_v001.hip
At the same level of WIP, there is another folder named "CACHE".
and I would like add a variable called CACHE and pointing in that specific folder:
C:/PROJECTS/MYSHOT/3D/CACHE
I know that the command to do it is "set -g CACHE = 'C:/PROJECTS/MYSHOT/3D/CACHE' " and I guess a way to do it is to use the $HIP variable.
I tried to write a script in a 456.py file put in C:\Program Files\Side Effects Software\Houdini 18.####\python27\Scripts
#python import os import sys #houdini import hou ROOT = str(hou.expandString('$HIP')) size = len(ROOT) BROOT = ROOT[:size-4] hou.hscript("set -g CACHE = "+BROOT+"CACHE")
I was expecting that the variable would be created at the opening of the hip file, but my first try was a failure.
However it works fine in the shelf
Would someone have any idea how to do it?
Thanks in advance