Hi
Yes works well - I modified it so it had nuke.selectedNode() fed into it it.
See below though no doubt the formatting may have screwed.
Howard
### Splits each and every layer on their own pipes using
### shuffle nodes.
### ------------------------------------------
### splitLayers.py
### v1.0 - Last modified: 07/08/2009
### Written by Diogo Girondi
### diogogiro...@gmail.com
import nuke
def splitLayers( node=nuke.selectedNode() ):
'''
Splits each and every layer from the selected node into their own pipes
'''
ch = node.channels()
layers = []
valid_channels = ['red', 'green', 'blue', 'alpha', 'black', 'white']
for each in ch:
layer_name = each.split( '.' )[0]
tmp = []
for channel in ch:
if channel.startswith( layer_name ) == True:
tmp.append( channel )
if len( tmp ) < 4:
for i in range( 4 - len( tmp ) ):
tmp.append( layer_name + ".white" )
if tmp not in layers:
layers.append( tmp )
for each in layers:
layer = each[0].split( '.' )[0]
ch1 = each[0].split( '.' )[1]
ch2 = each[1].split( '.' )[1]
ch3 = each[2].split( '.' )[1]
ch4 = each[3].split( '.' )[1]
if ch1 not in valid_channels:
ch1 = "red red"
else:
ch1 = '%s %s' % ( ch1, ch1 )
if ch2 not in valid_channels:
ch2 = "green green"
else:
ch2 = '%s %s' % ( ch2, ch2 )
if ch3 not in valid_channels:
ch3 = "blue blue"
else:
ch3 = '%s %s' % ( ch3, ch3 )
if ch4 not in valid_channels:
ch4 = "alpha alpha"
else:
ch4 = '%s %s' % ( ch4, ch4 )
prefs = "in %s %s %s %s %s" % (layer, ch1, ch2, ch3, ch4)
shuffle = nuke.createNode( 'Shuffle', prefs, inpanel=False )
shuffle.knob( 'label' ).setValue( layer )
shuffle.setInput( 0, node )
>________________________________
>From: JKehler <jdkeh...@atmosphere-vfx.com>
>To: Nuke user discussion <nuke-users@support.thefoundry.co.uk>
>Sent: Monday, 17 October 2011, 17:26
>Subject: [Nuke-users] Diogo's splitLayers.py script
>
>Hey.
>
>Just wondering if anyone has had any luck using the splitLayers.py
>script.?(Diogo maybe)
>I tried running it on an .exr file but nothing happened.
>
>Thanks for the feedback.
>
>JK
>_______________________________________________
>Nuke-users mailing list
>Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
>
>
_______________________________________________
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users