I'm trying to use python to parse $HIP and define variables in houdini. Each Variable Project_Code, Sequence, Shot, and Task can be indeterminant length, so I only really know by the / what each value means. Since I can only use set -g in hscript how would I set these variables?
For instance version is based on hipname, but I need to do somethign like:
hou.hscript('set -g PROJECTCODE' = `pythonexprs("hipSplit[1]")` )
Which doesn't work in context.
$HIP = P:\projects\Project_Code\Sequence\Shot\Task\
--------------------------------------------------------------------
import hou path = hou.hscriptExpression('$HIP') hipSplit = path.rsplit('/')[1:] ## hipSplit example ['projects', 'Project_Code', 'Sequence', 'Shot', 'Task']
## Sets houdini variable $PROJECTCODE ## PROJECTCODE = hipSplit[1]
## hipSplit[1] is Project_Code
etc...
## Sets houdini variable $VERSION hou.hscript('set -g VERSION = `evals(substr($HIPNAME,0,evals(strlen($HIPNAME)-4)))`')
----------------------------------------------------------------------
Thanks
-Ben