Skip to content

Instantly share code, notes, and snippets.

Jed Smith jedypod

Block or report user

Report or block jedypod

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Time offset start and end of all rotoshapes
# Time offset start and end of all rotoshapes
import nuke.rotopaint as rp, _curvelib as cl
# Amount of frames to offset
time_offset = -200
t = nuke.frame()
# Get all Roto or RotoPaint nodes and loop through them
roto_nodes = [n for n in nuke.allNodes() if 'Roto' in n.Class()]
for roto_node in roto_nodes:
View nan_inf_to_average
Expression {
expr0 "isinf(r) ? ((r(x+1,y)+r(x+1,y+1)+r(x+1,y-1)+r(x,y+1)+r(x,y-1)+r(x-1,y+1)+r(x-1,y)+r(x-1,y-1))/8) : r"
expr1 "isinf(g) ? ((g(x+1,y)+g(x+1,y+1)+g(x+1,y-1)+g(x,y+1)+g(x,y-1)+g(x-1,y+1)+g(x-1,y)+g(x-1,y-1))/8) : g"
expr2 "isinf(b) ? ((b(x+1,y)+b(x+1,y+1)+b(x+1,y-1)+b(x,y+1)+b(x,y-1)+b(x-1,y+1)+b(x-1,y)+b(x-1,y-1))/8) : b"
expr3 a
name infToAverage
selected true
xpos -68
ypos -273
}
@jedypod
jedypod / LeftHand_Shortcuts
Last active Aug 29, 2015
Map commonly used Nuke functionality to the left hand: frame advancing and stereo view-switching.
View LeftHand_Shortcuts
# Add these to the menu.py in your ~/.nuke or NUKE_PATH folder
# Viewer Shortcuts
nuke.menu('Viewer').addCommand("Next Frame", lambda: nuke.activeViewer().frameControl(1), "shift+f")
nuke.menu('Viewer').addCommand("Previous Frame", lambda: nuke.activeViewer().frameControl(-1), "shift+d")
nuke.menu('Viewer').addCommand("Next Keyframe", lambda: nuke.activeViewer().frameControl(2), "ctrl+shift+f")
nuke.menu('Viewer').addCommand("Previous Keyframe", lambda: nuke.activeViewer().frameControl(-2), "ctrl+shift+d")
# Swap stereo views: requires eyes to be named as lname and rname
lname = "L"
View bake_roto.py
import nuke.rotopaint as rp, _curvelib as cl, nukescripts, nuke, math, time
class ShapePanel(nukescripts.PythonPanel):
def __init__(self, node):
nukescripts.PythonPanel.__init__(self, 'RotoPaint Elements')
self.rp_node = node
self.frame_range = nuke.String_Knob('frame_range', 'Frame Range', '{0}-{1}'.format(nuke.root().firstFrame(), nuke.root().lastFrame()))
self.type_filter_knob = nuke.Enumeration_Knob('element', 'Element Type', ['Shapes', 'Strokes'])
self.element_knob = nuke.Enumeration_Knob('curve', 'Curve', [])
self.cv_knob = nuke.Enumeration_Knob('cv', 'CV', [])
View node_handler.py
import nuke, operator
'''
## Add these lines to your menu.py after putting this file somewhere in your NUKE_PATH
# Manipulate nodes in the node graph
import node_handler
nuke.menu('Nuke').addCommand('Edit/Node/Move/Right', 'node_handler.move(1,0)', 'alt+meta+Right')
nuke.menu('Nuke').addCommand('Edit/Node/Move/Left', 'node_handler.move(-1,0)', 'alt+meta+Left')
nuke.menu('Nuke').addCommand('Edit/Node/Move/Up', 'node_handler.move(0,-1)', 'alt+meta+Up')
@jedypod
jedypod / render_writes_with_ranges.py
Last active Jan 27, 2016
Render Selected Writes with Individual Frame Ranges - renders each selected write node with the input frame range of that node instead of a single framerange.
View render_writes_with_ranges.py
import nuke
# nuke.menu('Nuke').findItem('Render').addCommand('Render Selected with Ranges', 'render_writes_with_ranges.render()')
def render():
gui_render = False
write_nodes = nuke.selectedNodes()
write_nodes.sort()
# Get all writes and frame ranges
writes = dict(zip([w for w in write_nodes], [w.frameRange() for w in write_nodes]))
@jedypod
jedypod / DOLLAR_GUI_HANDLER.nk
Created Jul 7, 2016
DOLLAR_GUI_HANDLER is a node to remove $gui expressions on Nuke nodes in a script. It is based on $gui Expression Finder by Falk Hofmann, but the code is re-written to be more robust, and to have functionality to remove $gui expressions as if the script were being rendered on the farm, instead of reverting back to the GUI values.
View DOLLAR_GUI_HANDLER.nk
NoOp {
name DOLLAR_GUI_HANDLER
tile_color 0xd94848ff
hide_input true
addUserKnob {20 Handler l "\$gui Handler"}
addUserKnob {1 nodelist}
nodelist "H_high_low_switch.Switch1, RF_Yorktown_DEFOCUS.SHIT_SWITCHER, RF_Yorktown_BG1.ScanlineRender4, ScanlineRender1"
addUserKnob {26 ""}
addUserKnob {22 find_gui_nodes l "Find \$gui Nodes" T "# Find all nodes with knobs that have \$gui expressions\nnodelist = \[]\nfor node in nuke.allNodes(recurseGroups=True):\n for knob in node.knobs():\n if node\[knob].hasExpression():\n if '\$gui' in node\[knob].toScript():\n if node not in nodelist:\n nodelist.append(node)\n\nnodelist_comma = ', '.join(\[item.fullName() for item in nodelist])\nprint nodelist_comma\nnuke.thisNode()\['nodelist'].setValue(nodelist_comma)" +STARTLINE}
addUserKnob {22 remove_gui_expression l "Remove \$gui Expression" -STARTLINE T "# Remove \$gui expression\n#thisNode = nuke.selectedNode()\nthisNode = nuke.thisNode()\nnodelist_comma = thisNod
View convert.py
#!/usr/bin/env python
from __future__ import with_statement
import os, re, argparse
# Convert one machine code format to another -
# rename this with no py extension, make it executable, and put it in your bash PATH to make it a commandline tool
# This uses the argparse module to parse args to the commandline tool
parser = argparse.ArgumentParser()
@jedypod
jedypod / ColorTracker.nk
Last active Mar 12, 2017
ColorTracker: A wrapper for the CurveTool, which allows you to analyze color change over time of an input, and apply that data to a grade in matchmove or stabilize mode around a specified reference frame. Because I am bad at remembering math.
View ColorTracker.nk
Group {
name ColorTracker
addUserKnob {20 ColorTracker}
addUserKnob {26 instructions_text l <b>Instructions: T "1). Stabilize your plate around the area you want to track\n2). Crop your plate to just the area you want to analyze\n4). Press Track Color to analyze the footage\n5). Create a matchmove or stabilize grade, and specify your reference frame\n6). You can scale the curve around a specified pivot value on the grade node \n using the color_pivot and color_mult knobs in the ColorTrack tab"}
addUserKnob {26 ""}
addUserKnob {26 label_trackcolor l "<b>Track Color" T " "}
addUserKnob {41 track_color l "Track Color" t "This button will track the color change over the specified framerange and put the data into the intensitydata knob." T CurveTool.go}
addUserKnob {41 intensitydata T CurveTool.intensitydata}
addUserKnob {26 ""}
addUserKnob {26 label_apply_color_track l "<b>Apply Track" T " "}
@jedypod
jedypod / BreakdownTransition.nk
Last active Mar 25, 2017
Breakdown Transition
View BreakdownTransition.nk
Group {
name BreakdownTransition
addUserKnob {20 Breakdown}
addUserKnob {4 transition_type l "Transition Type" M {Dissolve Wipe "Depth Wipe"}}
transition_type Wipe
addUserKnob {3 start_frame l "Start Frame" t "The frame to start the transition on"}
start_frame 1001
addUserKnob {22 set_current_frame l Current t "Sets the start frame to the current frame" -STARTLINE T "n = nuke.thisNode()\nn\['start_frame'].setValue(nuke.frame())"}
addUserKnob {3 transition_length l "Transition Length"}
transition_length 6
You can’t perform that action at this time.