Esempio n. 1
0
    def constrain_baseSystem(self, offset):
        if offset:
            aimJoint = self.aimAtOffset
        else:
            aimJoint = self.aimAt

        #constrain end joint
        constraint.Constraint(driven=self.endJnt,
                              drivers=aimJoint,
                              maintainPosition=False,
                              maintainOffset=False,
                              orient=False,
                              scale=False,
                              closed=False)

        #constrain twist
        constraint.Constraint(driven=self.twistJnt,
                              drivers=[self.startJnt, aimJoint],
                              maintainPosition=False,
                              maintainOffset=False,
                              orient=False,
                              scale=False,
                              closed=False)

        constraint.Constraint(driven=self.twistJnt,
                              drivers=[self.startJnt, aimJoint],
                              maintainPosition=False,
                              maintainOffset=False,
                              point=False,
                              scale=False,
                              closed=False,
                              skip=['y', 'z'])

        #put aim constraint on startJnt
        constraint.Constraint(driven=self.startJnt,
                              drivers=aimJoint,
                              maintainPosition=False,
                              maintainOffset=False,
                              point=False,
                              orient=False,
                              scale=False,
                              aim=True,
                              closed=False)

        if offset:
            #constrain aim offset
            constraint.Constraint(
                driven=self.aimAtOffset,
                drivers=self.aimAt,
                maintainPosition=False,
                maintainOffset=False,
                orient=False,
                scale=False,
                closed=False,
                skip='y',
            )
    def constrain_system(self):
        if self.TipName.side == 'Rt':
            self.aim.translateX.set(-.001)
            if self.baseJoint == self.aimLocation:
                aimValue = 1
            else:
                aimValue = -1
        if self.TipName.side == 'Lf':
            self.aim.translateX.set(.001)
            if self.baseJoint == self.aimLocation:
                aimValue = -1
            else:
                aimValue = 1

        ptCon = constraint.Constraint(driven=self.twist,
                                      drivers=[self.aimAt, self.aim],
                                      maintainPosition=False,
                                      orient=False,
                                      scale=False,
                                      lockWeights=False,
                                      closed=False)
        ptCon.pointConstraint.addTag('twistSystem')
        oriCon = constraint.Constraint(driven=self.twist,
                                       drivers=[self.aimAt, self.aim],
                                       maintainPosition=False,
                                       point=False,
                                       scale=False,
                                       skip=['y', 'z'],
                                       lockWeights=False,
                                       closed=False)
        oriCon.pointConstraint.addTag('twistSystem')
        aimCon = constraint.Constraint(driven=self.aim,
                                       drivers=self.aimAt,
                                       maintainPosition=False,
                                       point=False,
                                       orient=False,
                                       scale=False,
                                       aim=True,
                                       offset=(0, 0, 0),
                                       weight=1,
                                       aimVector=(aimValue, 0, 0),
                                       upVector=(0, 1, 0),
                                       worldUpType='none',
                                       lockWeights=False,
                                       closed=False)
        aimCon.addTag('twistSystem')
Esempio n. 3
0
    def constrain_system(self):
        aim = 1
        if self.TipName.side == "Rt":
            aim = -1

        constraint.Constraint(driven=self.grpHalf,
                              drivers=[self.targetNul, self.grpAim],
                              maintainPosition=False,
                              orient=False,
                              scale=False)
        constraint.Constraint(driven=self.grpAim,
                              drivers=self.targetNul,
                              maintainPosition=False,
                              point=False,
                              orient=False,
                              scale=False,
                              aim=True,
                              offset=(0, 0, 0),
                              weight=1,
                              aimVector=(aim, 0, 0),
                              upVector=(0, 1, 0),
                              worldUpType='none')
Esempio n. 4
0
    def constrain_planarSystem(self):
        #constrain start joint con
        constraint.Constraint(driven=self.startJnt.getParent(),
                              drivers=self.planarOffset,
                              maintainPosition=False,
                              maintainOffset=False,
                              point=False,
                              orient=False,
                              scale=False,
                              parent=True,
                              closed=False)

        #constrain planar offset
        constraint.Constraint(
            driven=self.planarOffset,
            drivers=self.planar,
            maintainPosition=False,
            maintainOffset=False,
            orient=False,
            scale=False,
            closed=False,
            skip='y',
        )
Esempio n. 5
0
 def constraintSystem(self):
     #constrain drivers
     if self.eyeArea == 'eye' or self.eyeArea == 'membrane':
         constraint.Constraint(driven=self.horizontalDriver,
                           drivers=self.driver,
                           maintainPosition=False,
                           point=False,
                           orient=True,
                           scale=False,
                           lockWeights=False,
                           closed=False)
         constraint.Constraint(driven=self.verticalDriver,
                           drivers=self.driver,
                           maintainPosition=False,
                           point=False,
                           orient=True,
                           scale=False,
                           lockWeights=False,
                           closed=False)
     else:
         constraint.Constraint(driven=self.horizontalDriver,
                               drivers=self.endJoint,
                               maintainPosition=False,
                               point=True,
                               orient=False,
                               scale=False,
                               lockWeights=False,
                               closed=False)
         constraint.Constraint(driven=self.verticalDriver,
                               drivers=self.endJoint,
                               maintainPosition=False,
                               point=True,
                               orient=False,
                               scale=False,
                               lockWeights=False,
                               closed=False)
