def blendTranslate(blend="none", sourceA="none", sourceB="none", target="none", sourceValue="none"):
"""name is first arg, then three objects. Blends translation from first two selected into third selected. SourceValue (last input) is for the driving obj.attr. First source is active at '1', second at '2'"""
#add input and *args
if blend == "none":
blend = "blendColors"
if sourceA == "none":
sel = getSelection()
if len(sel) != 3:
cmds.error("Error: blendRotation, select three transforms")
#inert some kind of break here
sourceA = sel[0]
sourceB = sel[1]
target = sel[2]
blend = cmds.shadingNode("blendColors", asUtility=True, name=blend)
sourceAOut = sourceA + ".translate"
sourceBOut = sourceB + ".translate"
targetIn = target + ".translate"
blend1 = blend + ".color1"
blend2 = blend + ".color2"
blendOut = blend + ".output"
cmds.connectAttr(sourceAOut, blend1)
cmds.connectAttr(sourceBOut, blend2)
cmds.connectAttr(blendOut, targetIn)
if not sourceValue == "none":
cmds.connectAttr(sourceValue, "%s.blender"%blend)
return(blend)
评论列表
文章目录