Easily switch any value for another in a hipfile.
Going through and manually swapping $HIP
for $JOB
, or switching any value for another noe in an entire hipfile can be a real pain. You could try going the long way (looking at each parm and changing by hand…ouch!), or by iterating all the parms on all the nodes with Python. Or, you can use a simple built-in HScript command: opchange
.
opchange
makes it really simple to swap values across the entire scene, or over a limited scope of nodes.
Example
Let’s say you were loading a bunch of HDRIs from some sort of library you have elsewhere on disk, but now you need to share the project with someone else. You’ve copied all the light textures from you library location into $JOB/tex
, but now you need to change all the paths on the lights in your hipfile. We can use opchange
to make it a bit easier.
|
|
Now all references to D:/Library/HDRI
should have been replaced with $JOB/tex
.
Gotchas
If you’re swapping a variable, and you want to search for the unexpanded version, ie the literal string $HIP
, make sure to escape the $
with a \
, otherwise Houdini will be searching for the expanded versions, like ~/project/myproject
or wherever $HIP
is pointing to instead.
|
|
Limit the Scope
We don’t have to search the entire scene in this case, since we know that all of our lights are going to exist at /obj
.
|
|
Duplicated a node and want to change the new node’s parm reference? Use the -i
flag.
|
|