Created
August 28, 2019 16:55
-
-
Save BigRoy/653379bd3b0b1c2f6d85d50d05addf29 to your computer and use it in GitHub Desktop.
Fix Maya legacy renderlayer being unable to duplicate (it doesn't show up correctly, but it does create a new renderLayer node visible when Show DAG nodes only is disabled)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fix Maya bug where you cannot duplicate a renderlayer correctly bug | |
# This is with Legacy Renderlayers, not Render Setup. | |
# Bug has been found in both Maya 2018 + 2019 | |
import maya.cmds as mc | |
# Recreate all renderlayer overrides (.adjustments) | |
for layer in mc.ls(type="renderLayer"): | |
attr = layer + ".adjustments" | |
indices = mc.getAttr(attr, multiIndices=True) or [] | |
connections = [] | |
for index in indices: | |
# Collect current connection | |
index_attr = "{plug}[{index}]".format(plug=attr, index=index) | |
src = cmds.listConnections(index_attr + ".plug", | |
source=True, | |
plugs=True)[0] | |
value = cmds.getAttr(index_attr + ".value") | |
connections.append((src, value)) | |
# Remove the entry and break any connections | |
mc.removeMultiInstance(index_attr, b=True) | |
# Recreate the overrides | |
for i, (src, value) in enumerate(connections): | |
cmds.connectAttr(src, layer + ".adjustments[{0}].plug".format(i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It ran this time but sadly no joy. :/
Force renderlayer editor refresh
mel.eval('updateEditorRenderLayer "RenderLayerTab"')
Fixing missing renderLayerId connection for: BTY_ASIA1
prop_bridge:renderLayerManager.renderLayerId[2] -> BTY_ASIA1.identification
Fixing missing connection to defaultRenderingList for: BTY_ASIA1
BTY_ASIA1.message -> defaultRenderingList1.rendering