Created
January 30, 2024 08:10
-
-
Save MitchellKehn/2494a4f9db584cd7f622ff622da1087f to your computer and use it in GitHub Desktop.
[premult bracket] wraps the selected node in an un/premult pair. it's... old #nuke
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_names = [] | |
alts = [] | |
for i in nuke.selectedNodes(): | |
name = i['name'].value() | |
alt = i.ypos() | |
node_names.append(name) | |
alts.append(alt) | |
i.knob('selected').setValue(False) # Deselects nodes as it goes through. | |
top = node_names[ alts.index( min(alts) ) ] | |
bottom = node_names[ alts.index( max(alts) ) ] | |
t = nuke.toNode(str(top)) | |
b = nuke.toNode(str(bottom)) | |
top_pos = ( t.xpos() , t.ypos() ) | |
bottom_pos = ( b.xpos() , b.ypos() ) | |
input_node = nuke.toNode( t.input(0).name() ) | |
# Create Unpremult above top | |
t.knob('selected').setValue(True) | |
u = nuke.nodes.Unpremult( xpos = t.xpos() , ypos = t.ypos() - 26 , selected = True ) | |
t.setInput(0, u) | |
t.knob('selected').setValue(False) | |
for p in nuke.selectedNodes(): | |
p.setInput(0, input_node) | |
p.knob('selected').setValue(False) | |
# Create premult below bottom | |
b.knob('selected').setValue(True) | |
premult = nuke.createNode( "Premult" ) | |
b.knob('selected').setValue(False) | |
premult.knob('selected').setValue(False) | |
u.knob('selected').setValue(True) | |
premult.knob('selected').setValue(True) | |
for node in node_names: | |
nuke.toNode(str(node)).knob('selected').setValue(True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment