Skip to content

Instantly share code, notes, and snippets.

View artandmath's full-sized avatar

Daniel H. artandmath

View GitHub Profile
@artandmath
artandmath / copypaste_with_input_tracking.py
Last active March 9, 2026 09:38
Copy/paste utilities for Nuke that preserve and restore node input connections.
"""
https://gist.github.com/artandmath/22d9bf83128c7a73cca3136506c4d559
Copy/paste utilities for Nuke that preserve and restore node input connections.
When copying nodes, input connections are embedded as metadata in a hidden knob.
When pasting, that metadata is read and the original connections are re-established
(where possible), then the tracking knobs are removed.
Menu integration is available in two styles:
@artandmath
artandmath / AutoMorphDissolveWithBBoxAttention.nk
Created October 30, 2025 01:26
Automatic MorphDissolve with bbox attention
set cut_paste_input [stack 0]
version 15.1 v1
BackdropNode {
inputs 0
name BackdropNode10
tile_color 0x388e8e00
label "AutoMorph with bbox attention"
note_font_size 25
selected true
xpos 3762
@artandmath
artandmath / bakeSelectedNodes.py
Last active September 18, 2025 01:49
bakeSelectedNodes() bakes knob expressions and updates node labels to indicate which nodes the expressions were referencing. Can be useful to speed up sticky nukescripts.
import nuke
import re
def bakeCurve(curve, first, last, inc):
for f in range(first, last + 1, inc):
curve.setKey(f, curve.evaluate(f))
curve.setExpression('curve')
def getCurves(knob, views):
curves = []
@artandmath
artandmath / pyqt-and-pyside.mdc
Last active June 15, 2025 09:31
Cursor rule for running tests when creating Qt based user interfaces in Foundry Nuke.
# General guidelines
Keep it simple
Use as few lines as possible, but not at the sacrifice of readibility, safety and functionality.
When planning a complex code change, always start with a plan of action and then ask me for approval on that plan.
For simple changes, just make the code change but always think carefully and step-by-step about the change itself.
@artandmath
artandmath / CameraReformat.nk
Last active August 13, 2022 10:36
CameraReformat emulates a nuke reformat node using a scanline renderer. Its purpose is to extract an equivalent focal length for reformatted plates on VFX shows when multiple cameras and pixel aspects are at play but rendering needs to be standardised to a working resolution.
set cut_paste_input [stack 0]
version 13.0 v1
BackdropNode {
inputs 0
name BackdropNode1
tile_color 0x444444ff
label "resize type need to match for both\nCameraReformat and VFXReformat nodes\n(eg width, height, fit, fill)\n\nResize type none & distort are not yet implemented\n\n<l style=\"background-color:Green;\">If you see green and yellow in output image - all is golden</l>\n\n<l style=\"background-color:Red;\">If you see red in the output image - something ain't right.</lp>"
note_font_size 15
note_font_color 0xffffffff
selected true