Skip to content

Instantly share code, notes, and snippets.

@kpprt
Last active March 7, 2019 17:51
Show Gist options
  • Save kpprt/9cfb9e620b091170985d311f7ad616be to your computer and use it in GitHub Desktop.
Save kpprt/9cfb9e620b091170985d311f7ad616be to your computer and use it in GitHub Desktop.
Dynamically crop to the current or an external bounding box in Nuke. This might save performance e.g. when piping in a roto shape bbox of a garbage matte.
set cut_paste_input [stack 0]
version 10.5 v7
push $cut_paste_input
Group {
name CS_CropToBBox1
tile_color 0xa57aaaff
addUserKnob {20 CS_CropToBBox}
addUserKnob {41 numpixels l "Add Pixels" T AdjBBox1.numpixels}
addUserKnob {41 softness T Crop1.softness}
addUserKnob {41 reformat T Crop1.reformat}
addUserKnob {41 intersect -STARTLINE T Crop1.intersect}
addUserKnob {41 crop l "black outside" -STARTLINE T Crop1.crop}
}
Input {
inputs 0
name InputBBox
xpos -920
ypos 110
number 1
}
Input {
inputs 0
name Input
xpos -810
ypos 110
}
set Ne0913400 [stack 0]
Switch {
inputs 2
which {{"\[expr \{\[exists parent.input1] ? true : false\}]"}}
name Switch1
xpos -920
ypos 206
}
push $Ne0913400
CopyBBox {
inputs 2
name CopyBBox1
xpos -810
ypos 206
}
AdjBBox {
numpixels 0
name AdjBBox1
xpos -810
ypos 254
}
Crop {
box {{bbox.x} {bbox.y} {bbox.r} {bbox.t}}
name Crop1
selected true
xpos -810
ypos 302
}
Output {
name Output1
xpos -810
ypos 398
}
end_group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment