Problem summaryPython documentation is incorrect in the syntax of the nuke.Layer( ) command.
https://www.thefoundry.co.uk/products/nuke/developers/90/pythondevguide/channels.htmlThe command to add new channels:
nuke.Layer( 'customLayer', ['red', 'green', 'blue'] )Should be documented so that you have to also name the layer for each named channel:
nuke.Layer('customLayer', ['customLayer.red', 'customLayer.green', 'customLayer.blue'])Customer reported versionnuke.n/a
Customer reported platformn/a
Steps to reproduce1) Launch Nuke and open a Script Editor pane
2) run these commands to see the pre-existing channels
# Result: nuke.layers()
# Result: ['rgb', 'rgba', 'alpha', 'depth', 'motion', 'forward', 'backward', 'disparity', 'disparityL', 'disparityR', 'mask', 'rotopaint_mask', 'mask_planartrack', 'mask_splinewarp', 'deep']
nuke.channels()
# Result: ['rgba.red', 'rgba.green', 'rgba.blue', 'rgba.alpha', 'depth.Z', 'forward.u', 'forward.v', 'backward.u', 'backward.v', 'deep.front', 'deep.back', 'disparityL.x', 'disparityL.y', 'disparityR.x', 'disparityR.y', 'mask.a', 'rotopaint_mask.a', 'mask_planartrack.a', 'mask_splinewarp.a']
3) run the documented, incorrect command
nuke.Layer( 'customLayer', ['red', 'green', 'blue'] )
# Result: <Layer object at 0x11ba81888>
4) re-run the layers and channel commands, and note the desired layer is created but the new channels are assigned to layer "other"
nuke.layers()
# Result: ['rgb', 'rgba', 'alpha', 'depth', 'motion', 'forward', 'backward', 'disparity', 'disparityL', 'disparityR', 'mask', 'rotopaint_mask', 'mask_planartrack', 'mask_splinewarp', 'deep', 'customLayer']
nuke.channels()
# Result: ['rgba.red', 'rgba.green', 'rgba.blue', 'rgba.alpha', 'depth.Z', 'forward.u', 'forward.v', 'backward.u', 'backward.v', 'deep.front', 'deep.back', 'disparityL.x', 'disparityL.y', 'disparityR.x', 'disparityR.y', 'mask.a', 'rotopaint_mask.a', 'mask_planartrack.a', 'mask_splinewarp.a', 'other.red', 'other.green', 'other.blue']
You can also see the chanel-less layer and other.channels by putting a node like ColorCorrect in the node graph and seeing what layers and channels are available in the pulldowns