Beispiel #1
0
def modulateEyelashACS():
    '''
    '''
    """
    # left side 9 to 19
    acsNodes = [pm.PyNode('FACE:LT_eye_aimAt_bnd_%d_eyelash_acs'%jntId)
                for jntId in range(9,20)]
    
    drv = pm.PyNode('FACE:LT_eyelid_upper_pri_ctrl')
    drv.addAttr('eyelidDownMod')
    rt.connectSDK(drv.ty, drv.eyelidDownMod, {0:1, -0.5:0})
    
    for node in acsNodes:
        mod = modulate.multiplyInput(node.rz, 1, '_eyelidDownMod')
        drv.eyelidDownMod >> mod 
        """
    # right side 9 to 19
    acsNodes = [pm.PyNode('FACE:RT_eye_aimAt_bnd_%d_eyelash_acs'%jntId)
                for jntId in range(9,20)]
    
    drv = pm.PyNode('FACE:RT_eyelid_upper_pri_ctrl')
    drv.addAttr('eyelidDownMod')
    rt.connectSDK(drv.ty, drv.eyelidDownMod, {0:1, -0.5:0})
    
    for node in acsNodes:
        mod = modulate.multiplyInput(node.rz, 1, '_eyelidDownMod')
        drv.eyelidDownMod >> mod 
Beispiel #2
0
def addJacketCollarRig():
    # jacket collar rig
    collarjnts = pm.ls(sl=True)
    # add hm, grp and auto nulls
    for jnt in collarjnts:
        ctl = pm.circle(r=0.5, sweep=359, normal=(1,0,0), n=jnt.replace('_jnt', '_ctl'))
        auto = pm.group(ctl, n=jnt.replace('_jnt', '_auto'))
        grp = pm.group(auto, n=jnt.replace('_jnt', '_grp'))
        hm = pm.group(grp, n=jnt.replace('_jnt', '_hm'))
        wMat = jnt.getMatrix(worldSpace=True)
        hm.setMatrix(wMat, worldSpace=True)
        collarparent = jnt.getParent()
        collarparent | hm
        auto | jnt
    # auto
    import rigger.modules.poseReader as poseReader
    reload(poseReader)
    xfo = nt.Joint(u'Mathilda_neck_jnt')
    poseReader.radial_pose_reader(xfo, (1,0,0), (1,0,0))
    # connect auto to sdks
    import utils.rigging as rt
    import rigger.utils.modulate as modulate
    angleMult = pm.PyNode('Mathilda_neck_jnt.vectorAngle')
    # Left collar A
    rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarA_auto.rz',
                    {3.25:0, 4.6:50, 5.5:0})
    mod = modulate.multiplyInput(pm.PyNode('LT_collarA_auto.rz'), 0, '_angle')
    angleMult >> mod
    # Letf collar B
    rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarB_auto.rz',
                    {4:0, 5:180, 6:180, 7:0})
    mod = modulate.multiplyInput(pm.PyNode('LT_collarB_auto.rz'), 0, '_angle')
    angleMult >> mod
    # Letf collar C
    rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarC_auto.rz',
                    {0:200, 1.4:0, 4:0, 5.5:200, 6.6:280, 8:0})
    mod = modulate.multiplyInput(pm.PyNode('LT_collarC_auto.rz'), 0, '_angle')
    angleMult >> mod
    # center collar
    rt.connectSDK('Mathilda_neck_jnt.param', 'CT_collar_auto.rz',
                    {0:320, 2.5:0, 5.5:0, 8:320})
    mod = modulate.multiplyInput(pm.PyNode('CT_collar_auto.rz'), 0, '_angle')
    angleMult >> mod
    # right collar A
    rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarA_auto.rz',
                    {4.75:0, 3.4:50, 2.5:0})
    mod = modulate.multiplyInput(pm.PyNode('RT_collarA_auto.rz'), 0, '_angle')
    angleMult >> mod
    # right collar B
    rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarB_auto.rz',
                    {4:0, 3:180, 2:180, 1:0})
    mod = modulate.multiplyInput(pm.PyNode('RT_collarB_auto.rz'), 0, '_angle')
    angleMult >> mod
    # right collar C
    rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarC_auto.rz',
                    {0:200, 6.6:0, 4:0, 2.5:200, 1.4:280, 8:0})
    mod = modulate.multiplyInput(pm.PyNode('RT_collarC_auto.rz'), 0, '_angle')
    angleMult >> mod
    
    pm.select(pm.PyNode(u'Mathilda_neck_jnt.param').outputs())
Beispiel #3
0
def addCurveLengthRatioGlobalScale(crv, scaleAttr):
    '''
    patches addCurveLengthRatioAttr to globalScale
    '''
    crv.addAttr('globalScale', k=True, dv=1, min=0.001)
    scaleAttr >> crv.attr('globalScale')

    # assume lengthRatio attr was already created
    md = crv.attr('lengthRatio').inputs()[0]

    # modulate input1X by scale
    currInput = md.input1X.get()
    modScale = modulate.multiplyInput(md.input1X, 1, '_scale')
    scaleAttr >> modScale
Beispiel #4
0
def addCurveLengthRatioGlobalScale(crv, scaleAttr):
    '''
    patches addCurveLengthRatioAttr to globalScale
    '''
    crv.addAttr('globalScale', k=True, dv=1, min=0.001)
    scaleAttr >> crv.attr('globalScale')
    
    # assume lengthRatio attr was already created
    md = crv.attr('lengthRatio').inputs()[0]
    
    # modulate input1X by scale
    currInput = md.input1X.get()
    modScale = modulate.multiplyInput(md.input1X, 1, '_scale')
    scaleAttr >> modScale
Beispiel #5
0
def modulateFleshyEyesUp():
    '''
    DONT USE THIS
    '''
    node = nt.Transform(u'FACE:LT_eyeball_bnd')
    node.addAttr('finalVectorAngle', k=True)
    # replace outputs
    outAttrs = node.vectorAngle.outputs(p=True)
    node.vectorAngle >> node.finalVectorAngle
    for plug in outAttrs:
        node.finalVectorAngle >> plug
    # modulate finalVectorAngle
    mod = modulate.multiplyInput(node.finalVectorAngle, 1, '_eyeY_mod')
    rt.connectSDK('FACE:LT_eyeball_bnd.paramNormalized', mod, {0:0.2, 0.4:1, 0.6:1, 1:0.2})
Beispiel #6
0
def modulatePushOutLocs():
    '''
    add a modulate attr for each row of locs
    add attrs to loc grp
    '''
    locGrpNames = [
        '_back', '_left', '_front', '_right', '_leftBack', '_rightBack',
        '_rightFront', '_leftFront'
    ]
    master = nt.Transform(u'CT_torsoReader_locs_grp')

    for grpName in locGrpNames:
        for rowId in range(1, 10):
            master.addAttr('%s_row%d_mod' % (grpName, rowId), k=True, dv=1)

            loc = pm.PyNode('torsoReader_%d%s_loc_pushOutLoc' %
                            (rowId, grpName))
            modAttr = modulate.multiplyInput(loc.tz, 1, '_mod')
            master.attr('%s_row%d_mod' % (grpName, rowId)) >> modAttr
def addLocalBnd(bnd):
    # add joint in same position
    mat = bnd.getMatrix(ws=True)
    pm.select(cl=True)
    localBnd = pm.joint(n=bnd.replace('_bnd', '_local_bnd'))
    localBnd.radius.set(bnd.radius.get())
    localBndLipCurl = pm.group(localBnd, n=localBnd + '_lipCurl')
    localBndHm = pm.group(localBndLipCurl, n=localBnd + '_hm')
    localBndHm.setMatrix(mat, ws=True)

    import rigger.utils.modulate as modulate
    reload(modulate)

    # add hierarchy for driving pCtls
    priCtlAttrs = bnd.listAttr(ud=True)
    priCtlAttrs = [
        attr for attr in priCtlAttrs
        if 'pri_ctrl_weight_tz' in attr.attrName()
    ]
    groupsList = []
    for attr in priCtlAttrs:
        # add xfo for the attr's driving pCtl
        pCtl = pm.PyNode('_'.join(attr.attrName().split('_')[:5]))
        pCtlMat = pCtl.getMatrix(ws=True)
        pCtlToken = '_'.join(pCtl.split('_')[:3])
        pCtlGrp = pm.group(em=True, n=localBnd + '_' + pCtlToken)
        pCtlHm = pm.group(pCtlGrp, n=pCtlGrp + '_hm')
        pCtlHm.setMatrix(pCtlMat, ws=True)
        if groupsList:
            pCtlHm.setParent(groupsList[-1])
        try:
            # connect TZ from pCtlNegator if it exist
            pCtlNeg = pm.PyNode(pCtl + '_negator')
            pCtlNeg.tz >> pCtlGrp.tz
            # multiply the influence
            pCtlWt = attr.get()
            modAttr = modulate.multiplyInput(pCtlGrp.tz, pCtlWt)
        except:
            print pCtl + ' has no negator in CtlSys'
        groupsList.append(pCtlGrp)

    # add localBnd to hierarchy
    groupsList[-1] | localBndHm
