コード例 #1
0
def bdAddEyeAttr(eyeCtrl):

    bdRigUtils.bdAddSeparatorAttr(eyeCtrl, '______')
    eyeAttr = ['BlinkUpper', 'BlinkLower']
    bdRigUtils.bdAddAttributeMinMax(eyeCtrl, eyeAttr, 'double', -10, 10, 0)
    eyeAttr = ['BlinkLine']
    bdRigUtils.bdAddAttributeMinMax(eyeCtrl, eyeAttr, 'double', -50, 50, 0)
コード例 #2
0
def bdAddAllFingerAttr(side):
    fingerAnim = cmds.ls(side + '_fingers_anim', type='transform')[0]
    fingerList = ['Index', 'Middle', 'Ring', 'Pinky', 'Thumb']
    attrList = ['Spread', 'Base', 'Middle', 'Tip']
    for finger in fingerList:
        bdRigUtils.bdAddSeparatorAttr(fingerAnim, '_' + finger + '_')
        fingerPart = 0
        for attr in attrList:
            cmds.addAttr(fingerAnim,
                         ln=finger + '_' + attr,
                         at='float',
                         min=-90,
                         max=90,
                         dv=0)
            cmds.setAttr((fingerAnim + "." + finger + '_' + attr),
                         e=True,
                         keyable=True)
            fingerJoint = cmds.ls(side + '_' + finger.lower() + '_bnd_jnt_0' +
                                  str(fingerPart),
                                  type='joint')[0]

            if attr == 'Spread':
                cmds.connectAttr(fingerAnim + "." + finger + '_' + attr,
                                 fingerJoint + '.rotateY')
            else:
                reverseVal = cmds.createNode('reverse',
                                             n=side + '_' + finger + '_' +
                                             str(fingerPart))
                cmds.connectAttr(fingerAnim + "." + finger + '_' + attr,
                                 reverseVal + '.inputZ')
                cmds.connectAttr(reverseVal + '.outputZ',
                                 fingerJoint + '.rotateZ')

                fingerPart += 1
コード例 #3
0
ファイル: bdRigEye.py プロジェクト: Mortaciunea/bdScripts
def bdAddEyeAttr(eyeCtrl):

	bdRigUtils.bdAddSeparatorAttr(eyeCtrl,'______')
	eyeAttr = ['BlinkUpper','BlinkLower']
	bdRigUtils.bdAddAttributeMinMax(eyeCtrl,eyeAttr,'double',-10,10,0)
	eyeAttr = ['BlinkLine']
	bdRigUtils.bdAddAttributeMinMax(eyeCtrl,eyeAttr,'double',-50,50,0)
コード例 #4
0
def bdAddAllFingerAttr(side):
	fingerAnim = pm.ls(side + '_Fingers_CON',type='transform')[0]
	fingerList = ['Index','Middle','Ring','Pinky','Thumb']
	attrList = ['SpreadMeta','Spread','Curl','Scrunch','Twist','BendMeta','Bend']
	for finger in fingerList:
		bdRigUtils.bdAddSeparatorAttr(fingerAnim.name(),'_' + finger + '_')
		if finger == 'Thumb':
			attrList = ['Spread','Curl','Scrunch','Twist','Bend']
		for attr in attrList:
			pm.addAttr(fingerAnim,ln=finger + '_' + attr,at = 'float',dv=0,min=-10,max=10)
			pm.setAttr((fingerAnim + "." + finger + '_' + attr),e=True, keyable=True)
