Skip to content

Instantly share code, notes, and snippets.

View kpprt's full-sized avatar

Christian Kauppert kpprt

View GitHub Profile
@kpprt
kpprt / CS_PSCrop.tcl
Created July 25, 2017 08:16
Simple Crop that works like the change canvas size function in Photoshop. Its intended to be used to crop mattepaintings that have been extended over the size of the frame. It can also be used to find out how much mattepainting outside the frame is needed due to camera movement. Afterwards the crop can be inverted to fit the frame again (the ext…
set cut_paste_input [stack 0]
version 10.5 v4
push $cut_paste_input
Group {
name CS_PSCrop1
tile_color 0xa57aaaff
selected true
xpos -1690
ypos -466
addUserKnob {20 CS_PSCrop}
@kpprt
kpprt / open_file_folders.py
Last active August 23, 2017 15:19
Calling this script in Nuke opens all file paths in the Explorer/Finder within the current selection of enabled nodes. It can also recurse into enabled groups and apply a filter that only opens paths from specific types of nodes, e.g. Read or Write.
import os
import platform
import subprocess
def open_file_folders(nodes, filter = None, recurseGroups = True):
for n in nodes:
if n.knob('disable') and n['disable'].value() == True:
#print 'skipping {0} because it is disabled'.format(n['name'].value())
continue
if recurseGroups and isinstance(n, nuke.Group):
@kpprt
kpprt / CS_CameraShake.tcl
Last active September 1, 2017 11:27
A more advanced camera shake generator for Nuke that combines up to 3 shakes of different frequencies and amplitudes. It also provides an auto-scale function and a shake curve preview.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_CameraShake1
tile_color 0x9c0000ff
selected true
xpos 2820
ypos -1210
addUserKnob {20 CS_CameraShake}
@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
@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_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_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_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 / 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 / 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