Is there a way to query the shader type via python(see picture)?
created
Feb '19
last reply
May '19
- 6
replies
- 3.1k
views
- 3
users
Is there a way to query the shader type via python(see picture)?
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")`
Topic | Category | Replies | Views | Activity |
---|---|---|---|---|
Who is interested in deploying this real-time renderer? | Maya | 0 | 798 | Mar 3 |
Free Toolkit for Modeling, Rigging, Animation! | Maya | 0 | 125 | 11d |
Project a geometry onto another geometry with a locator origin | Maya | 0 | 29 | 12h |