Exemplo n.º 1
0
    def handCleanUp(self, handOffsetCtrl, fkFingerOffsetCtrls, leftRight,
                    jntPalmBase, jntPalm, jntFingersUnsorted, grpConPalm,
                    conLocFKOffsetCtrl, conLocIKOffsetCtrl, *args):

        grpRigArm = mc.group(n="GRP_rig{0}arm".format(leftRight),
                             w=True,
                             em=True)
        # For the sake of not having a bazillion entries for the input text, I'm hardcoding things here
        mc.parent("GRP_CTRL_IK{0}arm".format(leftRight),
                  "GRP_jnt{0}arm".format(leftRight),
                  "OFFSET_CTRL{0}shoulder".format(leftRight), jntPalmBase,
                  handOffsetCtrl[0], grpConPalm, grpRigArm)
        CRU.lockHideCtrls(handOffsetCtrl[1],
                          translate=True,
                          scale=True,
                          visible=True)
        for i in range(len(fkFingerOffsetCtrls)):
            for j in range(len(fkFingerOffsetCtrls[i])):
                CRU.lockHideCtrls(fkFingerOffsetCtrls[i][j][1],
                                  scale=True,
                                  translate=True,
                                  visible=True)

        mc.setAttr("{0}.visibility".format(conLocFKOffsetCtrl[1]), False)
        mc.setAttr("{0}.visibility".format(conLocIKOffsetCtrl[1]), False)

        CRU.layerEdit(jntPalm, bndLayer=True, noRecurse=True)
        CRU.layerEdit(jntFingersUnsorted, bndLayer=True, noRecurse=True)
Exemplo n.º 2
0
    def neckCleanUp(self, headOffsetCtrls, eyeCtrlArray, eyesCtrl, *args):

        for i in range(len(headOffsetCtrls)):
            CRU.lockHideCtrls(headOffsetCtrls[i][1], scale=True, visible=True)

        for i in range(len(eyeCtrlArray)):
            CRU.lockHideCtrls(eyeCtrlArray[i], scale=True, visible=True)

        CRU.lockHideCtrls(eyesCtrl, scale=True, visible=True)

        CRU.layerEdit(self.jointArray, bndLayer=True, noRecurse=True)
    def spineCleanup(self, fkHipOffsetCtrl, offsetCtrlFKJnts, spineIKs,
                     spineIKCtrls, cogOffsetCtrl, crvSpine, ikSpine, fkHip,
                     fkJnts, *args):  # lock attributes

        CRU.lockHideCtrls(fkHipOffsetCtrl[1],
                          translate=True,
                          scale=True,
                          visible=True)
        for i in range(len(offsetCtrlFKJnts)):
            CRU.lockHideCtrls(offsetCtrlFKJnts[i][1],
                              translate=True,
                              scale=True,
                              visible=True)

        for i in range(len(spineIKs)):
            CRU.lockHideCtrls(spineIKCtrls[i][1], scale=True, visible=True)

        CRU.lockHideCtrls(cogOffsetCtrl[1], scale=True, visible=True)

        mc.setAttr('{0}.v'.format(crvSpine), False)
        mc.setAttr('{0}.v'.format(ikSpine), False)

        CRU.lockHideCtrls(crvSpine, visible=True)
        CRU.lockHideCtrls(ikSpine, visible=True)

        CRU.layerEdit(spineIKs, ikLayer=True, noRecurse=True)
        CRU.layerEdit(self.jointArray, bndLayer=True, noRecurse=True)
        CRU.layerEdit(fkHip, fkLayer=True, noRecurse=True)
        CRU.layerEdit(fkJnts, fkLayer=True, noRecurse=True)
    def toesCleanup(self, ctrlToes, jntMasterToes, jntAnkleTwist,
                    fkJntOffsetCtrls, grpCtrlFoot, grpLegs, colourTU, *args):

        mc.parent(ctrlToes, jntAnkleTwist)

        checkList = mc.listRelatives(ctrlToes)
        for i in range(len(checkList)):
            if mc.objectType(checkList[i]) == "transform":
                CRU.lockHideCtrls(checkList[i],
                                  translate=True,
                                  rotate=True,
                                  scale=True,
                                  toHide=True,
                                  visible=True,
                                  toLock=False)
        mc.makeIdentity(ctrlToes,
                        apply=True,
                        translate=True,
                        rotate=True,
                        scale=True)

        # get the non-shape values
        lockValues = mc.listRelatives(ctrlToes,
                                      c=True,
                                      s=False,
                                      type="transform")
        lockValues.append(ctrlToes)

        for i in range(len(lockValues)):
            CRU.lockHideCtrls(lockValues[i],
                              translate=True,
                              rotate=True,
                              scale=True,
                              visible=True)

            mc.setAttr('{0}.overrideEnabled'.format(lockValues[i]), 1)
            mc.setAttr("{0}.overrideColor".format(lockValues[i]), colourTU)

        # toeGrpName = "GRP_CTRL_{0}toes".format(leftRight)
        # toeGrp = mc.group(name=toeGrpName, w=True)
        for i in range(len(fkJntOffsetCtrls)):
            for j in range(len(fkJntOffsetCtrls[i])):
                CRU.lockHideCtrls(fkJntOffsetCtrls[i][j][1],
                                  translate=True,
                                  scale=True,
                                  visible=True)

        mc.parent(grpCtrlFoot, grpLegs)
        CRU.layerEdit(jntMasterToes, bndLayer=True, noRecurse=True)
    def armCleanUp(self, fkJnts, ikJnts, ikJntsDrive, bndJnts, jntShoulderRoot,
                   jntScapula, jntClavicle, checkboxSpine, shoulderOffsetCtrl,
                   scapulaOffsetCtrl, clavicleOffsetCtrl, ikOffsetCtrl,
                   elbowOffsetCtrl, ikArms, jntSpine6, ikSide,
                   fkJntOffsetCtrls, ctrlFKIK, ctrlFKIKAttr, *args):

        mc.parent(fkJnts[0], ikJnts[0], ikJntsDrive[0], jntShoulderRoot)

        if checkboxSpine:
            mc.parentConstraint(jntSpine6, shoulderOffsetCtrl[0], mo=True)

        mc.pointConstraint(shoulderOffsetCtrl[1], jntShoulderRoot)

        # group OFFSET_CTRL_IK_l_arm, OFFSET_CTRL_l_elbow into GRP_CTRL_IK_l_arm
        ikGrpCtrlName = "GRP_CTRL_IK_" + ikSide
        ikGrpCtrl = mc.group(n=ikGrpCtrlName, w=True, em=True)

        mc.parent(ikOffsetCtrl[0], elbowOffsetCtrl[0], ikGrpCtrl)

        # group IK_l_arm, JNT_l_shouder into GRP_jnt_l_arm
        armGrpRigName = "GRP_jnt_" + ikSide
        armRigGrp = mc.group(n=armGrpRigName, w=True, em=True)

        mc.parent(ikArms[0], jntShoulderRoot, armRigGrp)

        # creating lists to set invisible
        fksToVisible = [fkJntOffsetCtrls[0][1], fkJnts[0]]
        iksToVisible = [
            ikOffsetCtrl[1], ikJnts[0], ikJntsDrive[0], elbowOffsetCtrl[1]
        ]
        tangentToUse = ["linear", "step"]
        visMin = 0.001

        # set the FK to visible when not ctrlFKIK not 1 for arm attribute
        for i in range(len(fksToVisible)):
            CRU.setDriverDrivenValues(ctrlFKIK,
                                      ctrlFKIKAttr,
                                      fksToVisible[i],
                                      "visibility",
                                      drivenValue=True,
                                      driverValue=0,
                                      modifyInOut=tangentToUse)
            CRU.setDriverDrivenValues(ctrlFKIK,
                                      ctrlFKIKAttr,
                                      fksToVisible[i],
                                      "visibility",
                                      drivenValue=True,
                                      driverValue=1 - visMin,
                                      modifyInOut=tangentToUse)
            CRU.setDriverDrivenValues(ctrlFKIK,
                                      ctrlFKIKAttr,
                                      fksToVisible[i],
                                      "visibility",
                                      drivenValue=False,
                                      driverValue=1,
                                      modifyInOut=tangentToUse)

        tangentToUse = ["linear", "step"]
        # set the IK to visible when not ctrlFKIK not 0 for arm attribute
        for i in range(len(iksToVisible)):
            CRU.setDriverDrivenValues(ctrlFKIK,
                                      ctrlFKIKAttr,
                                      iksToVisible[i],
                                      "visibility",
                                      drivenValue=False,
                                      driverValue=0,
                                      modifyInOut=tangentToUse)
            CRU.setDriverDrivenValues(ctrlFKIK,
                                      ctrlFKIKAttr,
                                      iksToVisible[i],
                                      "visibility",
                                      drivenValue=True,
                                      driverValue=visMin,
                                      modifyInOut=tangentToUse)
            CRU.setDriverDrivenValues(ctrlFKIK,
                                      ctrlFKIKAttr,
                                      iksToVisible[i],
                                      "visibility",
                                      drivenValue=True,
                                      driverValue=1,
                                      modifyInOut=tangentToUse)

        # locking and hiding the IK controls
        CRU.lockHideCtrls(ikOffsetCtrl[1],
                          rotate=True,
                          scale=True,
                          visible=True)
        for fkJntOC in fkJntOffsetCtrls:
            CRU.lockHideCtrls(fkJntOC[1], translate=True, scale=True)
            CRU.lockHideCtrls(fkJntOC[1], visible=True, toLock=False)
        CRU.lockHideCtrls(shoulderOffsetCtrl[1],
                          translate=True,
                          scale=True,
                          visible=True)
        CRU.lockHideCtrls(scapulaOffsetCtrl[1],
                          translate=True,
                          scale=True,
                          visible=True)
        CRU.lockHideCtrls(clavicleOffsetCtrl[1],
                          translate=True,
                          scale=True,
                          visible=True)
        CRU.lockHideCtrls(elbowOffsetCtrl[1],
                          rotate=True,
                          scale=True,
                          visible=True)

        # hiding the visibility for the FK

        # locking and hiding the effectors and IK
        # to delete: May need to not have this hidden
        mc.setAttr("{0}.visibility".format(ikArms[0]), False)
        CRU.lockHideCtrls(ikArms[0], visible=True)
        CRU.lockHideCtrls(ikArms[1], visible=True)

        CRU.layerEdit(ikJnts, ikLayer=True, noRecurse=True)
        CRU.layerEdit(fkJnts, fkLayer=True, noRecurse=True)
        CRU.layerEdit(ikJntsDrive, ikdriveLayer=True, noRecurse=True)
        CRU.layerEdit(bndJnts, bndLayer=True, noRecurse=True)
        CRU.layerEdit(jntShoulderRoot, bndLayer=True, noRecurse=True)
        CRU.layerEdit(jntScapula, bndLayer=True, noRecurse=True)
        CRU.layerEdit(jntClavicle, bndLayer=True, noRecurse=True)
    def legCleanUp(self, fkJnts, ikJnts, ikJntsDrive, bndJnts, ikOffsetCtrl,
                   fkJntOffsetCtrls, hipIKOffsetCtrl, ctrlFKHip, leftRight,
                   ctrlFKIK, ctrlFKIKAttr, checkboxHip, footCtrlsOffsetCtrl,
                   *args):

        # group the root leg joints and the IK control
        grpLegRigName = "GRP_rig_" + leftRight + "leg"
        grpLegJntName = "GRP_JNT_" + leftRight + "leg"

        grpLegRig = mc.group(n=grpLegRigName, w=True, em=True)
        grpLegJnt = mc.group(n=grpLegJntName, w=True, em=True)

        mc.parent(fkJnts[0], ikJnts[0], ikJntsDrive[0], bndJnts[0], grpLegJnt)
        mc.parent(grpLegJnt, ikOffsetCtrl[0], footCtrlsOffsetCtrl[0],
                  grpLegRig)

        # attach objects to the hip
        if checkboxHip:
            mc.parent(fkJntOffsetCtrls[0][0], hipIKOffsetCtrl[0], ctrlFKHip)

        # Hiding the visibility of the joints
        mc.setAttr("{0}.visibility".format(ikJnts[0]), False)
        mc.setAttr("{0}.visibility".format(ikJntsDrive[0]), False)
        mc.setAttr("{0}.visibility".format(fkJnts[0]), False)
        mc.setAttr("{0}.visibility".format(hipIKOffsetCtrl[1]), False)

        # locking and hiding the IK controls

        # my custom control shouldn't be moved by the animator
        CRU.lockHideCtrls(footCtrlsOffsetCtrl[1],
                          translate=True,
                          rotate=True,
                          scale=True,
                          visible=True)

        # locking and hiding the CTRL_IK_l_hip
        CRU.lockHideCtrls(hipIKOffsetCtrl[1], scale=True, visible=True)

        # set the FK to visible when not ctrlFKIK not 1 for leg attribute

        tangentToUse = ["linear", "step"]
        visMin = 0.001

        CRU.setDriverDrivenValues(ctrlFKIK,
                                  ctrlFKIKAttr,
                                  fkJntOffsetCtrls[0][1],
                                  "visibility",
                                  drivenValue=True,
                                  driverValue=0,
                                  modifyInOut=tangentToUse)
        CRU.setDriverDrivenValues(ctrlFKIK,
                                  ctrlFKIKAttr,
                                  fkJntOffsetCtrls[0][1],
                                  "visibility",
                                  drivenValue=True,
                                  driverValue=1 - visMin,
                                  modifyInOut=tangentToUse)
        CRU.setDriverDrivenValues(ctrlFKIK,
                                  ctrlFKIKAttr,
                                  fkJntOffsetCtrls[0][1],
                                  "visibility",
                                  drivenValue=False,
                                  driverValue=1,
                                  modifyInOut=tangentToUse)

        tangentToUse = ["linear", "step"]
        # set the IK to visible when not ctrlFKIK not 0 for leg attribute
        CRU.setDriverDrivenValues(ctrlFKIK,
                                  ctrlFKIKAttr,
                                  ikOffsetCtrl[1],
                                  "visibility",
                                  drivenValue=False,
                                  driverValue=0,
                                  modifyInOut=tangentToUse)
        CRU.setDriverDrivenValues(ctrlFKIK,
                                  ctrlFKIKAttr,
                                  ikOffsetCtrl[1],
                                  "visibility",
                                  drivenValue=True,
                                  driverValue=visMin,
                                  modifyInOut=tangentToUse)
        CRU.setDriverDrivenValues(ctrlFKIK,
                                  ctrlFKIKAttr,
                                  ikOffsetCtrl[1],
                                  "visibility",
                                  drivenValue=True,
                                  driverValue=1,
                                  modifyInOut=tangentToUse)

        CRU.layerEdit(fkJnts, fkLayer=True, noRecurse=True)
        CRU.layerEdit(ikJnts, ikLayer=True, noRecurse=True)
        CRU.layerEdit(ikJntsDrive, ikdriveLayer=True, noRecurse=True)
        CRU.layerEdit(bndJnts, bndLayer=True, noRecurse=True)

        CRU.lockHideCtrls(ikOffsetCtrl[1],
                          rotate=True,
                          scale=True,
                          visible=True)

        for fkOC in fkJntOffsetCtrls:
            CRU.lockHideCtrls(fkOC[1],
                              translate=True,
                              scale=True,
                              visible=True)