def copyShader(src = "", tgts = [], *args):
"""
gets the shader from the src and assigns it to the tgt objs
Args:
src (string): the object we're getting the shader FROM
tgts (list[strings]): the objects we're setting the shaders TO
"""
confirm = confirmDialog("Should I copy shaders?")
if confirm == "Yes":
for tgt in tgts:
shp = cmds.listRelatives(src, s=True)[0]
sg = cmds.listConnections(shp, t="shadingEngine")[0]
tshp = cmds.listRelatives(tgt, s=True)[0]
cmds.sets(tshp, e=True, forceElement=sg)
else:
print "Copy shader assignment cancelled"
return()
评论列表
文章目录