Open
Description
In cmdx
, object sets work like Python's native set()
, and Maya's shaders are nothing but object sets. Add mesh to a shader like this.
import cmdx
tm = cmdx.createNode("transform")
shape = cmdx.createNode("mesh", parent=tm)
cube = cmdx.createNode("polyCube")
cube["width"] = 2.0
cube["output"] >> shape["inMesh"]
# Add to default Lambert
default_shader = cmdx.encode("initialShadingGroup")
default_shader.add(shape)