Once you have a shading network created, you'll generally want to apply it to one or more objects. In this example, we'll be looking at how to do it. Along the way, we'll create a script that can be used to apply a shader to all of the objects in the scene that are without one.
Make sure that you have a scene with a few different objects in it. Select a few objects and apply a shader to them in the normal way, using the hypershade's interface. Delete the shader, leaving at least one object without any shader of any kind.
Create a new script and add the following code:
import maya.cmds as cmds def shadersFromObject(obj): cmds.select(obj, replace=True) cmds.hyperShade(obj, shaderNetworksSelectMaterialNodes=True) shaders = cmds.ls(selection=True) return shaders def isGeometry(obj): shapes = cmds.listRelatives(obj, shapes=True) shapeType = cmds.nodeType(shapes[0]) geometryTypes = ['mesh', 'nurbsSurface', 'subdiv...