Tutorials of the month: Nuke Customization

It is time to post a new tutorial, and this time I want to give you some tips on doing customization for a better workflow. As you probably know, Nuke is based on the programming language TCL, and with the help of some scripting knowledge you can easily set up some hotkeys or preferences. Now let’s start:
The first thing I will explain is the way how you set up your own plugins folder. When you have installed Nuke, you will find a folder called plugins where a file called init.tcl is stored. Open this file in a texteditor and add the following command:
plugin_addpath “/Users/myname/nuke_plugins”

myname should be replaced with your username of course! and if you are on a windows system, then add the drive letter also, but be sure to use / and no backspace !! Now create the folder called nuke_plugins in the right place, and then create a new menu.tcl file in your text editor and store it inside your nuke_plugins folder. You have now told Nuke to look into your “nuke_plugins” folder everytime it is run, and you can simply place every plugin or gizmo inside your selfmade folder and access it via your own menu.tcl.
Continue

So if you have set up everything correctly you can now start to do some customization. The first thing I want to set up in Nuke is a default Format, a default FPS and a default ColorSpace. To do this simply add the following code to your menu.tcl, that is located in your “nuke_plugins” folder:

# Sets images to linear colorspace *****************

knob_default Root.transfer 1
knob_default Read.transfer 1
knob_default Write.transfer 1

# Sets FPS to 25 ***********************************
knob_default Root.fps 25

# Sets the default full and proxy formats to PAL:
knob_default Root.format PAL
knob_default Root.proxy_format PAL

When starting Nuke now, then pressing S you will access your Root Settings. They should look like the image below.

default settings

Your Default FPS is now 25, the Format is PAL and under LUT you will see that your preset curve is to linear.

As you see, the command “knob_default” followed by the Node name and the function you want to change, will set up your nodes with a custom setting.

So you can use this also for standard nodes, like the Blur node. Simply add

knob_default Blur.size 10

and you will get a Blur node with the size set to 10 everytime you create it. You can even tell a node which channels to output. For example

knob_default Write.channels rgba

will set up your Write node to output Red Green Blue and Alpha Channels as a standard. You can mess around with this sort of customization to set default values for your desired nodes.

So now let’s create some custom hotkeys !! I found it really annoying that there is no hotkey for the options: hide_input and postage_stamp , that are found in every node.

hide and postagestamp

so with the help of TCL you can easily create them on your own. Open a text editor and type in the following code:

proc HideInput {} {
foreach cur_node [selected_nodes] {
knob $cur_node.hide_input !$cur_node.hide_input
}
}

Save it as “HideInput.tcl” inside your “nuke_plugins” folder. Then add the following line to your menu.tcl:

menu “Other/HideInput” “+h” HideInput

When you start Nuke now, you can hide the input of a selected node by pressing Shift + h ! Your first selfmade hotkey is done!! Now you can try to create the hotkey for Postage_Stamp on your own. It is basically the same as we have done before, simply change your proc name (be aware to not use the word Postage_Stamp, because this command is already in use! so name it something like: PostageST !!) and use postage_stamp instead of hide_input. Finally save it to the right folder and set up your menu.tcl. One important thing to mention is, that your proc name should be the same as your TCL file name.
If you have problems creating it you can also download it here

So that’s it for now, hope you enjoyed this little programming tips and as you know I’m always happy to get some feedback.
Take care!

  1. Nand kishor

    Really great, the hot key script is really useful
    thanks

Post your thoughts