Controlling the ShuffleCopy through Python

Written by Justin Kirk on .

The shuffleCopy node might be one of the hardest things to grasp for new Nuke users. Throw a bit of python at it and I bet we could confuse even a seasoned user.

Lets try a bit of code and see what we get.

# Creating a new shuffleCopy
shuffle_copy = nuke.nodes.ShuffleCopy(name="test")

# If the new channel doesnt exist, create it
nuke.Layer( 'newLayer', ['red', 'green', 'blue','alpha'] )

# Set the output of the new shuffle coppy to the newly channel created

# Passing through the rgba from pipe2

# Passing through the rgba of pipe1 to the new channel via output2

That's really not what I expected to happen... To me the logic seems like the bottem left quadrant should be r2,g2,b2,a2 right? Apparently not so lets expose all the knobs on this node and see what we have to work with.

for label, knob in sorted(nuke.selectedNode().knobs().iteritems()):
print label, knob.value()

Thats going to return me a nice list like this:

alpha alpha2


black red2

blue blue2

bookmark False

cached False

disable False

dope_sheet False

gl_color 0

green green2

green2 green


hide_input False


in rgba

in2 rgba

indicators 0.0



name test

note_font Verdana

note_font_color 0

note_font_size 11.0



out rgba

out2 newLayer

panel None

postage_stamp False

postage_stamp_frame 1.0

red red2

red2 red

selected True

tile_color 0


white green2

xpos 41.0

ypos -150.0


I started switching some of the values in the shuffleCopy and re-ran the list until I found out what was happening. It turns out that the boxes in the shuffleCopy go down like red, green, blue, alpha, black, white, red2, green2. While it wasn't apparent without exposing the knobs/values, it should be a bit clearer now.


Now lets go back to python and try again.








That is the result that I wanted. Here is a chart showing the knob/value combination for each box.





+3 # Rich Bobo 2014-10-28 20:08
Thanks, Justin!
I also noticed the wacky naming of knobs, but had not taken the time to investigate it, as you have.
+3 # Jose Enriquez 2014-11-24 20:20
Hi guys, I just uploaded an script to speed up the merge of different read nodes into channels for rendering a multichannel open exr file in nuke instead of mergeing one by one with a shuffle node You can check it here if you find it useful:
+1 # Ali Jafargholi 2014-12-12 19:13
Nice work Justin, thanks
+1 # Justin Kirk 2015-01-21 15:44
Most of the research comes from Ali! I just put all his work together.
+1 # Romain HUBERT 2018-10-23 19:22
I notified issues with :

# If the new channel doesnt exist, create it
nuke.Layer( 'newLayer', ['red', 'green', 'blue','alpha'] )

and this line seems to fix it :
nuke.Layer( 'newLayer', ['' , ' ', '' ,'newLayer.alph a'] )
0 # Lars Erik Eriksen 2019-03-05 20:15
Any Idea of how to edit the layer channels on a layer that has already been created?

You have no rights to post comments

We have 2518 guests and 47 members online