zbw_curveJntRig.py 文件源码

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

项目:zTools 作者: zethwillie 项目源码 文件源码
def smartClose(*args):
    name = cmds.textFieldGrp(widgets["nameTFG"], q=True, tx=True)
    upSuf = cmds.textFieldGrp(widgets["upNameTFG"], q=True, tx=True)
    dwnSuf = cmds.textFieldGrp(widgets["downNameTFG"], q=True, tx=True)
    topMidCtrl = ctrlsUp[len(ctrlsUp)/2]
    downMidCtrl = ctrlsUp[len(ctrlsDown)/2]

    if len(lowResCurves)==2 and len(highResCurves)==2:
        tmpCloseLow = cmds.duplicate(lowResCurves[0], n="{0}_closeLowTmpCrv".format(name))[0]
        cmds.parent(tmpCloseLow, w=True)

        tmpLowBS = cmds.blendShape(lowResCurves[0], lowResCurves[1], tmpCloseLow)[0]
        tmpLowUpAttr = "{0}.{1}".format(tmpLowBS, lowResCurves[0])
        tmpLowDwnAttr = "{0}.{1}".format(tmpLowBS, lowResCurves[1])
        cmds.setAttr(tmpLowUpAttr, 0.5)
        cmds.setAttr(tmpLowDwnAttr, 0.5)
        closeLow = cmds.duplicate(tmpCloseLow, n="{0}_CLOSE_LOW_CRV".format(name))[0]
        cmds.delete([tmpCloseLow, tmpLowBS])
        lowBS = cmds.blendShape(lowResCurves[0], lowResCurves[1], closeLow)[0]
        lowUpAttr = "{0}.{1}".format(lowBS, lowResCurves[0])
        lowDwnAttr = "{0}.{1}".format(lowBS, lowResCurves[1])

#---------------- connect up down into reverse setup that drives lowclosecrv to go up/down
        cmds.addAttr(topMidCtrl, ln="__xtraAttrs__", )

        cmds.setAttr(lowUpAttr, 1)
        cmds.setAttr(lowDwnAttr, 0)
        closeUpHigh = cmds.duplicate(highResCurves[0], n="{0}_HI_{1}_CLOSE_CRV".format(name, upSuf.upper() ))[0]
        cmds.parent(closeUpHigh, w=True)
        upHighWire = cmds.wire(closeUpHigh, en=1, gw=True, ce=0, li=0, w=closeLow, name = "{0}_CLS_UP_WIRE".format(name))[0]
        wireUpBaseCrv = "{0}BaseWire".format(closeLow)
        cmds.setAttr("{0}.scale[0]".format(upHighWire), 0)
#---------------- set up blend shape on high res curve (drive high res with wire driven curve)
#---------------- set up the center ctrl to drive this BS

        cmds.setAttr(lowUpAttr, 0)
        cmds.setAttr(lowDwnAttr, 1)
        closeDwnHigh = cmds.duplicate(highResCurves[1], n="{0}_HI_{1}_CLOSE_CRV".format(name, dwnSuf.upper() ))[0]
        cmds.parent(closeDwnHigh, w=True)
        dwnHighWire = cmds.wire(closeDwnHigh, en=1, gw=True, ce=0, li=0, w=closeLow, name = "{0}_CLS_DWN_WIRE".format(name))[0]
        wireDwnBase = "{0}BaseWire".format(closeLow)
        cmds.setAttr("{0}.scale[0]".format(dwnHighWire), 0)
#---------------- set up blend shape on high res curve (drive high res with wire driven curve)
#---------------- set up the center ctrl to drive this BS
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号