コード例 #5
0
def bdAddAllFingerAttr(side):
    fingerAnim = pm.ls(side + '_Fingers_CON', type='transform')[0]
    fingerList = ['Index', 'Middle', 'Ring', 'Pinky', 'Thumb']
    attrList = [
        'SpreadMeta', 'Spread', 'Curl', 'Scrunch', 'Twist', 'BendMeta', 'Bend'
    ]
    for finger in fingerList:
        bdRigUtils.bdAddSeparatorAttr(fingerAnim.name(), '_' + finger + '_')
        if finger == 'Thumb':
            attrList = ['Spread', 'Curl', 'Scrunch', 'Twist', 'Bend']
        for attr in attrList:
            pm.addAttr(fingerAnim,
                       ln=finger + '_' + attr,
                       at='float',
                       dv=0,
                       min=-10,
                       max=10)
            pm.setAttr((fingerAnim + "." + finger + '_' + attr),
                       e=True,
                       keyable=True)
コード例 #6
0
ファイル: bdRigFingers.py プロジェクト: Mortaciunea/bdScripts
def bdAddAllFingerAttr(side):
	fingerAnim = cmds.ls(side + '_fingers_anim',type='transform')[0]
	fingerList = ['Index','Middle','Ring','Pinky','Thumb']
	attrList = ['Spread','Base','Middle','Tip']
	for finger in fingerList:
		bdRigUtils.bdAddSeparatorAttr(fingerAnim,'_' + finger + '_')
		fingerPart = 0
		for attr in attrList:
			cmds.addAttr(fingerAnim,ln=finger + '_' + attr,at = 'float',min = -90,max=90,dv=0)
			cmds.setAttr((fingerAnim + "." + finger + '_' + attr),e=True, keyable=True)
			fingerJoint = cmds.ls(side + '_' + finger.lower() + '_bnd_jnt_0' + str(fingerPart) ,type='joint')[0]
			
			if attr == 'Spread':
				cmds.connectAttr(fingerAnim + "." + finger + '_' + attr,fingerJoint + '.rotateY')
			else:
				reverseVal = cmds.createNode('reverse',n = side + '_' + finger + '_' + str(fingerPart)) 
				cmds.connectAttr(fingerAnim + "." + finger + '_' + attr,reverseVal + '.inputZ')
				cmds.connectAttr(reverseVal + '.outputZ',fingerJoint + '.rotateZ')
			
				fingerPart += 1
コード例 #7
0
def bdAddFingerAttr(side,finger):
	fingerAnim = cmds.ls(side + finger + 'anim',type='transform')[0]
	bdRigUtils.bdAddSeparatorAttr(fingerAnim,'_Bend_')
	attrList = ['All','Base','Middle','Tip']
	bdRigUtils.bdAddAttribute(fingerAnim,attrList,'float')
コード例 #8
0
ファイル: bdRigLeg.py プロジェクト: Mortaciunea/bdScripts
def bdRigLegBones(side):
    legBones = ['leg', 'knee', 'foot', 'toe', 'toe_end']
    for i in range(len(legBones)):
        legBones[i] = side + '_' + legBones[i] + '_ik_jnt'
#START setup foot roll
    legIk = cmds.ikHandle(sol='ikRPsolver',
                          sticky='sticky',
                          startJoint=legBones[0],
                          endEffector=legBones[2],
                          name=side + '_leg_ikHandle')
    footIk = cmds.ikHandle(sol='ikSCsolver',
                           sticky='sticky',
                           startJoint=legBones[2],
                           endEffector=legBones[3],
                           name=side + '_foot_ikHandle')
    toeIk = cmds.ikHandle(sol='ikSCsolver',
                          sticky='sticky',
                          startJoint=legBones[3],
                          endEffector=legBones[4],
                          name=side + '_toe_ikHandle')
    #create the groups that will controll the foot animations ( roll, bend, etc etc)
    bdRigUtils.bdCreateOffsetLoc(legBones[2], side + '_foot_loc')
    bdRigUtils.bdCreateOffsetLoc(legBones[3], side + '_ball_loc')
    bdRigUtils.bdCreateOffsetLoc(legBones[4], side + '_toe_loc')
    bdRigUtils.bdCreateOffsetLoc(legBones[2], side + '_heel_loc')

    cmds.parent([
        side + '_ball_loc_grp', side + '_toe_loc_grp', side + '_heel_loc_grp'
    ], side + '_foot_loc')
    cmds.parent([legIk[0], footIk[0], toeIk[0]], side + '_foot_loc')
    cmds.parent([legIk[0]], side + '_ball_loc')
    cmds.parent([side + '_ball_loc_grp', footIk[0], toeIk[0]],
                side + '_toe_loc')
    cmds.parent([side + '_toe_loc_grp'], side + '_heel_loc')

    #add atributes on the footGrp - will be conected later to an anim controler
    attrList = ['Heel', 'Ball', 'Toe', 'kneeTwist']
    animCtrl = cmds.ls(side + '_foot_ik_anim')[0]
    bdRigUtils.bdAddSeparatorAttr(animCtrl, '______')
    bdRigUtils.bdAddAttribute(animCtrl, attrList, 'float')
    #connect the attributes
    cmds.connectAttr(animCtrl + '.' + attrList[0], side + '_heel_loc' + '.rz')
    cmds.connectAttr(animCtrl + '.' + attrList[1], side + '_ball_loc' + '.rz')
    cmds.connectAttr(animCtrl + '.' + attrList[2], side + '_toe_loc' + '.rz')
    #setup the controller
    bdRigLegCtrl(side)
    #END setup foot roll

    #START no flip knee knee
    reverse = 1
    if side == 'right':
        reverse = -1

    poleVectorLoc = cmds.spaceLocator()
    poleVectorLoc = cmds.rename(poleVectorLoc, side + 'poleVector')
    poleVectorLocGrp = cmds.group(poleVectorLoc, n=poleVectorLoc + '_GRP')

    thighPos = cmds.xform(legBones[0], q=True, ws=True, t=True)

    cmds.move(thighPos[0] + reverse * 5, thighPos[1], thighPos[2],
              poleVectorLocGrp)

    cmds.poleVectorConstraint(poleVectorLoc, legIk[0])

    shadingNodeADL = cmds.shadingNode('addDoubleLinear',
                                      asUtility=True,
                                      name=side + 'adl_twist')
    ikZval = cmds.getAttr(str(legIk[0]) + '.rotateZ')
    cmds.setAttr(shadingNodeADL + '.input2', reverse * 90)
    cmds.connectAttr(animCtrl + '.' + attrList[3], shadingNodeADL + '.input1')
    cmds.connectAttr(shadingNodeADL + '.output', legIk[0] + '.twist')
    thighRot = cmds.xform(legBones[0], q=True, ro=True, ws=True)
    startTwist = reverse * 90
    limit = 0.001
    increment = reverse * 0.01

    while True:
        cmds.select(cl=True)
        thighRot = cmds.xform(legBones[0], q=True, ro=True, os=True)
        print thighRot[0]
        if ((thighRot[0] > limit)):
            startTwist = startTwist - increment
            cmds.setAttr(shadingNodeADL + '.input2', startTwist)
        else:
            break
