Last active
May 9, 2018 05:42
-
-
Save BenMcEwan/210dc68a64be5d36896c3de6f577b7d0 to your computer and use it in GitHub Desktop.
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
# -------------------------------------------------------------- | |
# swapInOut.py | |
# Version: 1.0.0 | |
# Last Updated: January 11th, 2018 | |
# -------------------------------------------------------------- | |
# -------------------------------------------------------------- | |
# USAGE: | |
# | |
# Find all in/out (merge) nodes and change them to mask/stencil (flipping the A and B inputs to work correctly). | |
# -------------------------------------------------------------- | |
import nuke | |
import nukescripts | |
def swapInOut(): | |
n = nuke.allNodes() | |
for i in n: | |
if i.Class() == 'Merge2': | |
if i['operation'].value() == 'in': | |
i['operation'].setValue('mask') | |
nukescripts.swapAB(i) | |
elif i['operation'].value() == 'out': | |
i['operation'].setValue('stencil') | |
nukescripts.swapAB(i) | |
# Add the following to menu.py | |
import swapInOut | |
utilitiesMenu = nuke.menu('Nuke').addMenu('Utilities') | |
utilitiesMenu.addCommand('Script Cleanup/Convert In+Out to Mask+Stencil', 'swapInOut.swapInOut()') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment