Basic Nuke Scripts

# To get the name of  single selected Node:


# To get the name of all selected Nodes:

for i in nuke.selectedNodes():

# To get the particular type of nodes:

for n in nuke.allNodes('Blur'):

# To get the dependent input node:

myNode = nuke.toNode('Blur1')
for k in nuke.dependentNodes(nuke.INPUTS,myNode):

# To get nodes from the Group node:

myGroup = nuke.toNode('Group1')
for l in nuke.allNodes('Blur',group =myGroup):
myGroup = nuke.toNode('Group1')
for j in myGroup.selectedNodes():

# To set auto label for creating nodes:

def showFocal():
    n = nuke.thisNode()
    label = '%s\nfocal %s' %(,n['focal'].value())
    return label
nuke.addAutolabel(showFocal,nodeClass = 'Camera2')

# To set autolabel  for the particular node


# To set autolabel for the selected nodes


# To set position for creating nodes:

marker = nuke.nodes.Dot()

# To zoom the workflow nodes:

nuke.zoom(0) #to fit in thenode graph


# Create Message Dialog box:

nuke.message('Hello World")

# To show the Channel box of the Node:

def showChannels():
    return '\n'.join(nuke.thisNode().channels())
nuke.display('showChannels()',nuke.selectedNode(),'Node Channel')

# To Change the label of selected Nodes

txt = nuke.getInput('change Label','new label')
if not txt == None:
    for n in nuke.selectedNodes():

# To Change the tile_color of selected Nodes

col = nuke.getColor()
glcol = nuke.getColor()
if not col == 'None':
    for n in nuke.selectedNodes():

# To get the details from notepad to Sticky note Node

dir = 'D:/...' # Location of the file Directory
filePath = nuke.getFilename('Get Details','*.txt *.xml',dir)
if not filePath == None:
    file = open(filePath,'r')
    content =
htmlstr = '&lt;img src = "D:/..."&gt;' # Location of the image Directory
nuke.nodes.StickyNote(label =htmlstr + '\n' + content , note_font_size=20)

CGSociety Lighting Challenge

Recently my entry for mad science(CGSOCIETY -LIGHTING CHALLENGE) have been selected for the final gallery of is my second challenge,i’m participating.Both my entries has been in to the final gallery.Here are those two images.

Mad Science
It was done using Maya-mental Ray and nuke.
My primary motive here was to learn about maya_mia materials and nuke’s linear workflow.

Room Interior – Afraid of the dark:

It was shaded and lighted using maya software renderer and composited in digital fusion.

3drender Gallery

Mad science:


Another Command to get filename in the Nuke Read Node

The main advantage of this command is that ,we can connect any input Read node [Example. Read1 or Read3 or Read4.,].it will give correct filename from the Read node.No need to specify the name of the Read Node.

[file tail [file rootname [metadata input/filename]]]

Metadata is a set of information about an image embedded in the image file.This may include the image’s original bit depth,width and height etc.,

How to get Filename without Directory path & extension from Read Node in Nuke?

Wanna Test!

Step1 : Pick the Text Node from the Draw Menu.

Step2 : Connect image Read Node into Text Node.

Step3 : Type the following Command on Message Field at Text Node.
[file tail [file rootname [value  readNodeName.file] ] ]

We should specify the name of the Read Node.

file tail – For Remove Directory Path.

file rootname – For Remove Extension.

Example : [file tail [file rootname [value Read1.file] ] ]

How to Create and Register your Custom Viewer Process Gizmo in Nuke?

Custom Viewer Process Gizmo:

Step 1:    Create the  process nodes in node graph and make it them as Group Node.i.e., (Select all Process nodes and  press Ctrl+g).

Step 2:    Select the Group node and Click export as gizmo button in Group node Property and save it in root Directory.

Step 3:    And register your Gizmo by following python script and save as already is there.Just insert the lines in the file

nuke.ViewerProcess.register(“Title_of_Gizmo”,nuke.Node,(“Your_Saved_Gizmo_Name”, “”))

Example: nuke.ViewerProcess.register(“ForTest”,nuke.Node,(“TestTool”, “”))

Step 4:    Restart Nuke & View your Gizmo in Viewer popup list.

How to add user defined Gizmos/Plugins in Nuke Toolbar?

By Manual:

Step 1 :    Create and Copy the Gizmo into the root Directory “C:\Documents and Settings\Administrator\.nuke“.

Step 2 :    Goto etc… –> All Plugins –> Update from ToolBar.Your gizmo will be updated in the toolbar.

Step 3 :    Again Goto etc… –> All Plugins –> An Alphabetic List will be display and pick your Gizmo in it.

Using Python Script:

Step 1 :    Copy the Gizmo into the root Directory “C:\Documents and Settings\Administrator\.nuke”.

Step 2 :    Type the following Python script in script editor and Save as in root Directory.

if already is there.Just insert the lines in the file

toolbar =“Nodes”)

Note : Here SliceTool is one of the User-Defined Tool For Nuke Color Management.

Step 3 :    An icon will be display in the toolbar (or) right click from the Node editor to get your Gizmo  .