Exemple #1
0
    def setupTeeth(self):
        allCons = []
        conGrps = []
        ConObj = CreateControler(
            13, (0.1 * self.scale, 0.1 * self.scale, 0.1 * self.scale))
        ConObj.signValue = 54861
        for i, jnt in enumerate(self.jnts):
            jntMat = rig.getAttr(jnt + '.worldMatrix')
            con = ConObj.SK_b08(jnt.split('_')[0] + '_M')
            allCons.append(con)
            rig.xform(con, ro=(90, 0, 0), wd=True)
            rig.makeIdentity(apply=True, r=True)
            rig.xform(con, m=jntMat)

            conGrp = CA.addGrp().grp(con, 'Freeze')
            conGrps.append(conGrp)

            rig.parentConstraint(con, jnt, mo=True)
            rig.scaleConstraint(con, jnt, mo=True)

        self.Connect.connect(self.grp, allCons)  #连接控制器属性
        newGrp = rig.group(conGrps, n=self.grp + '_CTRLGrp')
        rig.parent(newGrp, self.grp)

        #连接visibility属性
        Connect = CA.connectAttribute()
        Connect.sourceAttr = 'conVis'
        Connect.targetAttr = 'visibility'
        Connect.connect(self.grp,
                        [rig.listRelatives(con, p=True)[0] for con in allCons])
Exemple #2
0
 def Groups(self):
     rig.parent(self.aimLoctorGrp, self.eye)
     
 
     #连接visibility属性
     Connect = CA.connectAttribute()
     Connect.sourceAttr = 'conVis'
     Connect.targetAttr = 'visibility'
     Connect.connect(self.eye, [rig.listRelatives(con, p = True)[0] for con in self.allCons])
Exemple #3
0
 def getData(self):
     self.jnts = [con for con in rig.listConnections(self.grp+'.CTRLJoint', s = False, d = True)]
     self.jnts =  CA.order().startOrder(self.jnts)#对数组进行排序
     self.scale = CA.distance().getScale(self.jnts[0], self.jnts[-1], 1.24976436649)
     
     self.Connect = CA.connectAttribute()
     self.Connect.attrType = 'long'
     self.Connect.sourceAttr = 'CTRLCurve'  
     self.Connect.targetAttr = 'CTRLCurve'        
Exemple #4
0
    def getData(self):
        self.jnts = [
            con for con in rig.listConnections(
                self.grp + '.CTRLJoint', s=False, d=True)
        ]
        self.scale = CA.distance().getScale(self.jnts[0], self.jnts[-1], 0.35)

        self.Connect = CA.connectAttribute()
        self.Connect.attrType = 'long'
        self.Connect.sourceAttr = 'CTRLCurve'
        self.Connect.targetAttr = 'CTRLCurve'
Exemple #5
0
    def linkVis(self):
        allCons = rig.listConnections(self.grp + '.CTRLCurve', s=False, d=True)
        frontGrp = []
        backGrp = []
        for con in allCons:
            grp = rig.listRelatives(con, p=True)[0]
            if re.match('\w+_Back_\d+M', con):
                backGrp.append(grp)
            else:
                frontGrp.append(grp)

        connectVisibility = CA.connectAttribute()
        connectVisibility.sourceAttr = 'smallVis'
        connectVisibility.connect(self.grp, frontGrp)
        connectVisibility.sourceAttr = 'smallBackVis'
        connectVisibility.connect(self.grp, backGrp)
Exemple #6
0
 def linkLimitAttr(self):
     attr4 = [u'+translateX', u'+translateY',u'-translateX', u'-translateY'] 
     attr6Cons = [u'Rt_Brow_M', u'Lf_Brow_M', u'Mouth_Tip_M',u'JawMain_M',u'Lf_Cheek_M', u'Rt_Cheek_M', u'Lf_CornerLip_M', u'Rt_CornerLip_M', u'Up_Lip_M', u'Dn_Lip_M']
     attr6 = [u'+translateX', u'+translateY', u'+translateZ',u'-translateX', u'-translateY', u'-translateZ'] 
     
     self.RotateToTranslate = {u'limitMaxrx':u'+translateX', u'limitMinx':u'-translateX', u'limitMaxry':u'+translateY', u'limitMinry':u'-translateY', u'limitMaxrz':u'+translateZ', u'limitMinrz':u'-translateZ',}
     self.TranslateToRotate = dict([(self.RotateToTranslate[attr], attr )for attr in self.RotateToTranslate])
     
     linkAttr = CA.connectAttribute()
     linkAttr.attrType = 'float'
     linkAttr.sourceAttr = 'CTRLBSRotate'
     linkAttr.targetAttr = 'CTRLBSRotate'
     
     subCon = [u'Nose_M']
     cons = [con for con in self.CTRLBsCurves if not(con in subCon)]
     for con in cons:
         rotateLimit = rig.listAttr(con,ud = True, k = True)
         if rotateLimit:
             
             attrs = []
             print con+'------------>'
             matCon = rig.getAttr(con+'.worldMatrix')
             conGrp = rig.group(empty = True, n = con+'_Rotation')
             linkAttr.connect(self.grp, [conGrp])#连接属性
             rig.xform(conGrp, m = matCon)
             rig.parent(conGrp, con)
             
             for rl in rotateLimit:#迭代旋转属性
                 attrs.append(self.RotateToTranslate[rl])
                 grpAttr = conGrp+'.t'+rl[-1]
                 if not rig.connectionInfo(grpAttr, isDestination=True):
                     rig.connectAttr(con+'.'+rl[-2::], grpAttr, f = True)
                     
             self.rampAndLimit(conGrp, attrs) 
             
             
             
         if con in attr6Cons:
             self.rampAndLimit(con, attr6)
         else:
             self.rampAndLimit(con, attr4)
Exemple #7
0
 def linkVis(self):
     connectVisibility = CA.connectAttribute()
     connectVisibility.sourceAttr = 'mainVis'
     connectVisibility.connect(self.grp,[rig.listRelatives(grp, p = True)[0] for grp in self.CTRLBsCurves])
     connectVisibility.sourceAttr = 'macroVis'
     connectVisibility.connect(self.grp,[rig.listRelatives(grp, p = True)[0] for grp in self.CTRLMacroCurves])