Using the Textport to Update Paths in Any String Channel
If you need to update a ton of nodes with the wrong path and you don’t wanna do it by hand, you can run this function in the Textport Console to update them all. Pretty handy for FBXs and such.
For example, let’s say that I have an absolute path pointing to my project, but want to use a variable instead I can run the following line to make the change:
opchange "C:/Projects/2021/The_Windmill" '$JOB'
In this case it’s important to enclose ‘$JOB’ in single quotes otherwise it’ll expand to the full path. Credit to Dave Stewart for pointing this out. Thanks Dave!
And of course, if you wanna know more about this function and other forms of it, make sure you check its documentation on SideFX’s website.
Jan 5th, 2021
Get Part of a String (a Substring)
I’m currently working as an intern for The Artery in NYC (although remotely thanks to some weird pandemic going on), and by accident I ended up rendering something to the wrong directory. The folder is the shot name and the shot name is partly contained in the $HIPNAME variable, so in order to make sure I didn’t mess it up, I ended up making use of this very handy Hscript function: substr(). The best way to explain what this does is the one SideFX has in their documentaition: “Returns the characters of s between the start position and the start + length position.”
To ellaborate, let’s say the Output path was something like:
And the $HIPNAME would evidently be something like: ABCD_sh0100_FA_v01.hip, right? so it would be easy to make the current path something like the following:
$JOB/007_Renders/`substr($HIPNAME, 0, 10)`/$HIPNAME/$HIPNAME.$F4.exr
This way if I use this standard in the hip file of every scene, I can make sure that as long as I keep the naming convention consistent, I don’t have to worry about the rendered images going into their corresponding folder.
Jan 17th, 2021
Custom Shortcuts in Your File Open Window
If you add a text file to your Houdini folder (C:\Users\Username\Documents\houdini18.5) and name it jump.pref, you can manually add custom shortcuts that will show up in the File Open Window. For example, let’s say I want a shortcut to the desktop, I can type the path to it in this file like:
While in Houdini, it will show up in the locations list right under $HIP, $JOB and $TEMP. But what’s even better is that you can create custom variables to use in your projects and have them show up here as well. It takes a teeny tiny bit of extra work, but it’s so worth it. For example, you want a large project to have a custom arbitrary variable; let’s say we want it to be $XYZ. You can put it right in the jump.pref file. Next you need to open up your Houdini.env and add it there too. To make it clear, let’s say $XYZ points to a folder in your documents:
This means that in your Houdini.env you’ll have to add a line establishing that custom variable like so:
XYZ = C:\Users\Username\Documents\XYZ project
If you set up everything correctly, you’ll see the shortcut in the File Open window and if you click it, it will take you to the correct folder. And the bestest thing is that you can use this variable as a path in every string of your files and when passing along to someone else, if they have set their variable correctly and their project structure is the same, nothing would break, isn’t this neat?