Tutorial / 17 October 2020

Displaying certain Knob Values on Nuke Nodes

Purpose: Displaying Knob values can be very useful to visually see certain knob values in the node graph within nuke and can save time opening up the node and checking certain values or knobs.


Step 1.

How to Obtain Knob names: Simply move your curser over the knob you wish to display . A yellow pop up window will appear with the name and explanation of the knob function. 

Example: Below is a merge node and the knob name is "bbox" written in bold.z




Step 2.

Typing in Knob to display: In the Node tab in the label is where you can type the code to display the knob on the node.

Example: 

([value bbox]))



We can take this further by adding more for example the mix knob.

mix: [value mix] ([value bbox])

An Example but using Percentage for the mix.

mix: [expr {[value mix] * 100}]% ([value bbox])

or 

[expr {[value mix]<1? " [expr [value mix] * 100]%" : ""}]





Summary: Find out the Knob name and added that into the code, like below replace knob name with the actual name.

[value "knob name"]


Downside to doing this is you would have to copy this code to every node every time you make it, this can be time consuming and not practical. So how to fix this?


In your .nuke folder there should be a file called menu.py simply open that up in text editor and add the follow.

nuke.knobDefault("Merge.label", "mix: [value mix] ([value bbox])")

Once you have added the code save and restart nuke and now every time you make a merge node it will also display the mix and the Set bbox to values on the node itself.


Below I had added some useful ones I find handy.

#blur node
nuke.knobDefault("Blur.label", "size: [value size]")
#Multiply node
nuke.knobDefault("Multiply.label", "value: [value value]")
#Saturation node
nuke.knobDefault("Saturation.label", "saturation: [value saturation]")
#Merge node
nuke.knobDefault("Merge.label", "mix: [value mix] ([value bbox])")
#Dot node - size
nuke.knobDefault("Dot.note_font_size", "35")
#Dot node - colour
nuke.knobDefault("Dot.note_font_color", "0xffffff")
#Shuffle node
nuke.knobDefault("Shuffle.label", "<b>[value in]</b> &rarr; [value out]")
#ShuffleCopy node
nuke.knobDefault("ShuffleCopy.label", "<b>[value in]</b> &rarr; [value out]")
#DeepMerge node
nuke.knobDefault("operation.label", "operation: [value size]")
#Exposure node
nuke.knobDefault("Exposure.label", "[value mode]: [value red]")
#Tracker node
nuke.knobDefault("Tracker.label", "[value transform] <br> Ref Frame:[value reference_frame]")



The Shuffle node was updated in nuke 12 so the new code for them would be: 

#Shuffle node

nuke.knobDefault("Shuffle.label", "<b>[value in1]</b> &rarr; [value out1]")



Sometimes artist merge extra channels using the merge node and it can be hard to spot specially when you have just picked up something from others.

BASIC REVEAL:

[if { [value also_merge] != "none" } { return [value also_merge] } { return "" }]



TEXT LABELING FUNCTION:

[if { [value also_merge] != "none" } { return [format "also merge %s" [value also_merge]] } { return "" }]



NOW WITH COLOUR CHANGING:

[if { [value also_merge] != "none" } { return [format "also merge <font color=red>%s</font>" [value also_merge]] } { return "" }]