コード例 #9
0
ファイル: bdRigLeg.py プロジェクト: Mortaciunea/bdScripts
def bdRigLegBones(side):
    legBones = ["leg", "knee", "foot", "toe", "toe_end"]
    for i in range(len(legBones)):
        legBones[i] = side + "_" + legBones[i] + "_ik_jnt"
    # START setup foot roll
    legIk = cmds.ikHandle(
        sol="ikRPsolver", sticky="sticky", startJoint=legBones[0], endEffector=legBones[2], name=side + "_leg_ikHandle"
    )
    footIk = cmds.ikHandle(
        sol="ikSCsolver", sticky="sticky", startJoint=legBones[2], endEffector=legBones[3], name=side + "_foot_ikHandle"
    )
    toeIk = cmds.ikHandle(
        sol="ikSCsolver", sticky="sticky", startJoint=legBones[3], endEffector=legBones[4], name=side + "_toe_ikHandle"
    )
    # create the groups that will controll the foot animations ( roll, bend, etc etc)
    bdRigUtils.bdCreateOffsetLoc(legBones[2], side + "_foot_loc")
    bdRigUtils.bdCreateOffsetLoc(legBones[3], side + "_ball_loc")
    bdRigUtils.bdCreateOffsetLoc(legBones[4], side + "_toe_loc")
    bdRigUtils.bdCreateOffsetLoc(legBones[2], side + "_heel_loc")

    cmds.parent([side + "_ball_loc_grp", side + "_toe_loc_grp", side + "_heel_loc_grp"], side + "_foot_loc")
    cmds.parent([legIk[0], footIk[0], toeIk[0]], side + "_foot_loc")
    cmds.parent([legIk[0]], side + "_ball_loc")
    cmds.parent([side + "_ball_loc_grp", footIk[0], toeIk[0]], side + "_toe_loc")
    cmds.parent([side + "_toe_loc_grp"], side + "_heel_loc")

    # add atributes on the footGrp - will be conected later to an anim controler
    attrList = ["Heel", "Ball", "Toe", "kneeTwist"]
    animCtrl = cmds.ls(side + "_foot_ik_anim")[0]
    bdRigUtils.bdAddSeparatorAttr(animCtrl, "______")
    bdRigUtils.bdAddAttribute(animCtrl, attrList, "float")
    # connect the attributes
    cmds.connectAttr(animCtrl + "." + attrList[0], side + "_heel_loc" + ".rz")
    cmds.connectAttr(animCtrl + "." + attrList[1], side + "_ball_loc" + ".rz")
    cmds.connectAttr(animCtrl + "." + attrList[2], side + "_toe_loc" + ".rz")
    # setup the controller
    bdRigLegCtrl(side)
    # END setup foot roll

    # START no flip knee knee
    reverse = 1
    if side == "right":
        reverse = -1

    poleVectorLoc = cmds.spaceLocator()
    poleVectorLoc = cmds.rename(poleVectorLoc, side + "poleVector")
    poleVectorLocGrp = cmds.group(poleVectorLoc, n=poleVectorLoc + "_GRP")

    thighPos = cmds.xform(legBones[0], q=True, ws=True, t=True)

    cmds.move(thighPos[0] + reverse * 5, thighPos[1], thighPos[2], poleVectorLocGrp)

    cmds.poleVectorConstraint(poleVectorLoc, legIk[0])

    shadingNodeADL = cmds.shadingNode("addDoubleLinear", asUtility=True, name=side + "adl_twist")
    ikZval = cmds.getAttr(str(legIk[0]) + ".rotateZ")
    cmds.setAttr(shadingNodeADL + ".input2", reverse * 90)
    cmds.connectAttr(animCtrl + "." + attrList[3], shadingNodeADL + ".input1")
    cmds.connectAttr(shadingNodeADL + ".output", legIk[0] + ".twist")
    thighRot = cmds.xform(legBones[0], q=True, ro=True, ws=True)
    startTwist = reverse * 90
    limit = 0.001
    increment = reverse * 0.01

    while True:
        cmds.select(cl=True)
        thighRot = cmds.xform(legBones[0], q=True, ro=True, os=True)
        print thighRot[0]
        if thighRot[0] > limit:
            startTwist = startTwist - increment
            cmds.setAttr(shadingNodeADL + ".input2", startTwist)
        else:
            break
コード例 #10
0
def bdAddFingerAttr(side, finger):
    fingerAnim = cmds.ls(side + finger + 'anim', type='transform')[0]
    bdRigUtils.bdAddSeparatorAttr(fingerAnim, '_Bend_')
    attrList = ['All', 'Base', 'Middle', 'Tip']
    bdRigUtils.bdAddAttribute(fingerAnim, attrList, 'float')