Esempio n. 1
0
    def tippyToe(self):
        self.tippyToeGrp = pm.group(self.toeTapGrp, self.peelHeelGrp, n=self.prefixJnt2+'TippyToe_GRP')

        # move Toe Tap Group Pivot to Middle Ball
        index = int(round(len(self.toeIkHandleList)/2.0))-1
        midToeJnt = self.toeIkHandleList[index]
        common.centerPivot(self.tippyToeGrp, midToeJnt)
Esempio n. 2
0
def makeControlFollowSkin(geo, ctrl, drivenObj):
    geo = pm.ls(geo)[0]
    ctrl = pm.ls(ctrl)[0]
    drivenObj = pm.ls(drivenObj)[0]
    uv = findClosestUVCoordinate(geo, ctrl)
    prefix = name.removeSuffix(ctrl.name())
    follicle = createFollicle(geo, uv[0], uv[1], prefix)

    followGrp = pm.group(em=True, n=prefix + 'Follow_GRP', w=True)
    compensateGrp = pm.group(em=True, n=prefix + 'Compensate_GRP', w=True)

    common.centerPivot(compensateGrp, ctrl)
    common.centerPivot(followGrp, ctrl)

    pm.parent(compensateGrp, followGrp)
    pm.parent(followGrp, ctrl.getParent())
    pm.parent(ctrl, compensateGrp)

    # pm.pointConstraint(follicle, followGrp, mo=True)
    util.matrixConstrain(follicle, followGrp, rotate=False)

    multDivideNode = pm.createNode('multiplyDivide',
                                   n=prefix + 'CompensateNode')
    pm.connectAttr(ctrl.translate, multDivideNode.input1)
    pm.connectAttr(multDivideNode.output, compensateGrp.translate)
    multDivideNode.input2X.set(-1)
    multDivideNode.input2Y.set(-1)
    multDivideNode.input2Z.set(-1)

    ctrl.translate.set(0, 0, 0)
    pm.connectAttr(ctrl.translate, drivenObj.translate, f=True)

    return ctrl, follicle
Esempio n. 3
0
    def toeTap(self):
        self.toeTapGrp = pm.group(self.ballIkHandleList, self.toeIkHandleList, n=self.prefixJnt2+'ToeTap_GRP')

        # move Toe Tap Group Pivot to Middle Ball
        index = int(round(len(self.ballIkHandleList)/2.0))-1
        midBallJnt = self.ballIkHandleList[index]
        common.centerPivot(self.toeTapGrp, midBallJnt)
Esempio n. 4
0
    def peelHeel(self):
        self.peelHeelGrp = pm.group(self.ankleIkHandle, n=self.prefixJnt2+'PeelHeel_GRP')

        # move Peel Heel Group Pivot to Middle Ball
        index = int(round(len(self.ballIkHandleList)/2.0))-1
        midBallJnt = self.ballIkHandleList[index]
        common.centerPivot(self.peelHeelGrp, midBallJnt)
Esempio n. 5
0
    def moveGrp(self):
        if self.outerRollGrp:
            self.moveGrp = pm.group(self.outerRollGrp, n=self.prefixJnt2 + 'Move_GRP')
        else:
            self.moveGrp = pm.group(self.tippyToeGrp, n=self.prefixJnt2+'Move_GRP')

        common.centerPivot(self.moveGrp, self.ankleIkHandle)
Esempio n. 6
0
    def rollGroups(self, frontRollLoc, backRollLoc, innerRollLoc,
                   outerRollLoc):
        frontRollGrp, backRollGrp, innerRollGrp, outerRollGrp = [
            None, None, None, None
        ]
        if pm.objExists(frontRollLoc) and pm.objExists(
                backRollLoc) and pm.objExists(innerRollLoc) and pm.objExists(
                    outerRollLoc):
            frontLoc = pm.ls(frontRollLoc)[0]
            backLoc = pm.ls(backRollLoc)[0]
            innerLoc = pm.ls(innerRollLoc)[0]
            outerLoc = pm.ls(outerRollLoc)[0]

            frontRollGrp = pm.group(self.tippyToeGrp,
                                    n=name.removeSuffix(frontLoc) + '_GRP')
            backRollGrp = pm.group(frontRollGrp,
                                   n=name.removeSuffix(backLoc) + '_GRP')
            innerRollGrp = pm.group(backRollGrp,
                                    n=name.removeSuffix(innerLoc) + '_GRP')
            outerRollGrp = pm.group(innerRollGrp,
                                    n=name.removeSuffix(outerLoc) + '_GRP')

            common.centerPivot(frontRollGrp, frontLoc)
            common.centerPivot(backRollGrp, backLoc)
            common.centerPivot(innerRollGrp, innerLoc)
            common.centerPivot(outerRollGrp, outerLoc)

        return frontRollGrp, backRollGrp, innerRollGrp, outerRollGrp
Esempio n. 7
0
    def __init__(self, geo, doParentCnst=True, threshold=0.45):
        self.proxyGeoList = []
        pivotLocator = pm.spaceLocator(n='pivotGeo_LOC')
        # Create proxy geo Group
        self.shapeGrp = pm.group(n='fastGeo_GRP', em=True)

        # Get Shape and skin from Object
        skinCluster = skin.findRelatedSkinCluster(geo)
        if not skinCluster:
            print('Missing SkinCluster')
        else:
            self.skin = skinCluster

            # Get joint influence of the skin
            influnces = self.skin.getInfluence(q=True)  # influences is joint
            for joint in influnces:
                # duplicate mesh for a control
                transform, dupliShape = self.duplicateSourceMesh(obj=geo,
                                                                 joint=joint)
                common.centerPivot(transform, pivotLocator)

                # copy skinCluster
                skin.copyBind(pm.ls(geo)[0], transform)

                # delete faces in the new shape based on selected joint
                self.deleteVertex(joint=joint,
                                  newShape=dupliShape,
                                  threshold=threshold)

                # delete non deformer history
                common.deleteHistory(dupliShape)

                # parent under proxy group
                pm.parent(transform, self.shapeGrp)
                self.proxyGeoList.append(transform)

                # parentConstraint with joint
                if doParentCnst:
                    pm.parentConstraint(joint, transform, mo=True)

            # delete pivot locator
            pm.delete(pivotLocator)
Esempio n. 8
0
    def createIKFK(self, mainCtrlAttachObj, scale):
        # make Display
        ikfkCtrl = control.Control(prefix='ikfk',
                                   scale=scale,
                                   parent=self.rigCtrlGrp,
                                   translateTo=mainCtrlAttachObj,
                                   rotateTo=self.rigCtrlLoc,
                                   lockChannels=['t', 'r', 's'],
                                   shape='ikfk',
                                   doOffset=True,
                                   doModify=True,
                                   objBBox=mainCtrlAttachObj)

        if pm.objExists(mainCtrlAttachObj):
            # constraint displayCtrl
            common.centerPivot(ikfkCtrl.getOffsetGrp())
            common.centerPivot(ikfkCtrl.getControl())
            pm.parentConstraint(mainCtrlAttachObj,
                                ikfkCtrl.getOffsetGrp(),
                                mo=True)
            ikfkCtrl.getModifyGrp().translateY.set(3 * ikfkCtrl.getCtrlScale())

        return ikfkCtrl
Esempio n. 9
0
def ikfkCtrlShape(name='ikfk', normalDirection=[0, 1, 0], scale=1):
    ctrl = pm.circle(n=name, s=10, nr=[0, 0, 1])[0]
    pm.delete(ctrl.getShape())

    # create text and snap to displayCtrl group
    textGrp = pm.textCurves(t='IKFK', n=name)[0]
    common.centerPivot(textGrp)
    common.freezeTranform(textGrp)

    # parent al text shape under displayCTrl
    shapeList = pm.ls(textGrp, dag=True, leaf=True, type='nurbsCurve')
    pm.parent(shapeList, ctrl, r=1, s=1)
    pm.delete(textGrp)
    common.centerPivot(ctrl)

    # rotate shape
    for shape in shapeList:
        if normalDirection[0] == 1:
            pm.rotate(shape.cv[:], [90, 0, 0])
        elif normalDirection[0] == -1:
            pm.rotate(shape.cv[:], [-90, 0, 0])

        if normalDirection[1] == 1:
            pm.rotate(shape.cv[:], [0, 90, 0])
        elif normalDirection[1] == -1:
            pm.rotate(shape.cv[:], [0, -90, 0])

        if normalDirection[2] == 1:
            pm.rotate(shape.cv[:], [0, 0, 90])
        elif normalDirection[2] == -1:
            pm.rotate(shape.cv[:], [0, 0, -90])

    pm.scale(ctrl, [scale, scale, scale], r=True)
    common.centerPivot(ctrl)
    common.freezeTranform(ctrl)

    return ctrl