Instantly share code, notes, and snippets.

# Jed Smithjedypod

• Sort options
Created May 3, 2014
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:
Created Aug 8, 2014
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 }
Last active Aug 29, 2015
Map commonly used Nuke functionality to the left hand: frame advancing and stereo view-switching.
View LeftHand_Shortcuts
Created Sep 30, 2015
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', [])
Created Nov 12, 2015
View node_handler.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]))
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
Last active Aug 23, 2016
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()
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
Created Apr 6, 2017
My linux rsync time machine script
View rsync-time-machine.py
 #!/usr/bin/python """ Karl's unix/rsync time-machine script. Maintains daily and monthly snapshots of a directory tree, hard linked to save space when files don't change. Inspired by http://www.mikerubel.org/computers/rsync_snapshots/, but using more robust coding practices. Features:
You can’t perform that action at this time.