Skip to content

Instantly share code, notes, and snippets.

View greenvfx's full-sized avatar

Vitalii Musatov greenvfx

  • Industrial Light & Magic
  • Vancouver
  • LinkedIn in/vmusatov
View GitHub Profile
def openBaseNode():
sn = nuke.selectedNode()
for knob in sn.knobs():
if sn['%s'%knob].hasExpression():
expression = sn['%s'%knob].animation(0).expression()
nodeName = expression.split('.')
n = nuke.toNode('%s'%nodeName[1])
nuke.show(n)
nuke.menu('Nuke').addCommand("Edit/Node/Open Base Node", "openBaseNode()", "Ctrl+Shift+o" )
def openBaseNode():
sn = nuke.selectedNode()
for knob in sn.knobs():
if sn['%s'%knob].hasExpression():
expression = sn['%s'%knob].animation(0).expression()
nodeName = expression.split('.')
n = nuke.toNode('%s'%nodeName[1])
nuke.show(n, forceFloat = True)
nuke.menu('Nuke').addCommand("Edit/Node/Open Base Node", "openBaseNode()", "Ctrl+Shift+o" )
@greenvfx
greenvfx / runner.py
Last active March 1, 2017 15:01
Just a fun script. Nodes run away from your selection.
import nuke
import random
import nukescripts
def runner():
if nuke.thisKnob().name() == 'selected':
# RANDOM FOR X
random.seed(random.random())
randFactX = (random.random()-0.5)
# RANDOM FOR Y
import subprocess
import os
import glob
import sys
a = r"C:\\Program Files\\Side Effects Software\\Houdini 15.0.244.16\\bin\\mantra.exe"
folder = sys.argv[1]
start = int(sys.argv[2])
finish = int(sys.argv[3])
set cut_paste_input [stack 0]
version 10.0 v5
push $cut_paste_input
Camera2 {
translate {-2.632596731 1.25999999 -1.370361328}
rotate {45 -20.48773298 0}
name Camera2
selected true
xpos 1152
ypos -498
set cut_paste_input [stack 0]
version 10.0 v5
push $cut_paste_input
Axis2 {
translate {-3 0 -4.099999905}
name Axis1
selected true
xpos 300
ypos -1374
}
@greenvfx
greenvfx / colour.py
Created March 31, 2017 15:37
getDefaultColor
node = nuke.selectedNode()
prefs = nuke.toNode('preferences')
allPrefKnobs = prefs.allKnobs()
colourClasses = [knob.name() for knob in allPrefKnobs if "NodeColourClass" in knob.name() ]
foundClass = ''
ruleFound = ''
for colorClass in colourClasses:
rules = prefs[colorClass].value().split()
@greenvfx
greenvfx / menu.py
Created April 7, 2017 09:42
menu.py KeenTools
import nuke
import sys
nuke.pluginAddPath('./icons')
majorVer = nuke.NUKE_VERSION_MAJOR
minorVer = nuke.NUKE_VERSION_MINOR
platform = sys.platform
if platform == "linux2":
@greenvfx
greenvfx / raytracing.py
Created January 7, 2018 20:14 — forked from rossant/raytracing.py
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
"""
MIT License
Copyright (c) 2017 Cyrille Rossant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@greenvfx
greenvfx / duplicate_selected_node_with_inputs.py
Created January 18, 2018 12:35
Duplication of selectrd nodes with inputs.
def duplicate_selected_node_with_inputs():
sn = nuke.selectedNode()
nuke.nodeCopy(nukescripts.edit.cut_paste_file())
nodes = nuke.allNodes();
for i in nodes:
i.knob("selected").setValue(False)