Nuke Scripts

FileDescriptionType
LockViewerLockViewer locks a selected node to a chosen viewer (1-10). Pressing the same viewer number on a different node results in showing up the 'locked' node.py
MoveNodesMoves selected Nodes straight via Shift+Up,Shift+Down, Shift+Left or Shift+Rightpy
SetRotoLifetimeAllThis script sets the Lifetime_Type Attribute of Roto's Strokes and Shapes to "All".py


Nuke/Python Snippets

# print all knobs of a selected node
for i in range (nuke.selectedNode().getNumKnobs()):
    print nuke.selectedNode().knob (i).name()
# print inputs (dependencies) of a selected node
for node in nuke.selectedNode().dependencies():
    print node.name()
# print outputs (dependents) of a selected node
for node in nuke.selectedNode().dependent():
    print node.name()
# DEBUG # Callback that echoes every action inside nuke
def onKnobChanged():
	n = nuke.thisNode()
	knob = nuke.thisKnob()
	print knob.name(), " = ", knob.value()
nuke.addKnobChanged(onKnobChanged)
# find dead branches / check for unconnected nodes
for node in nuke.allNodes():
   if not len(node.dependent()):
       if not node.maxOutputs() == 0:
           print node.name(), node['label'].value()
# disable cache attribute in allNodes
for a in nuke.allNodes():
   try:
       a['cacheLocal'].setValue(0)
   except:
       pass
   try:
       a['cached'].setValue(0)
   except:
       pass
# make a node unmoveable
s = nuke.selectedNode() 
y = s['ypos'].value() 
x = s['xpos'].value() 
s['knobChanged'].setValue(''' nuke.thisNode()['xpos'].setValue(x) nuke.thisNode()['ypos'].setValue(y) ''') 
# select "write" nodes in selection
for node in nuke.selectedNodes():
	if node.Class() == "Write":
		node.setSelected( True )
	else:
		node.setSelected( False )
# rerender 'matching' write nodes
for node in nuke.allNodes("Write"):
    if "enter_matching_string_here" in node['file'].value():
        print node.name()
        nuke.execute( node, 0, 0 ) # adjust frame range if needed
# get Strokes from Roto/Rotopaint Layer
def __getStrokes( self, layer ): 
	for element in layer: 
		if isinstance(element, nuke.rotopaint.Layer): 
			self.__getStrokes(element)
		elif isinstance(element, nuke.rotopaint.Stroke) or isinstance(element, nuke.rotopaint.Shape): 
			strokes.append(element)
	return strokes
# DependentChecker - with 2 nodes given, it checks recursively if the first node is dependent to the second
def DependentChecker( currentnode=None, searchednode=None ):
	found = 0
   #print currentnode.name(), " - ", len(currentnode.dependent(nuke.INPUTS))
	if currentnode.dependent(nuke.INPUTS):
		for n in currentnode.dependent(nuke.INPUTS):
			if n.name() == searchednode.name():
				found = 1
				#print "True -",searchednode.name(),"is dependent"
			elif found == 0:
				DependentChecker( currentnode=n, searchednode=searchednode )
		return True
# rename x to y in allNodes['label']
x = ''
y = ''
nodes = nuke.allNodes()
for node in nodes:
    searchsource = node['label'].value().rpartition("/")[2]
    if x in searchsource:
        print node.name()
        print node['label'].value().rpartition("/")[2]
        newfilename = node['label'].value().replace( 'x', 'y')
        node['label'].setValue(newfilename)
        print node['label'].value().rpartition("/")[2] +'\n'
# prints used footage folder (without duplicates)
from operator import itemgetter
nodes = []
NoDuplicatePaths = []
fnode = []
fpath = []
output = ''
fnodepathlist=[]

for node in nuke.allNodes("Read"):
	fnode.append( node.name() )
	fpath.append( node['file'].value().rpartition("/")[0] )
# fnodepathlist erstellen und sortieren nach paths . list = read1, pathofread1
fnodepathlist = zip( fnode, fpath )
fnodepathlist.sort( key=itemgetter(1) )
#reset fnode und fpath list to write sorted list
fnode = []
fpath = []
for item in fnodepathlist:
	fnode.append( item[0] )
	fpath.append( item[1] )
for item in list( set(fpath) ) :
	NoDuplicatePaths.append( item )
NoDuplicatePaths.sort()
order = 1
for item in NoDuplicatePaths :
	if order < 10:
		printorder = "0"+str(order)
	else:
		printorder = str(order)
	output += '%s : %s\n' % ( printorder, item )
	if order == len( list( set( fpath ) ) ):
		output += '\n'
	order = order+1

print output

'''
# Result:
01 : X:/Path/to/your/Footage/Folder/
02 : X:/Path/to/your/Footage/Folder/Folder1
03 : X:/Path/to/your/Footage/Folder/Folder1/Subfolder1
04 : X:/Path/to/your/Footage/Folder/Folder1/Subfolder2
05 : X:/Path/to/your/Footage/Folder/Folder2
06 : X:/Path/to/your/Footage/Folder/Folder3
07 : X:/Path/to/your/Footage/Folder/Folder4
08 : X:/Path/to/your/Footage/Folder/Folder4/Subfolder1/Subfolder1
09 : X:/Path/to/your/Footage/Folder/Folder4/Subfolder1/Subfolder2
10 : X:/Path/to/your/Footage/Folder/Folder5
'''
# various tcl commands
#create write node with filename from topmost read node:
[lindex [split [lindex [split [knob [topnode].file] .] 0] /] end]

#gets labelname of input's input
[value input.input[value input.which].label]

#Root dir:
[file dirname [knob [topnode].file]]

#File name:
[file tail [knob [topnode].file]]

#File extension:
[file extension [knob [topnode].file]] 
# traverse every file and directory in a directory tree
import os
for dirname, dirnames, filenames in os.walk('.'):
    for subdirname in dirnames:
        print os.path.join(dirname, subdirname)
    for filename in filenames:
        print os.path.join(dirname, filename)
# prints the used channels used by selected nodes
nodechannels = []
for node in nuke.selectedNodes():
	for channel in node.channels():
		nodechannels .append( channel )

channels_noduplicates = set( nodechannels  )

print '\n'.join( sorted( channels_noduplicates ) ) 

Dualscreen Wallpapers

Botanic Garden




A decent panoramic wallpaper taken with my Canon 1DsMark II.
This Panorama contains 12 vertical images, refurbished in Photoshop.

Download - JPG - 3840x1200 Pixel - 500kb