Skip to content

Instantly share code, notes, and snippets.

View kpprt's full-sized avatar

Christian Kauppert kpprt

View GitHub Profile
@kpprt
kpprt / CS_AdvancedRect.tcl
Last active April 18, 2018 08:33
A more versatile, parametric and feathered Rectangle for Nuke.
Group {
name CS_AdvancedRect1
addUserKnob {20 CS_AdvancedRect}
addUserKnob {19 color}
color 1
addUserKnob {6 color_panelDropped l "panel dropped state" -STARTLINE +HIDDEN}
addUserKnob {15 from}
from {480 270 1440 810}
addUserKnob {15 to}
to {0 0 1920 1080}
@kpprt
kpprt / CS_UVTransform.tcl
Created March 26, 2018 11:16
Transform with normalized UV values.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_UVTransform1
tile_color 0xa57aaaff
addUserKnob {20 CS_UVTransform}
addUserKnob {41 uvPosition l "UV Position" T Transform1.uvPosition}
addUserKnob {41 uvSize l "UV Size" T Transform1.uvSize}
addUserKnob {41 uvCenter l "UV Center" T Transform1.uvCenter}
@kpprt
kpprt / comp_stats.py
Created September 12, 2017 10:22
Print out stats about a comp in Nuke. Returns a list of used node classes and their number of occurrences.
stats = dict()
for n in nuke.allNodes():
node_class = str(n.Class())
if node_class in stats:
stats[node_class] += 1
else:
stats[node_class] = 1
import operator
@kpprt
kpprt / version_info.tcl
Created September 8, 2017 18:37
A special workflow node for Nuke that shows the current version of the connected input in its label.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
NoOp {
name Version1
knobChanged "if nuke.thisKnob().name() == 'inputChange':\n label = nuke.thisNode().knob('label')\n label.setValue(label.getValue())"
label "\[if \{\[exists \[topnode].file]\} \{return \[string range \[regexp -inline \"_v\\\[0-9]*\" \[value \[topnode].file]] 1 end]\} \{\}]"
note_font_size 50
selected true
xpos -810
@kpprt
kpprt / link_knob_panel.py
Created September 5, 2017 09:43
Small panel for Nuke to add a user knob to a selected node which is linked to a certain knob of another node. This basically works like the Pick Button, but for all nodes of the comp instead of just the containing nodes.
@kpprt
kpprt / CS_ChromaticAberration.tcl
Last active April 5, 2018 13:15
Creates a Chromatic Aberration in Nuke. It utilizes the LensDistortion node to scale the color channels stronger around the edges. There is also an option to blur the distortion for each channel.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_ChromaticAberration1
tile_color 0xcc804eff
addUserKnob {20 CS_ChromaticAberration}
addUserKnob {20 Red_Cyan l Red/Cyan n 1}
addUserKnob {41 distortion1_red l "Radial Distortion 1" T LensDistortionRed.distortion1}
addUserKnob {41 distortion2_red l "Radial Distortion 2" T LensDistortionRed.distortion2}
@kpprt
kpprt / CS_MapValue.tcl
Last active August 31, 2017 11:07
A utility node for Nuke to map values from a certain range to a certain range.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_MapValue1
label "Output: \[value out]"
selected true
xpos 400
ypos -88
addUserKnob {20 CS_MapValue}
@kpprt
kpprt / CS_DistanceBetween.tcl
Created August 31, 2017 10:51
Calculate the distance between two 3D objects (Camera, Axis) in Nuke. 3D distance needs the two objects, 2D distance also needs a Camera input and an optional format when different from the root format.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_DistanceBetween1
tile_color 0x9c0000ff
label "Distance2D: \[value Distance2D]\nDistance3D: \[value Distance3D]"
selected true
xpos 290
ypos -95
@kpprt
kpprt / CS_NoiseDistort.tcl
Last active September 13, 2017 14:43
Create a fast distortion that is based on a noise in Nuke. Simulate heat, water or make shapes wobble.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_NoiseDistort1
tile_color 0xa57aaaff
selected true
xpos 9530
ypos 6206
addUserKnob {20 CS_NoiseDistort}
@kpprt
kpprt / CS_RoughenEdges.tcl
Created August 30, 2017 09:42
Can be used to make soft edges rougher in Nuke. It applies a noise to semi-transparent alpha regions. Hard edges can be preblurred to create soft edges.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_RoughenEdges1
help "Adds a noise to semi-transparent alpha. This way all soft edges are roughened. Hard edges shouldn't be affected."
tile_color 0xcc804eff
selected true
xpos 2270
ypos -2746