Skip to content

Instantly share code, notes, and snippets.

herronelou /
Created April 7, 2024 22:32
Nuke dockable panel example
This script shows how to create a dockable widget in Nuke using PySide2 based on a technique
I used a long time ago in a project.
I think nowadays I would reimplement something akin to nukescripts.panels.registerWidgetAsPanel
that allows custom menu commands and single instances of the widget.
import nuke
import nukescripts
export PLUGIN_NAME=VenetianBlinds
export OS=Linux
declare -A NUKE
herronelou /
Created October 23, 2023 23:46
Mime Cleaner to allow pasting from PyCharm to Nuke
from PySide2 import QtCore, QtWidgets
class MimeCleaner(QtCore.QObject):
""" Event filter to clean-up MimeData when pasting from PyCharm"""
def __init__(self):
super(MimeCleaner, self).__init__()
def eventFilter(self, widget, event):
if event.type() is QtCore.QEvent.KeyPress and event.key() == QtCore.Qt.Key_V:
set cut_paste_input [stack 0]
version 13.0 v1
Group {
inputs 0
name Minecraft_Import
label orca.nbt
selected true
xpos 103
ypos -89
addUserKnob {20 nbtfile l NBTFile}
herronelou /
Created December 2, 2021 21:41
Pixel Orca
""" Create A pixellated Orca, similar to the scupture in Vancouver """
import nuke
blocks = [('a', 0), ('b', .1), ('c', .5), ('d', 1)]
colors = {k: nuke.nodes.Constant(color='{0} {0} {0} 1'.format(c)) for k,c in blocks}
scene = nuke.nodes.Scene()
index = x = y = z = c = m = 0
data = '9y9y3yaz9y9y3yaa9z9z4zxz9y9y3yaaz9y9y3y3az9y9y3y3a8z9y9y5y7az9y9y6y8az9y9y7yaabdd3az'\
herronelou / CelestialCam.nk
Created March 1, 2021 08:50
Celestial Camera
Group {
name CelestialCam
knobChanged "if 'celestial_cam' in globals(): celestial_cam.celestial_cam_callback()"
selected true
xpos 6036
ypos 400
addUserKnob {20 User l "Celestial Camera"}
addUserKnob {52 map l "" t "Widget refreshes when putting mouse over it. It can occasionally result in a little jump when the input camera has been modified, as the map will not update until hovered." -STARTLINE T "celestial_cam.LatLongPicker(nuke.thisNode()) if 'celestial_cam' in globals() else type('Dummy', (), \{'makeUI': classmethod(lambda self: None)\})"}
addUserKnob {7 lat l Latitude t "Latitude coordinate of camera location on Earth" R -90 90}
addUserKnob {7 long l Longitude t "Longitude coordinate of camera location on Earth" R -180 180}
# Source:
# Tweaks to make it work with multiline by Erwan Leroy
import nuke
from Qt import QtWidgets, QtGui, QtCore
class Core_SetLabel(QtWidgets.QDialog):
def __init__(self):
Gizmo {
name Noise_3D
inputs 2
help "Generate Noise in 3D space based on Position passes. It includes pre-made Position passes for some 3D primitives, or can use a custom pass. Uses a 4D noise internally so that the 4th dimension can be used to add a 'boiling' effect"
addUserKnob {20 noise3d l "3D Noise"}
addUserKnob {4 mapping l Mapping t "Generates a Noise based on a 3D shape, unfolded to fit into a UV plane.\n\nThe Custom P Input lets you input the shape of your choice. Using a pWorld pass as cutom P will generate a 3D noise as seen from the same camera as used to render the Pworld. Ensure an Alpha channel is present for Custom P." M {"Card (Flat)" Spherical "Cylindrical (Tile X)" "Cylinder 4D (Tile X and Y)" "Custom P Input" "" ""}}
addUserKnob {26 ""}
addUserKnob {41 translate T Axis_3D.translate}
addUserKnob {41 rotate T Axis_3D.rotate}
addUserKnob {41 scaling l scale T Axis_3D.scaling}
herronelou / irradiance_map.cpp
Last active July 9, 2019 16:27
WIP irradiance map blinkscript, has pinching issues. Adapted from
inline float3 uv_to_sphere(const float2 uv, const float2 image_size)
float2 st = (uv+float2(0.5f)) / image_size;
float latitude = (st.y - 0.5f) * PI;
float longitude = (st.x - 0.5f) * 2 * PI;
float radiusAtLat = cos(latitude);
float3 normal;
normal.x = radiusAtLat * cos(longitude);
normal.y = sin(latitude);
normal.z = radiusAtLat * sin(longitude);
herronelou / particle_setup.nk
Created May 20, 2019 07:21
Custom particle setup
Group {
name Point_Radial_Force
label "\[value strength]"
selected true
xpos 490
ypos -269
addUserKnob {20 User}
addUserKnob {7 strength l Strength}
strength -1