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
@dbr
dbr / nuke_viewer_shortcut_intercept.py
Created June 4, 2013 04:12
Test of finding Nuke's viewer widget, and intercepting the hardwired "c" shortcut and rewiring it to view the RGB channel
"""Test of finding Nuke's viewer widget, and intercepting the hardwired "c" shortcut and rewiring it to view the RGB channel
"""
from PySide import QtGui, QtCore
def findviewer():
stack = QtGui.QApplication.topLevelWidgets()
viewers = []
while stack:
@jedypod
jedypod / DistortTracks
Last active January 19, 2024 16:42
Distort Tracks Gizmo(Description in Comments, because description does not support markdown?)
set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name DistortTracks
help "<b>Distort Tracks Gizmo</b>\n\n<b>About</b>:\nThis gizmo reformats and/or distorts tracking data based on a uv distortion map input. When you are working with CG elements in your comp that are undistorted and padded resolution, sometimes it is useful to reconcile tracking data from a 3d position through a camera into screen space. This data can then be used to do stuff in 2d: track in lens flares, matchmove roto or splinewarps, etc. The problem is that when this tracking data comes back from our padded undistorted 3d scene into distorted, unpadded resolution comp land, it doesn't line up. \n\n<b>Instructions</b>:\n1. Connect the UV input to a uv distortion map and set the channel that holds it, (for example, a LensDistortion node set to output type Displacement, outputting a UV distortion map into the forward.u and forward.v channels)\n2. Set the padded resolution format and the destination format: Padded resolution is the ov
@fredrikaverpil
fredrikaverpil / custom_ui_docked.py
Last active December 1, 2022 16:29
Create custom PySide GUI and dock it into Nuke UI
import PySide.QtCore as QtCore
import PySide.QtGui as QtGui
from nukescripts import panels
class PanelTest(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setLayout(QtGui.QVBoxLayout())
self.myTable = QtGui.QTableWidget()
self.myTable.header = ['Date', 'Files', 'Size', 'Path' ]
@dbr
dbr / menu.py
Created September 5, 2017 04:02
Alternative viewer connection shorcuts - alt+1..9 connect viewer, 1..9 only switch viewer
def viewer_shotcuts_alt():
# Alt+1, Alt+2 etc to connect node to viewer
for n in range(9):
def connect_viewer(n=n):
selection = nuke.selectedNodes()
nuke.connectViewer(n, nuke.selectedNode())
[node.setSelected(False) for node in nuke.selectedNodes()]
[node.setSelected(True) for node in selection]
nuke.menu("Node Graph").addMenu("ViewerThing").addCommand(
@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
@jedypod
jedypod / DefocusSwirlyBokeh.nk
Last active June 8, 2022 04:37
Creates Defocus with Swirly Bokeh aka Cat's Eye Bokeh. Based on Alexander Kulikov's CatsEyeDefocus: www.nukepedia.com/blink/filter/catseyedefocus.
set cut_paste_input [stack 0]
push $cut_paste_input
Group {
name DefocusSwirlyBokeh
tile_color 0xb16f43ff
addUserKnob {20 DefocusSwirlyBokeh}
addUserKnob {6 usegpu l "use gpu" t "You REALLY need a good GPU to use this node effectively. With CPU it will be excruciatingly slow." +STARTLINE}
usegpu true
addUserKnob {7 size l "bokeh size" t "The size of your defocus." R 2 100}
size 25
@jedypod
jedypod / Transform.cpp
Last active October 23, 2023 09:21
Nuke blinkscript implementation of a simple image Transform operator. This blinkscript demonstrates pixel filter interpolation algorithms.
/*
Nuke blinkscript implementation of a simple image Transform operator.
Demonstrates pixel filter interpolation algorithms.
The following pixel filters are implemented:
0 - Blackman-Harris : Similar to cubic, but better performance in high frequencies
1 - Lanczos4 : 2x2 lanczos windowed sinc function
2 - Lanczos6 : 3x3 lanczos windowed sinc function
3 - Cubic : (Bicubic interpolation) - a=0.0, b=0.0
4 - Mitchell : (Bicubic interpolation) - a=1/3, b=1/3