Heya
Bit sort of non/related question...
I'm trying to list incoming connection to my shader but I get some extra nodes I'm not sure how to filter out
I want to make a script to disconnect textures attached to nodes on multiple shaders. I got MR one working but Vray for some reason somehow is picky...
Any hints?
selected = cmds.ls(sl=1, mat=1)
for materials in selected:
connections = cmds.listConnections(c=1)
newMatName = materials +'.diffuseColorAmount'
for inNodes in connections:
cmds.disconnectAttr(connections,newMatName)
# Error: Invalid argument 1, '[u'VRayMtl1.message', u'materialInfo1', u'VRayMtl1.message', u'defaultShaderList1', u'VRayMtl1.outColor', u'VRayMtl1SG', u'VRayMtl1.diffuseColorAmount', u'VRayFlakesMtl1']'. Expected arguments of type ( , )
# Traceback (most recent call last):
# File "<maya console>", line 6, in <module>
# TypeError: Invalid argument 1, '[u'VRayMtl1.message', u'materialInfo1', u'VRayMtl1.message', u'defaultShaderList1', u'VRayMtl1.outColor', u'VRayMtl1SG', u'VRayMtl1.diffuseColorAmount', u'VRayFlakesMtl1']'. Expected arguments of type ( , ) #
Thanks, bye.
Bit sort of non/related question...
I'm trying to list incoming connection to my shader but I get some extra nodes I'm not sure how to filter out

I want to make a script to disconnect textures attached to nodes on multiple shaders. I got MR one working but Vray for some reason somehow is picky...
Any hints?
selected = cmds.ls(sl=1, mat=1)
for materials in selected:
connections = cmds.listConnections(c=1)
newMatName = materials +'.diffuseColorAmount'
for inNodes in connections:
cmds.disconnectAttr(connections,newMatName)
# Error: Invalid argument 1, '[u'VRayMtl1.message', u'materialInfo1', u'VRayMtl1.message', u'defaultShaderList1', u'VRayMtl1.outColor', u'VRayMtl1SG', u'VRayMtl1.diffuseColorAmount', u'VRayFlakesMtl1']'. Expected arguments of type ( , )
# Traceback (most recent call last):
# File "<maya console>", line 6, in <module>
# TypeError: Invalid argument 1, '[u'VRayMtl1.message', u'materialInfo1', u'VRayMtl1.message', u'defaultShaderList1', u'VRayMtl1.outColor', u'VRayMtl1SG', u'VRayMtl1.diffuseColorAmount', u'VRayFlakesMtl1']'. Expected arguments of type ( , ) #
Thanks, bye.
Comment