def createRootTransform(self, ctrlBody, grpTorso, spineInfo,
                            spineStretchNameDiv, *args):
        # we are trying to normalize this value so the spine stretches properly
        rootName = "rootTransform"
        grpRootTransformName = "GRP_" + rootName

        grpRootTransform = mc.group(n=grpRootTransformName, em=True, w=True)
        mc.parent(ctrlBody, grpTorso, grpRootTransform)
        globalScaleNormalizeDiv = "globalScale_spineNormalize_DIV"
        mc.shadingNode("multiplyDivide", n=globalScaleNormalizeDiv, au=True)
        mc.setAttr("{0}.operation".format(globalScaleNormalizeDiv), 2)

        mc.connectAttr("{0}.arcLength".format(spineInfo),
                       "{0}.i1x".format(globalScaleNormalizeDiv))
        mc.connectAttr("{0}.sy".format(grpRootTransformName),
                       "{0}.i2x".format(globalScaleNormalizeDiv))
        # we want to overwrite the old version
        mc.connectAttr("{0}.ox".format(globalScaleNormalizeDiv),
                       "{0}.i1x".format(spineStretchNameDiv),
                       f=True)

        # creates the control
        ctrlRoot, fkShape = CRU.createCTRLsFKDirect(grpRootTransformName,
                                                    50,
                                                    orientVal=(0, 1, 0),
                                                    colourTU=13,
                                                    addPrefix="CTRL")

        ctrlRootRename = ctrlRoot.replace("_GRP_", "_")
        ctrlRoot = mc.rename(ctrlRoot, ctrlRootRename)
        CRU.layerEdit(ctrlRoot, bodyLayer=True, noRecurse=True, colourTU=13)

        CRU.lockHideCtrls(ctrlRoot, visibility=True)

        return globalScaleNormalizeDiv
    def makeFingersAttr(self,
                        ctrl,
                        attr,
                        cmpdCTRLs,
                        valPos,
                        valNeg,
                        drvnAttr,
                        passVals,
                        skipNeg=False,
                        isLocked=False):
        # the 4 finger joints
        tangentToUse = ["linear", "linear"]
        for j in range(len(valPos)):
            if passVals[j]:
                if isLocked:
                    CRU.lockHideCtrls(cmpdCTRLs[j],
                                      rotate=True,
                                      attrVisible=True,
                                      toLock=False)
                    # to delete: need to relock things at the end

                CRU.setDriverDrivenValues(ctrl,
                                          attr,
                                          cmpdCTRLs[j],
                                          drvnAttr,
                                          0,
                                          0,
                                          modifyInOut=tangentToUse)
                CRU.setDriverDrivenValues(ctrl,
                                          attr,
                                          cmpdCTRLs[j],
                                          drvnAttr,
                                          10,
                                          valPos[j],
                                          modifyInOut=tangentToUse)
                if not skipNeg:
                    CRU.setDriverDrivenValues(ctrl,
                                              attr,
                                              cmpdCTRLs[j],
                                              drvnAttr,
                                              -10,
                                              valNeg[j],
                                              modifyInOut=tangentToUse)

                if isLocked:
                    CRU.lockHideCtrls(cmpdCTRLs[j], rotate=True)

        return
    def spineCleanup(self, ctrlFKJnts, ctrlFKJntsEnds, grpFKConsts, grpTorso,
                     ctrlBody, spineIKs, spineIKCtrls, crvSpine, hdlSpine,
                     jntArray, *args):  # lock attributes

        # lock the translate/scale for the control joints
        for i in range(len(ctrlFKJnts)):
            CRU.lockHideCtrls(ctrlFKJnts[i],
                              translate=True,
                              scale=True,
                              visibility=True)
            CRU.lockHideCtrls(ctrlFKJnts[i],
                              theVals=["radi"],
                              channelBox=False,
                              toLock=True,
                              attrVisible=False)

        # lock everything for the other fk bones
        for i in range(len(ctrlFKJntsEnds)):
            CRU.lockHideCtrls(ctrlFKJntsEnds[i],
                              translate=True,
                              scale=True,
                              rotate=True,
                              visibility=True)
            CRU.lockHideCtrls(ctrlFKJntsEnds[i],
                              theVals=["radi"],
                              channelBox=False,
                              toLock=True,
                              attrVisible=False)

        # lock everything except visibility for grpTorso
        CRU.lockHideCtrls(
            grpTorso,
            translate=True,
            scale=True,
            rotate=True,
        )

        # lock everything for the grpFK Consts
        for i in range(len(grpFKConsts)):
            CRU.lockHideCtrls(ctrlFKJntsEnds[i],
                              translate=True,
                              scale=True,
                              rotate=True,
                              visibility=True)

        # lock and hide the scale and visibility for everything else
        CRU.lockHideCtrls(ctrlBody, scale=True, visibility=True)

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

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

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

        CRU.lockHideCtrls(crvSpine, visibility=True)
        CRU.lockHideCtrls(hdlSpine, visibility=True)

        CRU.layerEdit(ctrlFKJnts,
                      fkLayer=True,
                      noRecurse=True,
                      colourTU=CRU.clrBodyFK)
        CRU.layerEdit(ctrlFKJntsEnds,
                      fkLayer=True,
                      noRecurse=True,
                      colourTU=CRU.clrBodyFK)
        CRU.layerEdit(spineIKCtrls,
                      ikLayer=True,
                      noRecurse=True,
                      colourTU=CRU.clrBodyIK)
        CRU.layerEdit(jntArray, bndLayer=True, noRecurse=True, layerState=1)

        altBnds = [x for x in jntArray if "end" in x.lower()]
        CRU.layerEdit(altBnds, bndAltLayer=True, noRecurse=True, layerState=1)

        CRU.layerEdit(ctrlBody,
                      bodyLayer=True,
                      noRecurse=True,
                      colourTU=CRU.clrBodyMain)
Exemple #4
0
    def neckCleanUpExtras(self, cbJaw, grpJaw, ctrlJaw, cbEyes, eyeCtrlArray,
                          eyesCtrl, eyeGrpArray, eyesGrp, grpHeadDNT,
                          jntArrayHead, ikNeckEnd, checkHead, *args):
        if checkHead:
            mc.parent(jntArrayHead[0], grpHeadDNT)

        if cbJaw:
            CRU.lockHideCtrls(grpJaw,
                              translate=True,
                              rotate=True,
                              scale=True,
                              visibility=True)
            CRU.lockHideCtrls(ctrlJaw,
                              translate=True,
                              scale=True,
                              visibility=True)

        if cbEyes:
            # lock and hide the group values for the eyes
            CRU.lockHideCtrls(eyesGrp,
                              translate=True,
                              rotate=True,
                              scale=True,
                              visibility=True)
            for i in range(len(eyeGrpArray)):
                CRU.lockHideCtrls(eyeGrpArray[i],
                                  translate=True,
                                  rotate=True,
                                  scale=True,
                                  visibility=True)

            # lock and hide all but the translates for the individual eyes
            for i in range(len(eyeCtrlArray)):
                CRU.lockHideCtrls(eyeCtrlArray[i],
                                  rotate=True,
                                  scale=True,
                                  visibility=True)

            # lock and hide the scale and visible eyes control
            CRU.lockHideCtrls(eyesCtrl, scale=True, visibility=True)
        # I'm just going to hardcode this bit for simplicity's sake

        grpGeoHead = "GRP_GEO_head"
        if mc.objExists(grpGeoHead):
            mc.parentConstraint(ikNeckEnd, grpGeoHead, mo=True)
            mc.parent(grpGeoHead, grpHeadDNT)

        if checkHead:
            altBnds = [
                x for x in jntArrayHead if "eye" in x.lower()
                or "jaw1" in x.lower() or "end" in x.lower()
            ]
            CRU.layerEdit(jntArrayHead, bndLayer=True, noRecurse=True)
            CRU.layerEdit(altBnds, bndAltLayer=True, noRecurse=True)
Exemple #5
0
    def neckCleanUp(self, jntArray, fkJnts, ikNeckBase, ikNeckEnd, hdlNeck,
                    crvNeck, grpHead, grpNeckFK, ctrlHead, *args):

        # Make the objects invisible
        mc.setAttr("{0}.v".format(ikNeckBase), False)
        mc.setAttr("{0}.v".format(ikNeckEnd), False)
        mc.setAttr("{0}.v".format(hdlNeck), False)
        mc.setAttr("{0}.v".format(crvNeck), False)
        # mc.setAttr("{0}.v".format(jntArray[0]), False)

        grpHeadDNT = "GRP_DO_NOT_TOUCH_head"
        mc.group(n=grpHeadDNT, w=True, em=True)
        parentFK = mc.listRelatives(jntArray[0], p=True)[0]
        mc.parent(grpHeadDNT, parentFK)
        mc.parent(jntArray[0], ikNeckBase, ikNeckEnd, hdlNeck, crvNeck,
                  grpHeadDNT)

        # hide scale on ctrlHead
        CRU.lockHideCtrls(ctrlHead, scale=True)

        # hide translate, scale, radius on FK Control
        CRU.lockHideCtrls(fkJnts[0], scale=True, translate=True)
        CRU.lockHideCtrls(fkJnts[0],
                          theVals=["radi"],
                          channelBox=False,
                          toLock=True,
                          attrVisible=False)

        CRU.lockHideCtrls(grpHead,
                          translate=True,
                          rotate=True,
                          scale=True,
                          visibility=True)
        CRU.lockHideCtrls(grpNeckFK,
                          translate=True,
                          rotate=True,
                          scale=True,
                          visibility=True)
        CRU.lockHideCtrls(ikNeckEnd,
                          translate=True,
                          rotate=True,
                          scale=True,
                          visibility=True)

        CRU.layerEdit(jntArray, bndLayer=True, noRecurse=True)

        altBnds = [x for x in jntArray if "end" in x.lower()]
        CRU.layerEdit(altBnds, bndAltLayer=True, noRecurse=True)
        return grpHeadDNT