def blendRotation(blend="none", sourceA="none", sourceB="none", target="none", sourceValue="none"):
#add input and *args?
"""name is first arg, then three objects. Blends rotation 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'"""
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 + ".rotate"
sourceBOut = sourceB + ".rotate"
targetIn = target + ".rotate"
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)
评论列表
文章目录