Shuffle Node

198 views
Skip to first unread message

Daniel Davie

unread,
Aug 22, 2022, 3:08:35 PM8/22/22
to gaffer-dev
Hey guys,

We have just started switching a bunch of our QC compositing tasks from Nuke to Gaffer and so far it has been awesome! 

I have run into a small issue with the Shuffle node however. I am using it to shuffle out the alpha of our shadow passes to RGB so that we can QC them and this work fine when I am working in the UI but when I try and run it headless on the farm I get the error:

KeyError: "'channel' is not a child of 'channels'"

I am trying to set the value using the following code which works perfectly when run in the script editor of the UI:
root["<nameOfTheNode>"]["channels"]["channel"]["in"].setValue("A")
root["<nameOfTheNode>"]["channels"]["channel1"]["in"].setValue("A")
root["<nameOfTheNode>"]["channels"]["channe2"]["in"].setValue("A")
root["<nameOfTheNode>"]["channels"]["channe3"]["in"].setValue("A")

Also when I open up the Gaffer script that was created on the farm the node editor is empty when I have the shuffle node selected. Is there something I am doing wrong?

Thanks and all the best,
Dan

EzequielM

unread,
Aug 22, 2022, 3:32:42 PM8/22/22
to gaffe...@googlegroups.com
When you create a Shufle node through python it will be created without the channels plug
GafferImage.Shuffle( "Shuffle" )

Make sure your channel, channel1, channel2, and channel3 plugs exist before setting their value
You can create them like this
__children["Shuffle"]["channels"].addChild( GafferImage.Shuffle.ChannelPlug( "channel", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Shuffle"]["channels"].addChild( GafferImage.Shuffle.ChannelPlug( "channel1", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Shuffle"]["channels"].addChild( GafferImage.Shuffle.ChannelPlug( "channel2", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, ) )
__children["Shuffle"]["channels"].addChild( GafferImage.Shuffle.ChannelPlug( "channel3", flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic, )


--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gaffer-dev/351f61fb-13ba-4a76-847c-9913c2facbe8n%40googlegroups.com.

Daniel Davie

unread,
Aug 22, 2022, 4:56:53 PM8/22/22
to gaffer-dev
That worked a charm, thank you Ezequiel!

Dan

Carlo Giesa

unread,
Oct 16, 2023, 9:00:21 AM10/16/23
to gaffe...@googlegroups.com
Hi there!

I'm wondering, if we can control the "channels" plug via python expressions. I'm trying to build a contact sheet setup that extracts all layers from a multi layer exr file. Or would it be better to approach this via OSL? By the way, I started from the provided contact sheet example that is still using the "Loop" node which doesn't seem to be accessible anymore in recent versions of Gaffer. Might there be other approaches? I tried to see if a "CollectImages" node could do the trick, but I don't see how to use to in that case, since from my understanding, the collect node does create a new layer inside the image file, which is not what I want.

Greets,
Carlo

Carlo Giesa

unread,
Oct 16, 2023, 9:33:10 AM10/16/23
to gaffe...@googlegroups.com
Ok, I managed to handle the dynamic channel selection with the OSLInLayer node. Still wondering, if I should replace the "Loop" setup with something else. With a lot of AOVs, still is taking a bit of computation time to get a full contact sheet.

Greets,
Carlo

Murray Stevenson

unread,
Oct 17, 2023, 1:17:51 AM10/17/23
to gaffer-dev
Hey Carlo!

You could use an expression to set the values of the `in` and/or `out` child plugs of each ChannelPlug added to a Shuffle. I’ve attached a basic example using some ContextVariables nodes to control which layer gets shuffled to RGBA.

Short of writing a dedicated C++ ContactSheet node, the Loop approach is likely your best option at present...

Cheers,

Murray
shuffleChannelExpressionExample.gfr

Carlo Giesa

unread,
Oct 17, 2023, 10:54:41 AM10/17/23
to gaffe...@googlegroups.com
Hey Murray!

Thanks for the example, that is working like a charm.

Although, I wasn't able to run this contact sheet loop setup on a merged EXR with 81 AOVs inside. I let it run for one hour for a single frame and nothing happened. It worked great with an EXR of 19 AOVs. Not sure if that is a limitation due to the loop setup. I finally put something together using only OpenImageIO.

Greets,
Carlo

Reply all
Reply to author
Forward
0 new messages