Last active
December 15, 2022 04:48
-
-
Save greenvfx/d7e20116c8212d967c86122383fc4c01 to your computer and use it in GitHub Desktop.
switch blending modes in Roto and RotoPaint nodes in Nuke
This file contains hidden or 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
def blending_mode_switcher(): | |
MODES = ['color-burn', 'color-dodge', 'difference', 'exclusion', 'from', 'hard-light', 'max', 'min', 'minus', 'multiply', 'over', 'overlay', 'plus', 'screen', 'soft-light'] # OR ['max', 'over'] | |
SUPPORTED_NODES = ['Roto', "RotoPaint"] | |
nodes = nuke.allNodes(recurseGroups = True) | |
active_nodes = [node for node in nodes if (node.shown() and node.Class() in SUPPORTED_NODES)] | |
for found in active_nodes: | |
try: | |
current_mode = found['toolbar_blending_mode'].value() | |
except: | |
continue | |
try: | |
index = MODES.index(current_mode) | |
except: | |
index = -1 | |
index = (index+1)%len(MODES) | |
found['toolbar_blending_mode'].setValue(MODES[index]) | |
#### ADD TO STANDART MENU | |
nuke.menu('Nuke').addCommand("Edit/Node/Switch Blending Mode", "blending_mode_switcher()", "shift+Q" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment