Exemplo n.º 1
0
 def create(self, inits, grp, colorIndex ):
     parentTarget = grp
     self.ctls = []
     for init in inits:
         ctl = rigbase.Controler( n=init.replace( 'Init', 'CTL' ) )
         rigbase.AttrEdit( ctl ).lockAndHideAttrs( 'sx', 'sy', 'sz', 'v' )
         rigbase.connectSameAttr( init, ctl.transformGrp ).doIt( 't', 'r' )
         ctl.setShape( typ='box', size=[.1,.1,.1] )
         ctl.setColor( colorIndex )
         ctl.setParent( parentTarget )
         parentTarget = ctl
         self.ctls.append( ctl )
Exemplo n.º 2
0
 def create(self, inits, grp, colorIndex):
     parentTarget = grp
     self.ctls = []
     for init in inits:
         ctl = rigbase.Controler(n=init.replace('Init', 'CTL'))
         rigbase.AttrEdit(ctl).lockAndHideAttrs('sx', 'sy', 'sz', 'v')
         rigbase.connectSameAttr(init, ctl.transformGrp).doIt('t', 'r')
         ctl.setShape(typ='box', size=[.1, .1, .1])
         ctl.setColor(colorIndex)
         ctl.setParent(parentTarget)
         parentTarget = ctl
         self.ctls.append(ctl)
Exemplo n.º 3
0
    def doIt(self):
        self.torsoPart = TorsoInitCtlRig(initCtlNameList)
        self.headPart = HeadInitCtlRig(initCtlNameList)
        self.armPart = ArmInitCtlRig(initCtlNameList)
        self.legPart = LegInitCtlRig(initCtlNameList)
        self.fingerPart = FingerInitCtlRig(initCtlNameList)

        self.torsoPart.rigAll()
        self.headPart.rigAll()
        self.armPart.rigAll()
        self.legPart.rigAll()
        self.fingerPart.rigAll()

        self.initAllCtl = cmds.circle(normal=[0, 1, 0],
                                      radius=7,
                                      n='All_InitCTL')[0]
        cmds.setAttr(self.initAllCtl + '.dh', 1)
        rigbase.addParent(self.initAllCtl)
        rigbase.connectSameAttr(self.initAllCtl,
                                self.initJntsGrp).doIt('t', 'r')

        for initCtlName in initCtlNameList:
            if not cmds.listRelatives(initCtlName, p=1):
                cmds.parent(initCtlName, self.initAllCtl)

        self.initJointSet()
        cmds.parent(self.torsoInitJnts[0], self.initJntsGrp)
        rigbase.transformSetColor(self.torsoInitJnts[0], 22)

        cmds.select(self.torsoInitJnts[0], hi=1)
        for sel in cmds.ls(sl=1):
            cmds.setAttr(sel + '.radius', 0)

        cmds.select(self.initAllCtl)

        INIT = cmds.group(em=1, n='INIT')
        cmds.parent('All_InitJnt', 'All_InitCTL_GRP', INIT)

        self.rObj = cmds.createNode('multDoubleLinear',
                                    n='RightClickObj_Inits')
        attrEdit = rigbase.AttrEdit(self.rObj)
        attrEdit.addAttr(ln='originalName', dt='string')
        cmds.setAttr(self.rObj + '.originalName', self.rObj, type='string')

        for initCtl in cmds.ls('*_InitCTL'):
            attrEdit.addAttr(ln=initCtl, at='message')
            cmds.connectAttr(initCtl + '.message', self.rObj + '.' + initCtl)

        rigbase.AttrEdit('All_InitCTL').addAttr(ln=self.rObj, at='message')
        cmds.connectAttr(self.rObj + '.message', 'All_InitCTL.' + self.rObj)
Exemplo n.º 4
0
 def __init__(self, rigInstance ):
     self.rigInstance = rigInstance
     
     rigbase.ctlAllScale = reduce( (lambda x,y: x+y), [ s/3 for s in cmds.getAttr( 'All_InitCTL.s' )[0] ] )
     
     self.initAll = cmds.createNode( 'transform', n='All_Init' )
     
     self.rootInit = rigbase.hierarchyCopyConnections( self.rigInstance.torsoInitJnts[0], replaceTarget = '_InitJnt', replace = '_Init' )
     
     cmds.parent( self.rootInit, self.initAll )
     
     rigbase.connectSameAttr( self.rigInstance.initJntsGrp, self.initAll ).doIt( 't', 'r' )
     
     self.rigInstance.rootInit = self.rootInit
     self.rigInstance.initAll = self.initAll
Exemplo n.º 5
0
    def create(self, inits, ctls, aimObjs, parentTarget):
        cmds.select(parentTarget)

        jnts = []
        for init in inits:
            jnt = cmds.joint(n=init.replace('Init', 'RJT'), radius=.5)
            jnts.append(jnt)

        rigbase.connectSameAttr(inits[-1], jnt).doIt('t', 'r')

        for i in range(len(aimObjs)):
            aimObj = aimObjs[i]
            jnt = jnts[i]
            rigbase.constraint(aimObj, jnt)

        rigbase.constraint(ctls[-1], jnts[-2])
Exemplo n.º 6
0
 def create(self, inits, ctls, aimObjs, parentTarget ):
     cmds.select( parentTarget )
     
     jnts = []
     for init in inits:
         jnt = cmds.joint( n=init.replace( 'Init', 'RJT' ), radius=.5 )
         jnts.append( jnt )
         
     rigbase.connectSameAttr( inits[-1], jnt ).doIt( 't', 'r' )
     
     for i in range( len( aimObjs ) ):
         aimObj = aimObjs[i]
         jnt = jnts[i]
         rigbase.constraint( aimObj, jnt )
         
     rigbase.constraint( ctls[-1], jnts[-2] )
Exemplo n.º 7
0
 def doIt(self):
     self.torsoPart = TorsoInitCtlRig( initCtlNameList )
     self.headPart = HeadInitCtlRig( initCtlNameList )
     self.armPart = ArmInitCtlRig( initCtlNameList )
     self.legPart = LegInitCtlRig( initCtlNameList )
     self.fingerPart = FingerInitCtlRig( initCtlNameList )
     
     self.torsoPart.rigAll()
     self.headPart.rigAll()
     self.armPart.rigAll()
     self.legPart.rigAll()
     self.fingerPart.rigAll()
     
     
     self.initAllCtl = cmds.circle( normal=[0,1,0], radius = 7, n='All_InitCTL' )[0]
     cmds.setAttr( self.initAllCtl+'.dh', 1 )
     rigbase.addParent( self.initAllCtl )
     rigbase.connectSameAttr( self.initAllCtl, self.initJntsGrp ).doIt( 't', 'r' )
     
     for initCtlName in initCtlNameList:
         if not cmds.listRelatives( initCtlName, p=1 ):
             cmds.parent( initCtlName, self.initAllCtl )
             
     self.initJointSet()
     cmds.parent( self.torsoInitJnts[0], self.initJntsGrp )
     rigbase.transformSetColor( self.torsoInitJnts[0], 22 )
     
     cmds.select( self.torsoInitJnts[0], hi=1 )
     for sel in cmds.ls( sl=1 ):
         cmds.setAttr( sel+'.radius', 0 )
     
     cmds.select( self.initAllCtl )
     
     INIT = cmds.group( em=1, n='INIT' )
     cmds.parent( 'All_InitJnt', 'All_InitCTL_GRP', INIT )
     
     self.rObj = cmds.createNode( 'multDoubleLinear', n='RightClickObj_Inits' )
     attrEdit = rigbase.AttrEdit( self.rObj )
     attrEdit.addAttr( ln='originalName', dt='string' )
     cmds.setAttr( self.rObj+'.originalName', self.rObj, type='string' )
     
     for initCtl in cmds.ls( '*_InitCTL' ):
         attrEdit.addAttr( ln=initCtl, at='message' )
         cmds.connectAttr( initCtl+'.message', self.rObj+'.'+initCtl )
     
     rigbase.AttrEdit( 'All_InitCTL' ).addAttr( ln=self.rObj, at='message' )
     cmds.connectAttr( self.rObj+'.message', 'All_InitCTL.'+self.rObj )    
Exemplo n.º 8
0
    def mocSet(self):
        allMoc = cmds.spaceLocator(n=self.allInit.replace('_Init', '_Moc'))[0]
        rigbase.setColor(allMoc, 27)

        rigbase.connectSameAttr(self.allInit, allMoc).doIt('t', 'r', 's')

        self.allMoc = allMoc

        rootInit = cmds.listRelatives(self.allInit, c=1)[0]

        rootMoc = rigbase.hierarchyCopyConnections(rootInit,
                                                   typ='joint',
                                                   replaceTarget='_Init',
                                                   replace='_MOC',
                                                   t=1,
                                                   r=1,
                                                   s=0)
        cmds.parent(rootMoc, self.allMoc)

        cmds.delete(self.namespace + 'Heel_*_MOC',
                    self.namespace + '*PoleV_*_MOC',
                    self.namespace + 'EyeAimPiv_MOC',
                    self.namespace + 'Upper*_*_MOC_GRP',
                    self.namespace + 'Lower*_*_MOC_GRP')

        allMocChildren = cmds.listRelatives(self.allMoc,
                                            c=1,
                                            ad=1,
                                            type='transform')
        allMocChildren.append(self.allMoc)

        for moc in allMocChildren:
            cons = cmds.listConnections(moc, s=1, d=0, c=1, p=1)

            outputs = cons[1::2]
            inputs = cons[::2]

            for i in range(len(outputs)):
                cmds.disconnectAttr(outputs[i], inputs[i])

        cmds.makeIdentity(self.allMoc, t=0, r=1, s=0, n=0, apply=1)

        self.rootMoc = rootMoc
        self.allMoc = allMoc
Exemplo n.º 9
0
 def connectInit(self, inits ):
     rigbase.connectSameAttr( inits[0], self.neckCtl.transformGrp ).doIt( 't', 'r' )
     neckMiddleMtxDcmp = self.getMtxDcmpInNeckSet()
     cmds.connectAttr( neckMiddleMtxDcmp+'.ot', self.neckMiddleCtl.transformGrp+'.t' )
     cmds.connectAttr( neckMiddleMtxDcmp+'.or', self.neckMiddleCtl.transformGrp+'.r' )
     headPosMtxDcmp = rigbase.getChildMtxDcmp( inits[2], inits[0] )
     cmds.connectAttr( headPosMtxDcmp+'.ot', self.headCtl.transformGrp+'.t' )
     cmds.connectAttr( headPosMtxDcmp+'.or', self.headCtl.transformGrp+'.r' )
     
     eyeCenterMtx = cmds.createNode( 'blendTwoMatrixDecompose', n='EyeCenterMtx' )
     eyeLMtxDcmp =  cmds.createNode( 'multMatrixDecompose', n='Eye_L_MtxDcmp' )
     eyeRMtxDcmp =  cmds.createNode( 'multMatrixDecompose', n='Eye_R_MtxDcmp' )
     
     eyeCenterObj = rigbase.Transform( n='EyeCenterObj' )
     eyeCenterObj.setParent( self.headCtl )
     
     eyeLInitTarget = rigbase.Transform( n='Eye_L_InitTarget' )
     eyeRInitTarget = rigbase.Transform( n='Eye_R_InitTarget' )
     eyeLInitTarget.setParent( self.headCtl )
     eyeRInitTarget.setParent( self.headCtl )
     rigbase.connectSameAttr( inits[3], eyeLInitTarget.name ).doIt( 't', 'r' )
     rigbase.connectSameAttr( inits[4], eyeRInitTarget.name ).doIt( 't', 'r' )
     
     cmds.connectAttr( eyeLInitTarget+'.m', eyeCenterMtx+'.inMatrix1' )
     cmds.connectAttr( eyeRInitTarget+'.m', eyeCenterMtx+'.inMatrix2' )
     cmds.connectAttr( eyeCenterMtx+'.ot', eyeCenterObj+'.t' )
     
     cmds.connectAttr( eyeLInitTarget+'.wm', eyeLMtxDcmp+'.i[0]' )
     cmds.connectAttr( eyeRInitTarget+'.wm', eyeRMtxDcmp+'.i[0]' )
     cmds.connectAttr( eyeCenterObj+'.wim', eyeLMtxDcmp+'.i[1]' )
     cmds.connectAttr( eyeCenterObj+'.wim', eyeRMtxDcmp+'.i[1]' )
     
     cmds.connectAttr( eyeLMtxDcmp+'.ot', self.eyeLCtl.transformGrp+'.t' )
     cmds.connectAttr( eyeRMtxDcmp+'.ot', self.eyeRCtl.transformGrp+'.t' )
     cmds.connectAttr( inits[-1]+'.t', self.eyeCtl.transformGrp+'.t' )
Exemplo n.º 10
0
 def connect( self, sels, *args ):
     worldCtl = None
     bjtWorld = None
     for sel in sels:
         if sel.find( 'BJT_World' ) != -1:
             bjtWorld = sel
         elif sel.find( 'World_CTL' ) != -1:
             worldCtl = sel
             
     if not bjtWorld or not worldCtl:
         return None
         
     bjtWorldGrp, bjtWorld, rootBjtGrp = self.getInputsGrp( bjtWorld )
     worldCtlGrp, worldCtl, rootGrp = self.getOutputsGrp( worldCtl )
     
     bjtNamespace = self.getNamespace( bjtWorld )
     rjtNamespace = self.getNamespace( worldCtl )
     
     rigbase.connectSameAttr( worldCtlGrp, bjtWorldGrp ).doIt( 't', 'r','s' )
     rigbase.connectSameAttr( worldCtl, bjtWorld  ).doIt( 't', 'r','s' )
     #cmds.connectAttr( worldCtl+'.message', bjtWorld+'.World_CTL' )
     rigbase.connectSameAttr( rootGrp, rootBjtGrp ).doIt( 't', 'r' )
     
     bjts = self.getBjts( bjtWorld )
     
     
     try:
         attrEdit = rigbase.AttrEdit( worldCtl )
         attrEdit.addAttr( ln=bjtNamespace.replace( ':', '' ), at='long', cb=1, min=0, max=1 )
     except: pass
     try:
         bjtWorldShape = cmds.listRelatives( bjtWorld, s=1 )[0]
         cmds.connectAttr( worldCtl+'.'+bjtNamespace.replace( ':', '' ), bjtWorldShape+'.v' )
     except: pass
     
     for bjt in bjts:
         rjt = bjt.replace( '_BJT', '_RJT' )
         if not bjtNamespace:
             rjt = rjtNamespace + rjt
         else:
             rjt = rjt.replace( bjtNamespace, rjtNamespace )
         
         if not cmds.objExists( rjt ):continue
         
         cmds.connectAttr( rjt+'.t', bjt+'.t' )
         cmds.connectAttr( rjt+'.r', bjt+'.r' )
         cmds.connectAttr( rjt+'.s', bjt+'.s' )
         if rjt.find( 'Leg_L_Lower4' ) != -1 or rjt.find( 'Leg_R_Lower4' ) != -1:
             cmds.connectAttr( rjt+'.sh', bjt+'.sh' )
             
         try:
             cmds.connectAttr( rjt+'.jo', bjt+'.jo' )
         except: pass
         
         try:
             cmds.setAttr( bjt+'.jo', 0,0,0 )
         except: pass
         
         if cmds.attributeQuery( 'parameter', node=bjt, ex=1 ):
             cmds.connectAttr( bjt+'.parameter', rjt+'.parameter', f=1 )
Exemplo n.º 11
0
    def connectInit(self, inits):
        rigbase.connectSameAttr(inits[0],
                                self.neckCtl.transformGrp).doIt('t', 'r')
        neckMiddleMtxDcmp = self.getMtxDcmpInNeckSet()
        cmds.connectAttr(neckMiddleMtxDcmp + '.ot',
                         self.neckMiddleCtl.transformGrp + '.t')
        cmds.connectAttr(neckMiddleMtxDcmp + '.or',
                         self.neckMiddleCtl.transformGrp + '.r')
        headPosMtxDcmp = rigbase.getChildMtxDcmp(inits[2], inits[0])
        cmds.connectAttr(headPosMtxDcmp + '.ot',
                         self.headCtl.transformGrp + '.t')
        cmds.connectAttr(headPosMtxDcmp + '.or',
                         self.headCtl.transformGrp + '.r')

        eyeCenterMtx = cmds.createNode('blendTwoMatrixDecompose',
                                       n='EyeCenterMtx')
        eyeLMtxDcmp = cmds.createNode('multMatrixDecompose', n='Eye_L_MtxDcmp')
        eyeRMtxDcmp = cmds.createNode('multMatrixDecompose', n='Eye_R_MtxDcmp')

        eyeCenterObj = rigbase.Transform(n='EyeCenterObj')
        eyeCenterObj.setParent(self.headCtl)

        eyeLInitTarget = rigbase.Transform(n='Eye_L_InitTarget')
        eyeRInitTarget = rigbase.Transform(n='Eye_R_InitTarget')
        eyeLInitTarget.setParent(self.headCtl)
        eyeRInitTarget.setParent(self.headCtl)
        rigbase.connectSameAttr(inits[3], eyeLInitTarget.name).doIt('t', 'r')
        rigbase.connectSameAttr(inits[4], eyeRInitTarget.name).doIt('t', 'r')

        cmds.connectAttr(eyeLInitTarget + '.m', eyeCenterMtx + '.inMatrix1')
        cmds.connectAttr(eyeRInitTarget + '.m', eyeCenterMtx + '.inMatrix2')
        cmds.connectAttr(eyeCenterMtx + '.ot', eyeCenterObj + '.t')

        cmds.connectAttr(eyeLInitTarget + '.wm', eyeLMtxDcmp + '.i[0]')
        cmds.connectAttr(eyeRInitTarget + '.wm', eyeRMtxDcmp + '.i[0]')
        cmds.connectAttr(eyeCenterObj + '.wim', eyeLMtxDcmp + '.i[1]')
        cmds.connectAttr(eyeCenterObj + '.wim', eyeRMtxDcmp + '.i[1]')

        cmds.connectAttr(eyeLMtxDcmp + '.ot', self.eyeLCtl.transformGrp + '.t')
        cmds.connectAttr(eyeRMtxDcmp + '.ot', self.eyeRCtl.transformGrp + '.t')
        cmds.connectAttr(inits[-1] + '.t', self.eyeCtl.transformGrp + '.t')
Exemplo n.º 12
0
 def controlSet(self):
     self.rootCtl, self.rootCtlGrp = rigbase.putControler( self.rootInit, n= self.rootInit.replace( 'Init', 'CTL' ), typ='box', size=[2.5,.1,2.2] )
     self.flyCtl, self.flyCtlGrp = rigbase.putControler( self.rootCtl, n=self.rootCtl.replace( 'Root', 'Fly' ), typ='fly', size=[1.2,1,1.8], orient=[90,0,0], offset=[0,0.2,-2.6] )
     self.hipCtl , self.hipCtlGrp = rigbase.putControler( self.rootCtl,  n= self.rootCtl.replace( 'Root', 'Hip' ), typ='quadrangle', size=[1.5,1.5,1.5], orient=[0,45,0] )
     self.torsoCtl , self.torsoCtlGrp = rigbase.putControler( self.rootCtl,  n= self.rootCtl.replace( 'Root', 'TorsoRotate' ), typ='bar', size=[1.5,.7,.7], orient=[90,0,0] )
     self.waistCtl, self.waistCtlGrp = rigbase.putControler( self.waistInit, n= self.waistInit.replace( 'Init', 'CTL' ), normal=[0,1,0], r=1.5 )
     self.chestCtl, self.chestCtlGrp = rigbase.putControler( self.chestInit, n= self.chestInit.replace( 'Init', 'CTL' ), typ='box', size=[1.5,.3,1.5] )
     self.chestMoveCtl, self.chestMoveCtlGrp = rigbase.putControler( self.chestInit, n= self.chestCtl.replace( 'Chest_CTL', 'ChestMove_CTL' ), normal=[0,0,1], center=[0,0,2.5], r=.5 )
     self.collarLCtl, self.collarLCtlGrp = rigbase.putControler( self.collarLInit, n=self.collarLInit.replace( 'Init', 'CTL' ), normal=[1,0,0], r=1 )
     self.collarRCtl, self.collarRCtlGrp = rigbase.putControler( self.collarRInit, n=self.collarRInit.replace( 'Init', 'CTL' ), normal=[1,0,0], r=1 )
     self.shoulderLCtl, self.shoulderLCtlGrp = rigbase.putControler( self.shoulderLInit, n=self.shoulderLInit.replace( 'Init', 'CTL' ), typ='pin', orient=[0,0,-30], size=[.6,.6,.6] )
     self.shoulderRCtl, self.shoulderRCtlGrp = rigbase.putControler( self.shoulderRInit, n=self.shoulderRInit.replace( 'Init', 'CTL' ), typ='pin', orient=[0,0,-30], size=[-.6,-.6,-.6] )
     
     self.rootGrp = cmds.createNode( 'transform', n='Root_GRP' )
     rigbase.constraint( self.rootCtl, self.rootGrp, s=1, sh=1 )
     torsoGrp = cmds.createNode( 'transform', n= 'torso_GRP' )
     #waistCtlPointObj = cmds.createNode( 'transform', n=self.waistInit.replace( 'Init', 'CtlPoint' ) )
     
     rigbase.AttrEdit( torsoGrp, self.torsoCtl ).lockAndHideAttrs( 'tx', 'ty','tz', 'sx', 'sy','sz', 'v' )
     rigbase.AttrEdit( self.flyCtl, self.rootCtl, self.hipCtl, self.waistCtl, self.chestCtl, self.chestMoveCtl, self.collarLCtl, self.collarRCtl ).lockAndHideAttrs( 'sx', 'sy','sz','v' )
     rigbase.AttrEdit( self.shoulderLCtl, self.shoulderRCtl ).lockAndHideAttrs( 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'v' )
     
     cmds.parent( self.shoulderLCtlGrp, self.collarLCtl )
     cmds.parent( self.shoulderRCtlGrp, self.collarRCtl )
     cmds.parent( self.collarLCtlGrp , self.collarRCtlGrp, self.chestMoveCtl )
     cmds.parent( self.chestMoveCtlGrp, self.chestCtl )
     cmds.parent( self.chestCtlGrp, self.torsoCtl )
     cmds.parent(  self.waistCtlGrp, torsoGrp )
     cmds.parent( torsoGrp, self.torsoCtlGrp, self.hipCtlGrp, self.rootGrp )
     
     cmds.setAttr( self.shoulderLCtlGrp+'.r', 0,0,0 )
     cmds.setAttr( self.shoulderRCtlGrp+'.r', 0,0,0 )
     
     rigbase.connectSameAttr( self.rootInit, self.flyCtlGrp ).doIt( 't', 'r' )
     rigbase.connectSameAttr( self.torsoCtl, torsoGrp ).doIt( 'r' )
     #rigbase.connectSameAttr( self.waistInit, waistCtlPointObj ).doIt( 't' )
     #rigbase.connectSameAttr( self.waistInit, self.waistCtlGrp ).doIt( 't', 'r' )
     #rigbase.connectSameAttr( self.chestInit, self.chestCtlGrp ).doIt( 't', 'r' )
     rigbase.connectSameAttr( self.collarLInit, self.collarLCtlGrp ).doIt( 't', 'r' )
     rigbase.connectSameAttr( self.collarRInit, self.collarRCtlGrp ).doIt( 't', 'r' )
     rigbase.connectSameAttr( self.shoulderLInit, self.shoulderLCtlGrp ).doIt( 't' )
     rigbase.connectSameAttr( self.shoulderRInit, self.shoulderRCtlGrp ).doIt( 't' )
     
     #rigbase.constraint( self.waistCtl, waistCtlPointObj, t=0 )
     
     rigbase.followAdd( self.flyCtl, self.rootCtlGrp )
     
     cmds.parent( self.rootCtlGrp, self.flyCtlGrp, self.rigInstance.moveCtl )
     cmds.parent( self.rootGrp, self.rigInstance.worldCtl )
     
     self.rigInstance.collarLCtl = self.collarLCtl
     self.rigInstance.collarRCtl = self.collarRCtl
     self.rigInstance.chestCtl   = self.chestCtl
     self.rigInstance.chestMoveCtl   = self.chestMoveCtl
     self.rigInstance.waistCtl   = self.waistCtl
     self.rigInstance.torsoCtl    = self.torsoCtl
     self.rigInstance.hipCtl     = self.hipCtl
     self.rigInstance.flyCtl     = self.flyCtl
     self.rigInstance.rootCtl    = self.rootCtl
     self.rigInstance.rootGrp    = self.rootGrp
Exemplo n.º 13
0
 def worldCtlSet(self):
     self.worldCtl, self.worldCtlGrp = rigbase.putControler( self.initAll, n='World_CTL', radius=5, normal=[0,1,0] )
     rigbase.connectSameAttr( self.initAll, self.worldCtlGrp ).doIt( 't', 'r' )
     self.rigInstance.worldCtl = self.worldCtl
     rigbase.controlerSetColor( self.worldCtl , 17 )
Exemplo n.º 14
0
def createBjt( topRjt ):
    topBjt = rigbase.hierarchyCopyConnections( topRjt, typ='joint', replaceTarget='_RJT', replace='_BJT', t=0, r=0 )
    
    bjts = cmds.listRelatives( topBjt, c=1, ad=1 )
    bjts.append( topBjt )
    
    for bjt in bjts:
        rjt = bjt.replace( '_BJT', '_RJT' )
        #cmds.setAttr( bjt+'.r', 0,0,0 )
        #cmds.setAttr( bjt+'.jox', e=1, k=1 )
        #cmds.setAttr( bjt+'.joy', e=1, k=1 )
        #cmds.setAttr( bjt+'.joz', e=1, k=1 )
        #cmds.connectAttr( rjt+'.rx', bjt+'.rx' )
        #cmds.connectAttr( rjt+'.ry', bjt+'.ry' )
        #cmds.connectAttr( rjt+'.rz', bjt+'.rz' )
        
        conSameAttr = rigbase.connectSameAttr( rjt, bjt )
        conSameAttr.doIt( 't', 'r', 's' )
        
        if rjt.find( 'Leg_L_Lower4' ) != -1 or rjt.find( 'Leg_R_Lower4' ) != -1:
            conSameAttr.doIt( 'sh' )
        
        cmds.setAttr( bjt+'.ssc', cmds.getAttr( rjt+'.ssc' ) )
        
        if cmds.attributeQuery( 'parameter', node=rjt, ex=1 ):
            rigbase.AttrEdit( bjt ).addAttr( ln='parameter', min=-.001, max=1.001, dv=cmds.getAttr( rjt+'.parameter' ), cb=1 )
            cmds.connectAttr( bjt+'.parameter', rjt+'.parameter' )
            
        bjtP = cmds.listRelatives( bjt, p=1 )
        
        if not bjtP: continue
    
        try:
            cmds.connectAttr( bjtP[0]+'.scale', bjt+'.inverseScale' )
        except: pass
    
    topRjtGrp = cmds.listRelatives( topRjt, p=1 )[0]
    topBjtGrp = cmds.group( em=1, n='Root_BJT_GRP' )
    
    rigbase.transformSetColor( topRjtGrp, 11 )
    rigbase.transformSetColor( topBjtGrp, 29 )
    
    bjtWorld   = cmds.group( n='BJT_World' )
    rigbase.addControlerShape( bjtWorld, typ='circle', normal=[0,1,0], radius=5.5 )
    rigbase.controlerSetColor( bjtWorld, 29 )
    bjtWorldGrp   = cmds.group( bjtWorld, n='BJT_World_GRP' )
    cmds.connectAttr( topRjtGrp+'.t', topBjtGrp+'.t' )
    cmds.connectAttr( topRjtGrp+'.r', topBjtGrp+'.r' )
    cmds.parent( topBjt, topBjtGrp  )
    
    rigbase.connectSameAttr( 'World_CTL_GRP', 'BJT_World_GRP' ).doIt( 't', 'r', 's' )
    rigbase.connectSameAttr( 'World_CTL', 'BJT_World' ).doIt( 't', 'r', 's' )
    #rigbase.AttrEdit( 'BJT_World' ).addAttr( ln='World_CTL', at='message' )
    #cmds.connectAttr( 'World_CTL.message', 'BJT_World.World_CTL' )
    
    RIG = cmds.group( em=1, n='RIG' )
    cmds.parent( 'World_CTL_GRP', 'All_Init', RIG )
    SKIN = cmds.group( em=1, n='SKIN' )
    cmds.parent( 'BJT_World_GRP', SKIN )
    
    cmds.setAttr( topRjt+'.v', 0 )
Exemplo n.º 15
0
 def collarConstSet(self, side ):
     si = 0
     if side == 'R':
         si = 1
     
     shoulderInitList = [self.shoulderLInit, self.shoulderRInit ]
     shoulderCtlList = [self.shoulderLCtl,self.shoulderRCtl]
     collarCtlList = [self.collarLCtl, self.collarRCtl]
     
     const    = cmds.createNode( 'transform', n='Shoulder_%s_Const'          % side )
     inCollar = cmds.createNode( 'transform', n='Shoulder_%s_Const_inCollar' % side )
     inChest  = cmds.createNode( 'transform', n='Shoulder_%s_Const_inChest'  % side )
     inRoot   = cmds.createNode( 'transform', n='Shoulder_%s_Const_inRoot'   % side )
     inFly    = cmds.createNode( 'transform', n='Shoulder_%s_Const_inFly'    % side )
     inMove    = cmds.createNode( 'transform', n='Shoulder_%s_Const_inMove'   % side )
     
     cmds.parent( const   , shoulderCtlList[si] )
     cmds.parent( inCollar, collarCtlList[si]   )
     cmds.parent( inChest , self.chestCtl.replace( 'Chest', 'ChestMove' ) )
     cmds.parent( inRoot  , self.rootGrp  )
     cmds.parent( inFly   , self.rootCtlGrp )
     cmds.parent( inMove  , self.rigInstance.moveCtl )
     
     rigbase.transformDefault( const )#; cmds.setAttr( const+'.dla', 1 )
     rigbase.connectSameAttr( shoulderInitList[si], inCollar ).doIt( 't', 'r' )
     chestDcmp = rigbase.getChildMtxDcmp( shoulderInitList[si], self.chestInit )
     cmds.connectAttr( chestDcmp+'.ot', inChest+'.t' )
     cmds.connectAttr( chestDcmp+'.or', inChest+'.r' )
     rootDcmp = rigbase.getChildMtxDcmp( shoulderInitList[si], self.rootInit )
     cmds.connectAttr( rootDcmp+'.ot', inRoot+'.t' )
     cmds.connectAttr( rootDcmp+'.or', inRoot+'.r' )
     cmds.connectAttr( rootDcmp+'.ot', inFly+'.t' )
     cmds.connectAttr( rootDcmp+'.or', inFly+'.r' )
     cmds.connectAttr( rootDcmp+'.ot', inMove+'.t' )
     cmds.connectAttr( rootDcmp+'.or', inMove+'.r' )
     
     followMtx = cmds.createNode( 'followMatrix', n='Shoulder_%s_ConstFollow' % side )
     mtxDcmp   = cmds.createNode( 'multMatrixDecompose', n='Shoulder_%s_ConstMtxDcmp' % side )
     
     cmds.connectAttr( inCollar+'.wm', followMtx+'.originalMatrix' )
     cmds.connectAttr( inChest +'.wm', followMtx+'.inputMatrix[0]' )
     cmds.connectAttr( inRoot  +'.wm', followMtx+'.inputMatrix[1]' )
     cmds.connectAttr( inFly   +'.wm', followMtx+'.inputMatrix[2]' )
     cmds.connectAttr( inMove  +'.wm', followMtx+'.inputMatrix[3]' )
     
     cmds.connectAttr( followMtx+'.outputMatrix', mtxDcmp+'.i[0]' )
     cmds.connectAttr( const +'.pim', mtxDcmp+'.i[1]' )
     cmds.connectAttr( mtxDcmp+'.or', const+'.r' )
     
     rigbase.addHelpTx( collarCtlList[si], 'Follow' )
     attrEdit = rigbase.AttrEdit( collarCtlList[si] )
     attrEdit.addAttr( ln='chestFollow', min=0, max=10 )
     attrEdit.addAttr( ln='rootFollow' , min=0, max=10 )
     attrEdit.addAttr( ln='flyFollow'  , min=0, max=10, k=1 )
     attrEdit.addAttr( ln='moveFollow'  , min=0, max=10 )
     
     cmds.connectAttr( collarCtlList[si]+'.chestFollow', followMtx+'.inputWeight[0]' )
     cmds.connectAttr( collarCtlList[si]+'.rootFollow' , followMtx+'.inputWeight[1]' )
     cmds.connectAttr( collarCtlList[si]+'.flyFollow'  , followMtx+'.inputWeight[2]' )
     cmds.connectAttr( collarCtlList[si]+'.moveFollow' , followMtx+'.inputWeight[3]' )
     
     if side == 'L':
         self.shoulderLConst = const
         self.rigInstance.ikGroupLConst = inChest
     else:
         self.shoulderRConst = const
         self.rigInstance.ikGroupRConst = inChest
Exemplo n.º 16
0
def createBjt(topRjt):
    topBjt = rigbase.hierarchyCopyConnections(topRjt,
                                              typ='joint',
                                              replaceTarget='_RJT',
                                              replace='_BJT',
                                              t=0,
                                              r=0)

    bjts = cmds.listRelatives(topBjt, c=1, ad=1)
    bjts.append(topBjt)

    for bjt in bjts:
        rjt = bjt.replace('_BJT', '_RJT')
        #cmds.setAttr( bjt+'.r', 0,0,0 )
        #cmds.setAttr( bjt+'.jox', e=1, k=1 )
        #cmds.setAttr( bjt+'.joy', e=1, k=1 )
        #cmds.setAttr( bjt+'.joz', e=1, k=1 )
        #cmds.connectAttr( rjt+'.rx', bjt+'.rx' )
        #cmds.connectAttr( rjt+'.ry', bjt+'.ry' )
        #cmds.connectAttr( rjt+'.rz', bjt+'.rz' )

        conSameAttr = rigbase.connectSameAttr(rjt, bjt)
        conSameAttr.doIt('t', 'r', 's')

        if rjt.find('Leg_L_Lower4') != -1 or rjt.find('Leg_R_Lower4') != -1:
            conSameAttr.doIt('sh')

        cmds.setAttr(bjt + '.ssc', cmds.getAttr(rjt + '.ssc'))

        if cmds.attributeQuery('parameter', node=rjt, ex=1):
            rigbase.AttrEdit(bjt).addAttr(ln='parameter',
                                          min=-.001,
                                          max=1.001,
                                          dv=cmds.getAttr(rjt + '.parameter'),
                                          cb=1)
            cmds.connectAttr(bjt + '.parameter', rjt + '.parameter')

        bjtP = cmds.listRelatives(bjt, p=1)

        if not bjtP: continue

        try:
            cmds.connectAttr(bjtP[0] + '.scale', bjt + '.inverseScale')
        except:
            pass

    topRjtGrp = cmds.listRelatives(topRjt, p=1)[0]
    topBjtGrp = cmds.group(em=1, n='Root_BJT_GRP')

    rigbase.transformSetColor(topRjtGrp, 11)
    rigbase.transformSetColor(topBjtGrp, 29)

    bjtWorld = cmds.group(n='BJT_World')
    rigbase.addControlerShape(bjtWorld,
                              typ='circle',
                              normal=[0, 1, 0],
                              radius=5.5)
    rigbase.controlerSetColor(bjtWorld, 29)
    bjtWorldGrp = cmds.group(bjtWorld, n='BJT_World_GRP')
    cmds.connectAttr(topRjtGrp + '.t', topBjtGrp + '.t')
    cmds.connectAttr(topRjtGrp + '.r', topBjtGrp + '.r')
    cmds.parent(topBjt, topBjtGrp)

    rigbase.connectSameAttr('World_CTL_GRP',
                            'BJT_World_GRP').doIt('t', 'r', 's')
    rigbase.connectSameAttr('World_CTL', 'BJT_World').doIt('t', 'r', 's')
    #rigbase.AttrEdit( 'BJT_World' ).addAttr( ln='World_CTL', at='message' )
    #cmds.connectAttr( 'World_CTL.message', 'BJT_World.World_CTL' )

    RIG = cmds.group(em=1, n='RIG')
    cmds.parent('World_CTL_GRP', 'All_Init', RIG)
    SKIN = cmds.group(em=1, n='SKIN')
    cmds.parent('BJT_World_GRP', SKIN)

    cmds.setAttr(topRjt + '.v', 0)
Exemplo n.º 17
0
 def curveSet(self):
     #self.crv = cmds.curve( n='Torso_Spline_CRV', d=3, p=[[0,0,0],[0,0,0],[0,0,0],[0,0,0]] )
     self.initCrv = cmds.curve( n='Torso_SplineInit_CRV', d=3, p=[[0,0,0],[0,0,0],[0,0,0],[0,0,0]] )
     
     #cmds.setAttr( self.crv+'.v', 0 )
     cmds.setAttr( self.initCrv+'.v', 0 )
     
     #self.crvShape = cmds.listRelatives( self.crv, s=1 )[0]
     self.initCrvShape = cmds.listRelatives( self.initCrv, s=1 )[0]
     
     self.crvPoint0Obj = self.hipCtl
     self.crvPoint1Obj = cmds.createNode( 'transform', n= 'Torso_Spline_point1' )
     self.crvPoint2Obj = cmds.createNode( 'transform', n= 'Torso_Spline_point2' )
     self.crvPoint3Obj = self.chestCtl
     
     self.crvOrigPoint0Obj = self.torsoCtl
     self.crvOrigWaistObj = cmds.createNode( 'transform', n= 'Waist_CTL_SqPos' )
     self.crvOrigPoint1Obj = cmds.createNode( 'transform', n= 'Torso_Spline_SquPoint1' )
     self.crvOrigPoint2Obj = cmds.createNode( 'transform', n= 'Torso_Spline_SquPoint2' )
     self.crvOrigPoint3Obj = cmds.createNode( 'transform', n= 'Chest_CTL_SquPos' )
     
     rigbase.AttrEdit( self.crvPoint1Obj, self.crvPoint2Obj ).lockAndHideAttrs( 'tx', 'tz', 'rx', 'ry','rz', 'sx', 'sy','sz', 'v' )
     cmds.parent( self.crvPoint1Obj, self.crvPoint2Obj, self.waistCtl )
     
     cmds.parent( self.crvOrigWaistObj, self.crvOrigPoint3Obj, self.rootGrp )
     cmds.parent( self.crvOrigPoint1Obj, self.crvOrigPoint2Obj, self.crvOrigWaistObj )
     self.crvOrigSqPointGrp = cmds.group( self.crvOrigPoint1Obj, self.crvOrigPoint2Obj, n='Waist_CTL_SqSqPointGrp' )
     cmds.xform( self.crvOrigSqPointGrp, piv=[0,0,0], os=1 )
     
     rigbase.pInvRotConst( self.crvOrigSqPointGrp )
     
     rigbase.connectSameAttr( self.waistInit, self.crvOrigWaistObj ).doIt( 't','r' )
     chMtxDcmp = rigbase.getChildMtxDcmp( self.chestInit, self.rootInit )
     cmds.connectAttr( chMtxDcmp+'.ot', self.crvOrigPoint3Obj+'.t' )
     cmds.connectAttr( chMtxDcmp+'.or', self.crvOrigPoint3Obj+'.r' )
     #rigbase.connectSameAttr( self.chestCtlGrp, self.crvOrigPoint3Obj ).doIt( 't', 'r' )
     #rigbase.connectSameAttr( self.crvPoint1Obj, self.crvOrigPoint1Obj ).doIt( 't','r' )
     #rigbase.connectSameAttr( self.crvPoint2Obj, self.crvOrigPoint2Obj ).doIt( 't','r' )
     
     multPoint1Node = cmds.createNode( 'multDoubleLinear', n='Torso_Spline_point1_mult' )
     multPoint2Node = cmds.createNode( 'multDoubleLinear', n='Torso_Spline_point2_mult' )
     distPoint1Node = cmds.createNode( 'distanceBetween', n='Torso_spline_point1_dist' )
     distPoint2Node = cmds.createNode( 'distanceBetween', n='Torso_spline_point2_dist' )
     
     cmds.connectAttr( self.waistInit+'.t', distPoint1Node+'.point1' )
     cmds.connectAttr( self.chestInit+'.t', distPoint2Node+'.point2' )
     cmds.connectAttr( distPoint1Node+'.distance', multPoint1Node+'.input1' )
     cmds.connectAttr( distPoint2Node+'.distance', multPoint2Node+'.input1' )
     #cmds.connectAttr( multPoint1Node+'.output', self.crvPoint1Obj+'.ty' )
     #cmds.connectAttr( multPoint2Node+'.output', self.crvPoint2Obj+'.ty' )
     cmds.connectAttr( multPoint1Node+'.output', self.crvOrigPoint1Obj+'.ty' )
     cmds.connectAttr( multPoint2Node+'.output', self.crvOrigPoint2Obj+'.ty' )
     
     cmds.setAttr( multPoint1Node+'.input2', -.4 )
     cmds.setAttr( multPoint2Node+'.input2', .4 )
     
     '''
     for i in range( 4 ):
         dcmp = cmds.createNode( 'decomposeMatrix', n= self.crv+'_point%d_dcmp' % i )
         exec( 'cmds.connectAttr( self.crvPoint%dObj+".wm", dcmp+".imat" )' % i )
         cmds.connectAttr( dcmp+".ot", self.crvShape+'.controlPoints[%d]' %i )'''
         
     for i in range( 4 ):
         dcmp = cmds.createNode( 'multMatrixDecompose', n= self.initCrv+'_origPoint%d_dcmp' % i )
         exec( 'cmds.connectAttr( self.crvOrigPoint%dObj+".wm", dcmp+".i[0]" )' % i )
         cmds.connectAttr( self.initCrv+".wim", dcmp+".i[1]" )
         cmds.connectAttr( dcmp+".ot", self.initCrvShape+'.controlPoints[%d]' %i )
     
     rigbase.transformDefault( self.initCrv )
     
     #rigbase.connectSameAttr( self.crv, self.initCrv ).doIt( 't', 'r', 's', 'sh' )
     
     cmds.parent( self.initCrv, self.rootGrp )
