Table of Contents

To Merge here: App Nuke

Technique Section

useful plugin

Pipeline

Environment Detection

Global Custom Pipeline integration

Callback Function

commandline render

UI Integration

Node attribute knob Operation

common menu operation codes

# top menu and side bar menu obj
nuke.menu("Nuke")
nuke.toolbar("Nodes")
 
# add menu and add cmd obj
menubar = nuke.menu("Nuke") # main menu bar
my_menu = menubar.addMenu("MyMenu") # menu object
my_menu.addCommand("Test","print('Test')") # menu item; subFolder/Test for subfolder cmds
 
menubar.addMenu("MyMenu") # Important, without a var to hold it, it becomes menuItem object instead of menu obj
 
# get items of a ui object
# list direct child UI object
menubar.items()
# return menu child with that name
menubar.menu('MyMenu')
# return menu or menuItem child w that name
menubar.findItem('MyMenu')
# loop method of listing
name_item_child_list = [ [cur_item.name(), cur_item] for cur_item in menubar.items() ]
print(name_item_child_list )

Setting Operation

File Operation

Node Operation

Knob Operation

Nuke Tcl Expression

Replace Single Line String to Multi Line Display

Use Express to Link StrValue to IntValue

example

# file attribute expression:
[value rdir]/finals/[value shot]/NK_[value shot].%03d.dpx
# get evaluate result
print (nuke.thisNode()["file"].evaluate())

# mix python in tcl
file "\[value nas_root]/\[value project]/\[value seq]/zup_renders/Comp/\[value RenderType]/\[value shot]_[value FileName]_v[python {str(int(nuke.thisNode()['ver'].value())).zfill(3)} ]/\[value shot]_[value FileName]_v[python {str(int(nuke.thisNode()['ver'].value())).zfill(3)} ].####.\[value file_type]" 

# use cmd
 knobChanged "\ncur=nuke.thisNode()\npathA = \[ cur\[each].value() for each in \['nas_root', 'project', 'seq'] ]\npathB = \['zup_renders/Comp', cur\['RenderType'].value() ]\nsegC = cur\['shot'].value()\nif cur\['FileName'].value() !='':\n    segC+='_'+cur\['FileName'].value()\nsegC+='_v'+ str(int(cur\['ver'].value())).zfill(3)\npathD = \[ segC+'.####.'+cur\['file_type'].value() ]\ncur\['file'].setValue( '/'.join( pathA + pathB + \[segC] + pathD ) )\n"

Nuke API