Skip to content

Instantly share code, notes, and snippets.

@draconiansolo
draconiansolo / gist:5391494
Last active December 16, 2015 06:29
My init.py to have folders inside the .nuke directory with reference in spanglish
nuke.pluginAddPath('gizmos') # con esto puedo tener mi carpeta de .nuke ordenadita
nuke.pluginAddPath('icons') #incluso con los iconos.
@draconiansolo
draconiansolo / gist:5391518
Last active December 16, 2015 06:29
My menu.py with reference in spanglish.
#nuke.menu()#esto es lo que deja modificar los menues de nuke.
#help(nuke.menu)#para ver la ayuda de los comandos
#anyadir un hotkey al toolbar...
toolbar = nuke.menu('Nodes') #hago una referencia a el toolbar de nodos
toolbar.addCommand('Transform/Reformat','nuke.createNode("Reformat")','ctrl+r')#hago
#todo lo que uno quiera que sea persistente entre sesiones debe estar en /Users/fdevant/.nuke/menu.py (esto es el $home i guess)
@draconiansolo
draconiansolo / gist:5447807
Created April 23, 2013 22:04
Nuke Python Tutorials, Accessing nodes Notes.
#####ACCESSING NODES PART A########
print nuke.selectedNode().name() #asi es como llamo el nodo seleccionado.
#nuke.selectedNodes() es con la que se seleccionan varios nodos.
for n in nuke.selectedNodes(): #...
print n.name(); #ciclo entre los objetos para mostrar el nombre.
@draconiansolo
draconiansolo / gist:5447834
Last active December 16, 2015 14:19
Script for opening all your group nodes' schematics on Nuke.
#you can paste this to your script in settings/python/onScriptLoad
for n in nuke.allNodes("Group"): # for all the nodes in root that are groups
print n.name() # write names on the script console
if n.name()[0]=="_": # if the name of the group starts with underscore
nuke.showDag(n) # show their schematics
@draconiansolo
draconiansolo / gist:5473193
Last active December 16, 2015 17:49
Nuke Python for artists tutorials Callback Functions with opinionated comments and notes in spanglish.
########### CALLBACK FUNCTIONS PART A ###################
def test(): #defino una funcion que retorna un string
return "testing"
nuke.selectedNode().knob("autolabel").setValue("test()")# asigno esa funcion al set value de el knob que quiero modificar (en este caso es un nodo oculto llamado autolabel) ... y en el set value, llamo la funcion como un string
#-------------------
for n in nuke.allNodes("Camera2"): #por si se me olvida...
#n['focal'].setValue(5) #asi es como se ponen valores en los knobs
@draconiansolo
draconiansolo / gist:5476864
Last active December 16, 2015 18:20
Nuke Python for artists tutorials Callback Knobs with opinionated comments and notes in spanglish.
#########################################################
########### CALLBACK KNOBS PART A ###################
###### checking script name for version
#should be on onSaveScript callback
import re
def checkScriptName(name):
print name
@draconiansolo
draconiansolo / gist:5533976
Last active December 17, 2015 02:09
Quick nuke inf/NaN fix. copypasta
set cut_paste_input [stack 0]
version 6.3 v5
push $cut_paste_input
Expression {
expr0 (isnan(r)||isinf(r))?r(x+xo,y+yo):r
expr1 (isnan(g)||isinf(g))?g(x+xo,y+yo):g
expr2 (isnan(b)||isinf(b))?b(x+xo,y+yo):b
expr3 (isnan(a)||isinf(a))?a(x+xo,y+yo):a
name Expression4
selected true
@draconiansolo
draconiansolo / gist:5541755
Last active December 17, 2015 03:18
Dodgy Normal Relight node for Nuke copypasta
set cut_paste_input [stack 0]
version 6.3 v5
push $cut_paste_input
Expression {
temp_name0 x
temp_expr0 pow(tangent.left.r-r,2)
temp_name1 y
temp_expr1 pow(tangent.left.g-g,2)
temp_name2 z
temp_expr2 pow(tangent.left.b-b,2)
@draconiansolo
draconiansolo / gist:5541763
Last active December 17, 2015 03:18
dodgy disparity clamper for nuke copypasta
set cut_paste_input [stack 0]
version 6.3 v5
push $cut_paste_input
Group {
name DisparityClamp1
selected true
xpos 392
ypos 494
addUserKnob {20 User}
addUserKnob {26 DisparityClampofDoom l "Disparity Clamp of Doom" t "*not suitable for new views; will help greatly with painting stuff, specially edges." T "Allows you to clamp and blur your disparity with up to 4 reference points.\nClamps max and min values.\n**Based on David's manual disparity trick"}
@draconiansolo
draconiansolo / gist:5658810
Last active April 3, 2019 08:25
Nuke Python for artists tutorials Manipulating the node graph with opinionated comments and notes in spanglish.
#n1=nuke.nodes.NoOp(xpos=0,ypos=0) #creates a NoOp node at 0,0...
# xpos and ypos are hidden knobs.
n1=nuke.nodes.NoOp(xpos=0,ypos=0,label='0,0') #label pa marcarlo, not that it matters.
n2=nuke.nodes.NoOp(xpos=200,ypos=200,label='200,200') #same
#############
marker=nuke.nodes.Dot() #crear un dot
##############
marker.knob('xpos').setValue(100) #change xpos as a knob
##############
marker.setXpos(0)