Skip to content

Instantly share code, notes, and snippets.

@jaforsgren
Created November 23, 2017 15:02
Show Gist options
  • Save jaforsgren/6bc0537c882015f02e3aad715afff1b3 to your computer and use it in GitHub Desktop.
Save jaforsgren/6bc0537c882015f02e3aad715afff1b3 to your computer and use it in GitHub Desktop.
def createLayerShuffles(node):
# thanks to Peter Hartwig for this code
channels = node.channels()
layers = list( set([c.split('.')[0] for c in channels]) )
for layer in layers:
if not "Obj" in layer:
if not "MtlID" in layer:
if "Raw" in layer or "DiffuseFilter" in layer:
shuffleNode = nuke.nodes.Shuffle( label=layer, inputs=[node] )
shuffleNode['in'].setValue( layer )
shuffleNode['postage_stamp'].setValue( True )
removeNode = nuke.nodes.Remove(inputs = [shuffleNode])
removeNode['operation'].setValue('keep')
removeNode['channels'].setValue('rgb')
createLayerShuffles(nuke.toNode("Read2"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment