Skip to content

Instantly share code, notes, and snippets.

@achayan
Created August 14, 2015 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achayan/e8f14f6b88a34e731351 to your computer and use it in GitHub Desktop.
Save achayan/e8f14f6b88a34e731351 to your computer and use it in GitHub Desktop.
def applyMaterial(node):
if cmds.objExists(node):
shd = cmds.shadingNode('lambert', name="%s_lambert" % node, asShader=True)
shdSG = cmds.sets(name='%sSG' % shd, empty=True, renderable=True, noSurfaceShader=True)
cmds.connectAttr('%s.outColor' % shd, '%s.surfaceShader' % shdSG)
cmds.sets(node, e=True, forceElement=shdSG)
applyMaterial("pSphere1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment