Feb 2019
1 / 7
Feb 2019
May 2019

Hm, I dont get it to work...
Could you give an example?

I found this pymel example, but could not get it to work either:

`import maya.cmds as cmds
import pymel.core as pm

sel = cmds.ls(sl=True)
selectedShapes = pm.listRelatives(sel , ad=True, type=["mesh", "nurbsSurface"])
for shape in selectedShapes:
shadingEngines = shadingGroup = shape.outputs(type="shadingEngine")
for shadingEngine in shadingEngines:
#surfaceShader = shadingEngine.surfaceShader
surfaceShader = cmds.getAttr(shadingEngine + ".surfaceShader")
print surfaceShader
if surfaceShader.type() == "lambert":
print("lambert")
if surfaceShader.type() == "surfaceShader":
print("surfaceShader")
else:
print("nope")`

Please make a little clearer answer...
using only your one line did not work for me
Could you provide a whole example?

cmds.hyperShade(shaderNetworksSelectMaterialNodes = 1)
rsShader = cmds.ls(sl=True)
rsShadersType = cmds.nodeType(rsShader)
print rsShadersType

this prints the name of the shader!

2 months later

closed May 4, '19

This topic was automatically closed after 87 days. New replies are no longer allowed.