Explains the value of using Relative Addressing in Nuke scripts and offers several workflow examples. Different directory structure examples are demonstrated and how the artist formats the pathname fields for each one.
- [Voiceover] Hi, this is Steve Wright welcoming you to this week's Nuke Nugget, How To Use Relative Addressing In Your Nuke Scripts. By default, all the read nodes in your Nuke script will have absolute addresses to the images. That is to say the full and verbose path name on your machine to where the image is located. I'll open up this read node, let me float that here, and here you go. There is the absolute path name. Problem is if you move the project to another machine, it'll have different path names to those same images and you'll have to go in and reconnect all the media manually.
Relative addressing solves that problem by making the path to images relative to where the Nuke script is located. Let me close this. Here's how it works. I'm going to open up Project Settings. Float that. Your Nuke script is located here. Relative addressing looks in the folder where your Nuke Script lives and relative to that goes to fetch the images. Now, you used to have to type in a little Python construct in this field here to make it work, but the Foundry recently added this lovely button right here, click and you're done.
The only other thing you have to do is correctly format the image path names in the read node, which I'll show next. We'll close this and go get our next script. This is the first case where all the images and the Nuke script are in the same folders. Let's open up one of these read nodes and you can see the construct here and the setup, the arrangement is right here. All three of these are in the same folder.
Nuke goes and finds what folder the Nuke script is in and then it says, "Okay, from there, I'm just going to "look for image_A.tif, which is right next to it in the same folder. Let's take a look at case two and we'll open this read node. You'll notice something new has been added. There's a folder in front of the image name. That's because in case two, the Nuke script is here, but the images are in a sub folder. We're telling Nuke from where the Nuke script is, go look in the folder Images and down there, you will go find your pictures and that's exactly what this says.
Go to the Images folder and go pull in that picture. Okay, so far very straight forward. Not at all confusing. Let's go look at case three and we'll open up this read node and now we've got some more funny business going on here, so what's that all about? In this case, the Nuke scripts are in their own separate sub folder here. That's what this little construct is right there. It says, "From where you find my Nuke script, "go up one layer, then look for a folder called Images," which is what we have right here.
Here's what that says. Find the Nuke script folder, go up one level to this level, and then go down into the Images folder and go get your images. If the Nuke scripts are in several sub folders down, you have to add more of these ../. ../, for example, would mean that it was three sub folders down. This construct says, "Go up three folders, "look inside a folder called Images, "and go fetch image_A.tif." There you have it.
Use relative addressing in your Nuke scripts if there's any chance of having to port the job to another machine. Be sure to check in next week so you don't miss out on my next Nuke Nugget.
What kinds of NUKE tips do you need? Join the Steve Wright's NUKE NUGGETS group on LinkedIn, and post your requests there.