Skip to content

Instantly share code, notes, and snippets.

View kpprt's full-sized avatar

Christian Kauppert kpprt

View GitHub Profile
@kpprt
kpprt / reload_all_nodes.py
Created March 17, 2016 15:59
Reload all nodes with a reload button in Nuke
for n in nuke.allNodes():
r = n.knob('reload')
if r != None:
r.execute()
@kpprt
kpprt / render_sequentially.py
Created March 7, 2016 18:14
Render all selected nodes one after another in Nuke
import nuke
for n in nuke.selectedNodes():
if n.Class() != 'Write':
continue
print 'Executing ' + n.name()
nuke.execute(n)
@kpprt
kpprt / reload_all_precomps.py
Created March 7, 2016 18:10
Reload all precomps in a Nuke comp
import nuke
for n in nuke.allNodes():
k = n.knob('reload_script')
if k != None:
print 'reloading ' + n.name()
k.execute()
@kpprt
kpprt / get_maximum_frame_range.py
Last active January 14, 2016 14:03
Get the maximum frame range of all write nodes in Nuke
import nuke
in_min = sys.maxint
out_max = -sys.maxint
for n in nuke.allNodes():
if n.Class() == 'Write':
n_in = int(n.knob('first').getValue())
n_out = int(n.knob('last').getValue())
if(n_in < in_min):
in_min = n_in
@kpprt
kpprt / CS_AutoBBox.tcl
Last active September 2, 2017 09:50
Autocrop node for Nuke. Basically just a CurveTool setup with some links and presets for autocropping.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_AutoBBox1
selected true
xpos -8180
ypos -3184
addUserKnob {20 CS_AutoBBox}
addUserKnob {41 color T CurveTool1.color}
@kpprt
kpprt / CS_PositionToDepth.tcl
Last active March 20, 2018 14:39
Converts a world position pass (Input 1, Channels RGB) to a camera (Input 2) relative Nuke depth pass. CAUTION: Does not work with retimed camera input!
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_PositionToDepth
}
Input {
inputs 0
name InputWPP
xpos -920
@kpprt
kpprt / CS_FixFrames.tcl
Last active July 1, 2016 14:56
Interpolate between frames to restore broken frames in Nuke.
set cut_paste_input [stack 0]
version 9.0 v8
push $cut_paste_input
Group {
name CS_FixFrames1
addUserKnob {20 CS_FixFrames}
addUserKnob {3 first_frame_to_fix l range}
first_frame_to_fix 1
addUserKnob {3 last_frame_to_fix l "" -STARTLINE R 0 100}
last_frame_to_fix 1
@kpprt
kpprt / CS_JelloEffect.tcl
Created September 16, 2015 14:49
Create a simple Jello Effect in Nuke. It is basically just a lens distortion node with auto scaling functionality.
set cut_paste_input [stack 0]
version 9.0 v5
push $cut_paste_input
Group {
name CS_JelloEffect1
selected true
xpos -2900
ypos 1166
addUserKnob {20 CS_JelloEffect}
addUserKnob {7 effect R -1 1}
@kpprt
kpprt / CS_SnappyBackdrops.py
Last active August 29, 2015 14:26
Automatically resize and snap backdrops to the grid in Nuke
import nuke
prefs = nuke.toNode('preferences')
grid_width = prefs['GridWidth'].getValue()
grid_height = prefs['GridHeight'].getValue()
def resize_to_grid():
n = nuke.thisNode();
k = nuke.thisKnob();
if knob_to_grid(k, 'bdwidth', grid_width) or knob_to_grid(k, 'bdheight', grid_height):
@kpprt
kpprt / CS_SoftTiler.tcl
Last active August 29, 2015 14:25
Tiling Helper for Nuke that blends between offsetted repeated pixels
set cut_paste_input [stack 0]
version 9.0 v5
push $cut_paste_input
Group {
name CS_SoftTiler1
selected true
xpos 0
ypos 0
addUserKnob {20 SoftTiler}
addUserKnob {12 offset}