Beispiel #8
0
def addLocalBnd(bnd):
    # add joint in same position
    mat = bnd.getMatrix(ws=True)
    pm.select(cl=True)
    localBnd = pm.joint(n=bnd.replace('_bnd', '_local_bnd'))
    localBnd.radius.set(bnd.radius.get())
    localBndLipCurl = pm.group(localBnd, n=localBnd+'_lipCurl')
    localBndHm = pm.group(localBndLipCurl, n=localBnd+'_hm')
    localBndHm.setMatrix(mat, ws=True)
    
    import rigger.utils.modulate as modulate
    reload(modulate)
    
    # add hierarchy for driving pCtls
    priCtlAttrs = bnd.listAttr(ud=True)
    priCtlAttrs = [attr for attr in priCtlAttrs if 'pri_ctrl_weight_tz' in attr.attrName()]
    groupsList = []
    for attr in priCtlAttrs:
        # add xfo for the attr's driving pCtl
        pCtl = pm.PyNode('_'.join(attr.attrName().split('_')[:5]))
        pCtlMat = pCtl.getMatrix(ws=True)
        pCtlToken = '_'.join(pCtl.split('_')[:3])
        pCtlGrp = pm.group(em=True, n=localBnd+'_'+pCtlToken)
        pCtlHm = pm.group(pCtlGrp, n=pCtlGrp+'_hm')
        pCtlHm.setMatrix(pCtlMat, ws=True)
        if groupsList:
            pCtlHm.setParent(groupsList[-1])
        try:
            # connect TZ from pCtlNegator if it exist
            pCtlNeg = pm.PyNode(pCtl+'_negator')
            pCtlNeg.tz >> pCtlGrp.tz
            # multiply the influence
            pCtlWt = attr.get()
            modAttr = modulate.multiplyInput(pCtlGrp.tz, pCtlWt)
        except:
            print pCtl + ' has no negator in CtlSys'
        groupsList.append(pCtlGrp)
    
    # add localBnd to hierarchy
    groupsList[-1] | localBndHm
Beispiel #9
0
def modulatePushOutLocs():
    '''
    add a modulate attr for each row of locs
    add attrs to loc grp
    '''
    locGrpNames = ['_back',
                   '_left',
                   '_front',
                   '_right',
                   '_leftBack',
                   '_rightBack',
                   '_rightFront',
                   '_leftFront']
    master = nt.Transform(u'CT_torsoReader_locs_grp')
    
    for grpName in locGrpNames:
        for rowId in range(1,10):
            master.addAttr('%s_row%d_mod'%(grpName, rowId), k=True, dv=1)
        
            loc = pm.PyNode('torsoReader_%d%s_loc_pushOutLoc' %
                            (rowId, grpName))
            modAttr = modulate.multiplyInput(loc.tz, 1, '_mod')
            master.attr('%s_row%d_mod'%(grpName, rowId)) >> modAttr
Beispiel #10
0
def connectHairToGlobalScale():
    '''
    import rigger.builds.mathilda.hacks as hacks
    reload(hacks)
    hacks.connectHairToGlobalScale()
    '''
    
    crvGrp = nt.Transform(u'CT_hairStartCurves_grp')
    mesh = nt.Transform(u'CT_headHair_geo')
    root = nt.Transform(u'Mathilda_root_ctrl')
    
    # connect masterscale to scale curves
    root.masterScale >> crvGrp.sx
    root.masterScale >> crvGrp.sy
    root.masterScale >> crvGrp.sz
    
    # multiply matrix for follicles
    mm = pm.createNode('multMatrix', n='CT_hairFolliclesGlobalScale_mm')
    mesh.worldMatrix >> mm.matrixIn[0]
    crvGrp.worldInverseMatrix >> mm.matrixIn[1]
    
    # get all follicles
    allFols = crvGrp.getChildren(ad=True, type='follicle')
    
    # connect worldMatrix
    for fol in allFols:
        mm.matrixSum >> fol.inputWorldMatrix
    
    # scale hairSystems
    attrsToScale = ['backHairSystemShape.clumpWidth',
                    'backHairSystemShape.hairWidth',
                    'frontHairSystemShape.clumpWidth',
                    'frontHairSystemShape.hairWidth']
    for attr in attrsToScale:
        mod = modulate.multiplyInput(attr, 1, '_gscale')
        root.masterScale >> mod