Exemplo n.º 18
0
 def hipConstSet(self):
     hipLConst_inFly = cmds.createNode( 'transform', n='Hip_L_Const_inFly' )
     hipRConst_inFly = cmds.createNode( 'transform', n='Hip_R_Const_inFly' )
     hipLConst_inRoot = cmds.createNode( 'transform', n='Hip_L_Const_inRoot' )
     hipRConst_inRoot = cmds.createNode( 'transform', n='Hip_R_Const_inRoot' )
     hipLConst_inHip = cmds.createNode( 'transform', n='Hip_L_Const_inHip' )
     hipRConst_inHip = cmds.createNode( 'transform', n='Hip_R_Const_inHip' )
     hipLConst = cmds.createNode( 'transform', n='Hip_L_Const' )
     hipRConst = cmds.createNode( 'transform', n='Hip_R_Const' )
     
     cmds.parent( hipLConst_inFly, hipRConst_inFly, self.rootCtlGrp )
     cmds.parent( hipLConst_inRoot, hipRConst_inRoot, self.rootGrp )
     cmds.parent( hipLConst, hipRConst, hipLConst_inHip, hipRConst_inHip, self.hipCtl )
     
     rigbase.connectSameAttr( self.hipLInit, hipLConst_inFly ).doIt( 't','r' )
     rigbase.connectSameAttr( self.hipRInit, hipRConst_inFly ).doIt( 't','r' )
     
     rigbase.connectSameAttr( self.hipLInit, hipLConst_inRoot ).doIt( 't' )
     rigbase.connectSameAttr( self.hipRInit, hipRConst_inRoot ).doIt( 't' )
     
     rigbase.constraint( hipLConst_inFly, hipLConst_inRoot, t=0 )
     rigbase.constraint( hipRConst_inFly, hipRConst_inRoot, t=0 )
     
     rigbase.connectSameAttr( self.hipLInit, hipLConst_inHip ).doIt( 't','r' )
     rigbase.connectSameAttr( self.hipRInit, hipRConst_inHip ).doIt( 't','r' )
     
     #cmds.setAttr( hipLConst_inHip+'.rz', -90 )
     #cmds.setAttr( hipLConst_inRoot+'.rz', -90 )
     
     #cmds.setAttr( hipRConst_inHip+'.rx', 180 )
     #cmds.setAttr( hipRConst_inHip+'.rz', 90 )
     #cmds.setAttr( hipRConst_inRoot+'.rx', 180 )
     #cmds.setAttr( hipRConst_inRoot+'.rz', 90 )
     
     blendMtxL = cmds.createNode( 'blendTwoMatrix', n='Hip_L_Const_blendMtx' )
     blendMtxR = cmds.createNode( 'blendTwoMatrix', n='Hip_R_Const_blendMtx' )
     
     multMtxDcmpL = cmds.createNode( 'multMatrixDecompose', n='Hip_L_Const_MtxDcmp' )
     multMtxDcmpR = cmds.createNode( 'multMatrixDecompose', n='Hip_R_Const_MtxDcmp' )
     
     cmds.connectAttr( hipLConst_inRoot+'.wm', blendMtxL+'.inMatrix1' )
     cmds.connectAttr( hipRConst_inRoot+'.wm', blendMtxR+'.inMatrix1' )
     cmds.connectAttr( hipLConst_inHip+'.wm', blendMtxL+'.inMatrix2' )
     cmds.connectAttr( hipRConst_inHip+'.wm', blendMtxR+'.inMatrix2' )
     
     cmds.connectAttr( blendMtxL+'.outMatrix', multMtxDcmpL+'.i[0]' )
     cmds.connectAttr( blendMtxR+'.outMatrix', multMtxDcmpR+'.i[0]' )
     
     cmds.connectAttr( hipLConst+'.pim', multMtxDcmpL+'.i[1]' )
     cmds.connectAttr( hipRConst+'.pim', multMtxDcmpR+'.i[1]' )
     
     cmds.connectAttr( hipLConst_inHip+'.t', hipLConst+'.t' )
     cmds.connectAttr( hipRConst_inHip+'.t', hipRConst+'.t' )
     cmds.connectAttr( multMtxDcmpL+'.or', hipLConst+'.r' )
     cmds.connectAttr( multMtxDcmpR+'.or', hipRConst+'.r' )
     
     rigbase.addHelpTx( self.hipCtl, 'Options' )
     attrEdit = rigbase.AttrEdit( self.hipCtl )
     attrEdit.addAttr( ln='legFollowL', min=0, max=1, k=1 )
     attrEdit.addAttr( ln='legFollowR', min=0, max=1, k=1 )
     
     cmds.connectAttr( self.hipCtl+'.legFollowL', blendMtxL+'.attributeBlender' )
     cmds.connectAttr( self.hipCtl+'.legFollowR', blendMtxR+'.attributeBlender' )
     
     self.rigInstance.hipLConst_inRoot = hipLConst_inRoot
     self.rigInstance.hipRConst_inRoot = hipRConst_inRoot
     self.rigInstance.hipLConst_inHip = hipLConst_inHip
     self.rigInstance.hipRConst_inHip = hipRConst_inHip
     self.rigInstance.hipLConstInFly = hipLConst_inFly
     self.rigInstance.hipRConstInFly = hipRConst_inFly
     self.hipLConst = hipLConst
     self.hipRConst = hipRConst