Creating gizmos, no matter how simple, and even if just for your own use, is a good way to speed up the way you work. Saving one or two clicks on many tasks, on many shots adds up over the course of a day! Although, there are some things to keep in mind when doing so.
Always save your Gizmos as Groups.
Clicking the “export as gizmo” button is an easy way to save a group as a .gizmo file, although doing so can cause some fatal compatability issues when another artist without your gizmo picks up your Nuke script, or you try to render on the farm.
There are two simple ways to get around this:
Firstly, you can click , Save the file, and open in a text editor. Make the following changes.
Without specifying the name your Group will be called Group…
The second way to do this is to create a new file in your .nuke directory, name it myGizmo.gizmo, open it up in a text editor, and copy/paste the Group directly from Nuke!
Remove parent. from expression-linked knobs.
When CTRL+dragging one knob to another to create an expression link, Nuke automatically adds parent. to the start.
While this is technically & hierarchically correct, it’s an unnecessary step that can sometimes cause problems. Have you ever copy / pasted a gizmo around your Nuke script and found it creates expression-links between said copies? This is why…
Name your inputs appropriately.
Does your gizmo have inputs that expect certain things? Try to name them appropriately, and to the same standards as Nuke’s default nodes when applicable.
Tip: The first Input node you create is automatically called Input1 when created. Rename to Input to remove the label from the input of your gizmo.
If your gizmo expects an alpha channel, add some error handling.
If your gizmo requires a specific set of data, such as an alpha channel, and it doesn’t get it, it will throw an error in most circumstances. This is problematic — our gizmos should never prevent us from seeing an image!
This is what the inside of our gizmo looks like…
It’s erroring because the A-Pipe needs an alpha channel. But what happens if we don’t want to use the mask? Thankfully, the fix is fairly straight-forward.
In this case, we want to dynamically detect if the mask input is connected to anything. We can do that by adding an expression to the Copy node’s disable knob: ![exists parent.input1]
In English, this expression reads: “If input1 (which is our mask input. Input is input0) is connected, return a value of 1.” The ! at the start returns the inverse, so it equals 0.
But hang on, didn’t we just talk about parent. being unsavoury? Yep, but in this case, it’s the easiest way to get the job done, and for whatever reason, it doesn’t provide us with the annoying copy / paste expression arrow error.
But because we should try not to use parent., here’s another way to do the same thing.
Add a checkbox knob to your mask input node, like so:
Now, we can add a similar expression to this checkbox knob.
Now we can link our Copy node’s disable knob to the mask input’s check_connected checkbox, like so:
We’re using ! again, because we want the inverse value. When the mask input is not connected, the disable knob should be checked.
Context is important to touch on here… Calling input1 inside the gizmo is looking at the input node itself. Calling input1 outside the gizmo (for example, if you were to add a knob to myGizmo) will refer to the gizmo as it’s own node. This is why we used parent.input1 in the first example because we wanted to change the context to myGizmo as a node, rather than an element inside the gizmo.
Don’t use format-dependent nodes.
Format-dependent nodes are nodes with a format knob, such as Reformat, Constant, etc. These knobs default to whatever root.format is in your project settings; it’s a little dangerous to presume that a user’s project format will set up everything in your gizmo to do the right thing…
Instead, it’s better to get your format from an input. As an example, let’s say we want to create a Radial that fits perfectly in our image’s format. We can create a Shuffle node, connected to an input node, with everything set to black.
Create a Radial underneath, and set some expressions which refer to input.
Now, no matter what your image or project format is, you’re sure that the radial will behave predictably.
Always add help!
There are plenty of gizmos available that tackle similar problems in different ways. Before releasing your gizmo to the world, it’s a sensible idea to Right-click on your gizmo and click Edit help.
Typing a short description of the problem your gizmo solves, and how it does so, can be incredibly useful for someone who is using your gizmo for the first time!
I hope these tips will help make your Gizmos error-free, and bulletproof!