zbw_rig.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:zTools 作者: zethwillie 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号