Hello techeez,
I am going to make a script to render out wireframe of selected object or objects.
I know their are plenty of scripts to do this, but I am going to make a new one just as a part of my learning, join me to share the idea,
I have started with creating the material and the shading group
import maya.cmds as mc
material = mc.shadingNode('lambert', asShader=1, name='WireframeMTRL')
SG = mc.sets(renderable=1, noSurfaceShader=1, empty=1, name='WireframeSG')
mc.connectAttr((material+'.outColor'),(SG+'.surfaceShader'),f=1)
item=str(mc.ls(sl=True)[0])
mc.sets(item, e=1, forceElement=SG)
well just here, when I have selected a object I am trying to assign it to it. but I get warning message, in script editor, although SG & matrial is created and connected
[I]
Warning: Cannot add the following items to the set since the set has restrictions on membership: WireframeMTRL1
Warning: None of the items can be added to the set # [/I]
I am doing the last step since objects and faces are never actually connected or assigned directly to materials. Each material is connected to a shadingEngine and this is connected to the objects to be shaded and put it to the shadingEngine set.