Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
4.6 kB
5
Indexable
Never
def FingTweakDRV():
    srName = ['R_PinkyKnucle_Drv_Sr', 'R_MidKnucle_Drv_Sr', 'R_IndexKnucle_Drv_Sr',
              'R_PinkyCrease_Drv_Sr', 'R_MidCrease_Drv_Sr', 'R_IndexCrease_Drv_Sr']
    DrvCtrl = ['R_ShirtKnuckleTweekA_Main_Drv', 'R_ShirtKnuckleTweekB_Main_Drv', 'R_ShirtKnuckleTweekC_Main_Drv',
               'R_ShirtKnuckleTweekF_Main_Drv', 'R_ShirtKnuckleTweekE_Main_Drv', 'R_ShirtKnuckleTweekD_Main_Drv']
    DrvJnt = ['R_Pinky_A_Bind_Jnt', 'R_Middle_A_Bind_Jnt', 'R_Index_A_Bind_Jnt', 'R_Pinky_A_Bind_Jnt',
              'R_Middle_A_Bind_Jnt', 'R_Index_A_Bind_Jnt']

    zip_object = zip(srName, DrvCtrl, DrvJnt)

    for sr, dc, dj in zip_object:
        mc.createNode('setRange', n=sr)
        mc.connectAttr(dj + '.rotateX', sr + '.valueX')
        mc.connectAttr(dj + '.rotateX', sr + '.valueY')
        mc.connectAttr(dj + '.rotateX', sr + '.valueZ')
        mc.connectAttr(sr + '.outValueX', dc + '.translateX')
        mc.connectAttr(sr + '.outValueY', dc + '.translateY')
        mc.connectAttr(sr + '.outValueZ', dc + '.translateZ')

    RotVal = [30, 30, 30]
    SrVal = [0,-0.25,0.15]
    my_node = srName[0]
    
    # R_PinkyKnucle_Drv_Sr Values
    _set_range_values(srName[0],  [30, 30, 30], [0,-0.25,0.15])

    # R_MidKnucle_Drv_Sr Values
    _set_range_values(srName[1],  [30, 30, 30], [0,-0.25,0])

    # R_IndexKnucle_Drv_Sr
    mc.setAttr(srName[2] + '.oldMaxX', 30)
    mc.setAttr(srName[2] + '.oldMaxY', 30)
    mc.setAttr(srName[2] + '.oldMaxZ', 30)
    mc.setAttr(srName[2] + ".maxX", 0)
    mc.setAttr(srName[2] + ".maxY", -0.25)
    mc.setAttr(srName[2] + ".maxZ", -0.25)

    # R_PinkyCrease_Drv_Sr Values
    mc.setAttr(srName[3] + '.oldMaxX', 50)
    mc.setAttr(srName[3] + '.oldMinY', -30)
    mc.setAttr(srName[3] + '.oldMinZ', -30)
    mc.setAttr(srName[3] + ".maxX", 0.25)
    mc.setAttr(srName[3] + ".minY", 0.15)
    mc.setAttr(srName[3] + ".minZ", 0.15)

    # R_MidCrease_Drv_Sr Values
    mc.setAttr(srName[4] + '.oldMaxX', 50)
    mc.setAttr(srName[4] + '.oldMinY', -30)
    mc.setAttr(srName[4] + '.oldMinZ', -30)
    mc.setAttr(srName[4] + ".maxX", 0.25)
    mc.setAttr(srName[4] + ".minY", 0.15)
    mc.setAttr(srName[4] + ".minZ", 0)

    # R_IndexCrease_Drv_Sr
    mc.setAttr(srName[5] + '.oldMaxX', 50)
    mc.setAttr(srName[5] + '.oldMinY', -30)
    mc.setAttr(srName[5] + '.oldMinZ', -30)
    mc.setAttr(srName[5] + ".maxX", 0.25)
    mc.setAttr(srName[5] + ".minY", 0.15)
    mc.setAttr(srName[5] + ".minZ", -0.15)


def _set_range_values(my_node, RotVal, SrVal):
    mc.setAttr('{}.oldMaxX'.format(my_node), RotVal[0])
    mc.setAttr('{}.oldMaxY'.format(my_node), RotVal[1])
    mc.setAttr('{}.oldMaxZ'.format(my_node), RotVal[2])
    mc.setAttr("{}.maxX".format(my_node), SrVal[0])
    mc.setAttr("{}.maxY".format(my_node), SrVal[1])
    mc.setAttr("{}.maxZ".format(my_node), SrVal[2])


def FingTweakCFX():
    srName = ['R_PinkyKnucle_Cfx_sr', 'R_IndexKnucle_Cfx_sr',
              'R_PinkyCrease_Cfx_sr', 'R_IndexCrease_Cfx_sr']
    DrvCtrl = ['R_ShirtKnuckleTweekA_Main_Cfx', 'R_ShirtKnuckleTweekC_Main_Cfx',
               'R_ShirtKnuckleTweekF_Main_Cfx', 'R_ShirtKnuckleTweekD_Main_Cfx']
    DrvJnt = ['R_Pinky_A_Bind_Jnt', 'R_Index_A_Bind_Jnt',
              'R_Pinky_A_Bind_Jnt', 'R_Index_A_Bind_Jnt']

    zip_object = zip(srName, DrvCtrl, DrvJnt)

    for sr, dc, dj in zip_object:
        mc.createNode('setRange', n=sr)
        mc.connectAttr(dj + '.rotateZ', sr + '.valueZ')
        mc.connectAttr(dj + '.rotateZ', sr + '.valueY')
        mc.connectAttr(sr + '.outValueZ', dc + '.translateZ')
        mc.connectAttr(sr + '.outValueY', dc + '.translateY')

    # R_PinkyKnucle_Cfx_sr Values

    mc.setAttr(srName[0] + '.oldMaxZ', 30)
    mc.setAttr(srName[0] + ".maxZ", 0.2)
    mc.setAttr(srName[0] + '.oldMaxY', 30)
    mc.setAttr(srName[0] + ".maxY", 0)

    # R_PinkyCrease_Cfx_sr Values
    mc.setAttr(srName[2] + '.oldMaxZ', 30)
    mc.setAttr(srName[2] + ".maxZ", 0.2)
    mc.setAttr(srName[2] + '.oldMaxY', 30)
    mc.setAttr(srName[2] + ".maxY", 0)

    # R_IndexKnucle_Cfx_sr
    mc.setAttr(srName[1] + '.oldMinZ', -30)
    mc.setAttr(srName[1] + ".minZ", -0.5)
    mc.setAttr(srName[1] + '.oldMinY', -30)
    mc.setAttr(srName[1] + ".minY", -0.25)

    # R_IndexCrease_Cfx_sr

    mc.setAttr(srName[3] + '.oldMinZ', -30)
    mc.setAttr(srName[3] + ".minZ", -0.15)
    mc.setAttr(srName[3] + '.oldMinY', -30)
    mc.setAttr(srName[3] + ".minY", -0.25)


FingTweakDRV()
FingTweakCFX()