Esempio n. 6
0
    def constrainSys(self):
        #point constrain twist
        constraint.Constraint(driven=self.twist,
                              drivers=[self.neck, self.tip],
                              node=self.twist,
                              point=True,
                              orient=False,
                              scale=False,
                              maintainPosition=False,
                              lockWeights=False,
                              closed=False,
                              maintainOffset=False)

        #orient x of twist
        constraint.Constraint(driven=self.twist,
                              drivers=[self.neck, self.trans],
                              node=self.twist,
                              point=False,
                              orient=True,
                              scale=False,
                              maintainPosition=False,
                              lockWeights=False,
                              closed=False,
                              skip=['y', 'z'])
Esempio n. 7
0
                startJoint=meta,
                endJoint=endJoint,
                name=meta,
                scale=True,
                planar=False,
                offset=False)

            muscleSystem.startJnt.getParent().setParent(self.rootJoint)
            muscleSystem.aimAt.getParent().setParent(self.digitTopJnts[i])

        for i, jnt in enumerate(self.digitTopJnts):
            constraint.Constraint(driven=jnt.getParent(),
                                  drivers=self.metaTopJnts[i],
                                  point=True,
                                  orient=False,
                                  scale=False,
                                  maintainPosition=False,
                                  maintainOffset=True,
                                  skip='y',
                                  lockWeights=False)

        if controls:
            self.create_controls()

    def create_controls(self):

        pm.select(self.rootJoint)
        self.ctrlGrp = pm.joint()
        self.ctrlGrp.renameNode(name=self.TipName,
                                base='%sDigitControl',
                                descriptor='group',
Esempio n. 8
0
    def constrain_lipJnts(self):
        #constrain system
        #ori and aim for follow rig

        self.oriUpper = constraint.Constraint(
            driven=self.headUpperWeight,
            drivers=[self.jaw, self.lipFollowRig],
            maintainPosition=False,
            point=False,
            scale=False,
            lockWeights=False,
            closed=False,
            maintainOffset=True)

        self.oriLower = constraint.Constraint(
            driven=self.headLowerWeight,
            drivers=[self.jaw, self.lipFollowRig],
            maintainPosition=False,
            point=False,
            scale=False,
            lockWeights=False,
            closed=False,
            maintainOffset=True)

        #aims
        self.aimUpper = constraint.Constraint(driven=self.lowerLipFollow,
                                              drivers=self.headUpperLipAIM,
                                              maintainPosition=False,
                                              point=False,
                                              orient=False,
                                              scale=False,
                                              aim=True,
                                              lockWeights=False,
                                              closed=False,
                                              offset=(0, 0, 0),
                                              aimVector=(0, 0, 1),
                                              upVector=(0, 0, 1))

        self.aimLower = constraint.Constraint(
            driven=self.upperLipFollow,
            drivers=[self.headUpperLipAIM, self.headLowerLipAIM],
            maintainPosition=False,
            point=False,
            orient=False,
            scale=False,
            aim=True,
            lockWeights=False,
            closed=False,
            offset=(0, 0, 0),
            aimVector=(0, 0, 1),
            upVector=(0, 0, 1))

        #constrain for no follow rig
        self.parentUpper = constraint.Constraint(
            driven=self.upperLipAim,
            drivers=self.upperLipFollowHead,
            maintainPosition=False,
            point=False,
            orient=False,
            scale=False,
            parent=True,
            lockWeights=False,
            closed=False,
            maintainOffset=True)

        self.parentLower = constraint.Constraint(
            driven=self.lowerLipAim,
            drivers=self.lowerLipFollowJaw,
            maintainPosition=False,
            point=False,
            orient=False,
            scale=False,
            parent=True,
            lockWeights=False,
            closed=False,
            maintainOffset=True)

        #constrain lip side skin joint system
        constraint.Constraint(driven=self.lowerLipJawOpenOffset,
                              drivers=self.headLowerLip,
                              maintainPosition=False,
                              point=False,
                              orient=False,
                              scale=False,
                              parent=True,
                              lockWeights=False,
                              closed=False,
                              maintainOffset=True)

        for driven in [self.lowerLipLf, self.lowerLipRt]:
            constraint.Constraint(driven=driven,
                                  drivers=self.headLowerLip,
                                  maintainPosition=False,
                                  point=False,
                                  orient=False,
                                  scale=False,
                                  parent=True,
                                  lockWeights=False,
                                  closed=False,
                                  maintainOffset=True)

        for driven in [self.upperLipLf, self.upperLipRt]:
            constraint.Constraint(driven=driven,
                                  drivers=self.headUpperLip,
                                  maintainPosition=False,
                                  point=False,
                                  orient=False,
                                  scale=False,
                                  parent=True,
                                  lockWeights=False,
                                  closed=False,
                                  maintainOffset=True)

        #constrain top nodes for follow switch
        self.constraintList = list()
        for driven in [
                self.upperLipLf.getParent().getParent(),
                self.upperLipRt.getParent().getParent()
        ]:
            self.constraintList.append(
                constraint.Constraint(driven=driven,
                                      drivers=self.upperLipFollowHead,
                                      maintainPosition=False,
                                      point=False,
                                      orient=False,
                                      scale=False,
                                      parent=True,
                                      lockWeights=False,
                                      closed=False,
                                      maintainOffset=True))

        for driven in [
                self.lowerLipLf.getParent().getParent(),
                self.lowerLipRt.getParent().getParent()
        ]:
            self.constraintList.append(
                constraint.Constraint(driven=driven,
                                      drivers=self.lowerLipFollowJaw,
                                      maintainPosition=False,
                                      point=False,
                                      orient=False,
                                      scale=False,
                                      parent=True,
                                      lockWeights=False,
                                      closed=False,
                                      maintainOffset=True))