State:Closed|icon_bug|icon_nuke|database:public|Resolution:Works For Me|TargetRelease:14.0v3|BugID:510025|
Problem summary
nuke.layers() no longer returns the layers correctly
Customer reported version
nuke.13.2v2
Customer reported platform
windows11
Steps to reproduce
1) Open Nuke
2) Read in the attached astonMartin_multiChannel.exr file
3) Select the Read node, then run the following code in the Script Editor:
print(nuke.layers(nuke.selectedNode()))
Expected behaviour
For Nuke to print all the layers in the image:
print(nuke.layers(nuke.selectedNode())) # Result: ['rgb', 'rgba', 'alpha', 'depth', 'Body_Wheels_Tires_Sel_Mask', 'Frenel_VRayFresnel3', 'GI', 'Glass_Selection_Mask', 'UV_s_ramp1', 'VRayDirt1', 'background', 'diffuse', 'lighting', 'matteShadow', 'rawGI', 'rawLight', 'rawReflection', 'rawRefraction', 'reflect', 'reflectionFilter', 'refract', 'refractionFilter', 'sampleRate', 'selfIllum', 'shadow', 'specular', 'velocity']
Actual behaviour
Nuke only prints some layers correctly on Windows:
print(nuke.layers(nuke.selectedNode())) # Result: ['', '', '', '', 'Body_Wheels_Tires_Sel_Mask', 'Frenel_VRayFresnel3', '', 'Glass_Selection_Mask', '', '', '', '', '', '', '', '', '', '', '', 'reflectionFilter', '', 'refractionFilter', '', '', '', '', '']
Or returns an error on macOS:
print(nuke.layers(nuke.selectedNode())) # Result: SystemError: /Users/Shared/workspace/CreatePackageVFX20/.conan/data/Python/3.7.7/thirdparty/development/build/03db91a62823ebc2b1df6e5cf549c2f674116656/Python_src/Objects/listobject.c:305: bad argument to internal function The above exception was the direct cause of the following exception: Traceback (most recent call last): File “<string>“, line 1, in <module> SystemError: <built-in function layers> returned a result with an error set
Workaround
You can use nuke.channels() to get all the channels, then strip those down to just the layers, for example:
newLayers = ['rgb', 'rgba', 'alpha'] for c in nuke.channels(nuke.selectedNode()): layerName = c[:c.rfind(".")] if layerName not in newLayers: newLayers.append(layerName) print(newLayers)
Reproduced by support
Guidance: Have you reproduced the problem? In which versions have you reproduced the problem? DELETE THIS LINE
This bug has been reproduced in:
Nuke 13.1v5
Nuke 13.2v4 - Windows 10, macOS 12
Nuke 13.2v1 - Windows 10, macOS 12* - regression
Unable to reproduce bug in:
Nuke 13.2v4 - CentOS 7
Nuke 13.1v5 - Windows 10
*In Nuke 13.2v1 on macOS, you have run the command twice to see the error, other Nuke 13.2 versions you see it the first time you run the code
Earliest version tested
Nuke 13.1v3 - This issue doesn't appear in this version and has regressed
We're sorry to hear that
Please tell us why