Exemplo n.º 1
0
    def controlMyLids(self):

        filePath = r"E:\sgScripts\project\dave\guide\dave_eyelidCTLGuide.ma"
        cmds.file(filePath, i=True, dns=True)

        ctrl = []
        jnts = []
        guides = pm.ls("*_GUIDE")
        for x in guides:
            oldName = x.split("_")
            newName = oldName[0] + "_" + oldName[1] + "_" + oldName[2] + "_CTL"
            ctl = controls.roundZ(curveScale=.2)
            pm.rename(ctl, newName)
            grp = pm.group(ctl, n=newName + "_fGRP")
            grp2 = pm.group(n=newName + "_offSet_fGRP")
            zero = pm.xform("eyeCentre_0", q=1, ws=1, t=1)
            pm.xform(grp2, ws=1, t=zero)
            pm.parent(grp, grp2)
            ctrl.append(grp2)
            pos = pm.xform(x, q=1, ws=1, t=1)
            pm.xform(grp, ws=1, t=pos)
            jntName = oldName[0] + "_" + oldName[1] + "_" + oldName[2] + "_eJNT"
            jnt = pm.createNode("joint", n=jntName)
            jnts.append(jnt)
            con = pm.pointConstraint(ctl, jnt)
            pm.xform(jnt, ws=1, t=pos)

        eyelidControl = pm.group(ctrl, n="eylidControl_GRP")
        jntControl = pm.group(jnts, n="eyeLidJoints_GRP")
        pm.setAttr(jntControl + ".visibility", 0)

        pm.delete(guides)
Exemplo n.º 2
0
 def fControl(self, newName, num):
     circ = controls.roundZ(curveScale=.2)
     pm.rename(circ, newName + "{0:02d}_fCTL".format(num))
     border = controls.square2()
     pm.hide(border)
     pm.rename(border, newName + "{0:02d}_fBDR".format(num))
     grp = pm.group(circ, border, n=newName + "{0:02d}_fGRP".format(num))
     grp2 = pm.group(grp, n=newName + "offSet_{0:02d}_fGRP".format(num))
     grp3 = pm.group(empty=True,
                     n=newName + "woldSpace_{0:02d}_fGRP".format(num))
     pm.parent(grp2, grp3)
     pm.setAttr(str(grp) + ".tz", -0.3)
Exemplo n.º 3
0
    def controlMyLids(self):

        filePath = r"E:\sgScripts\project\\" + charName + r"\guide\\" + charName + r"_eyelidCTLGuide.ma"
        cmds.file(filePath, i=True, dns=True)

        ctrl = []
        jnts = []
        guides = pm.ls("*_GUIDE")
        sides = ["0", "1"]

        for x in guides:
            oldName = x.split("_")
            newName = oldName[0] + "_" + oldName[1] + "_" + oldName[2] + "_CTL"
            ctl = controls.roundZ(curveScale=.2)
            pm.rename(ctl, newName)
            grp = pm.group(ctl, n=newName + "_fGRP")
            grp2 = pm.group(n=newName + "_offSet_fGRP")
            if x.startswith("l"):
                zero = pm.xform("eyeCentre_0", q=1, ws=1, t=1)
            else:
                zero = pm.xform("eyeCentre_1", q=1, ws=1, t=1)
            pm.xform(grp2, ws=1, t=zero)
            pm.parent(grp, grp2)
            ctrl.append(grp2)
            pos = pm.xform(x, q=1, ws=1, t=1)
            pm.xform(grp, ws=1, t=pos)
            jntName = oldName[0] + "_" + oldName[1] + "_" + oldName[2] + "_eJNT"
            jnt = pm.createNode("joint", n=jntName)
            jnts.append(jnt)
            con = pm.pointConstraint(ctl, jnt)
            pm.xform(jnt, ws=1, t=pos)

        eyelidControl = pm.group(ctrl, n="eylidControl_GRP")
        jntControl = pm.group(jnts, n="eyeLidJoints_GRP")
        pm.setAttr(jntControl + ".visibility", 0)

        pm.delete(guides)
        offGRPS = [
            "l_eye_upMiddle_CTL_offSet_fGRP",
            "l_eye_downMiddle_CTL_offSet_fGRP",
            "r_eye_upMiddle_CTL_offSet_fGRP",
            "r_eye_downMiddle_CTL_offSet_fGRP"
        ]
        middleCTLS = [
            "l_eye_upMiddle_CTL", "l_eye_downMiddle_CTL", "r_eye_upMiddle_CTL",
            "r_eye_downMiddle_CTL"
        ]
        for x in middleCTLS:
            oldNname = x.split("_")
            newName = oldNname[0] + "_" + oldNname[1] + "_" + oldNname[
                2] + "_" + "follow" + "_fGRP"
            follgrps = pm.group(empty=True, name=newName)

        follGRPS = [
            "l_eye_upMiddle_follow_fGRP", "l_eye_downMiddle_follow_fGRP",
            "r_eye_upMiddle_follow_fGRP", "r_eye_downMiddle_follow_fGRP"
        ]
        for x, y in zip(offGRPS, follGRPS):
            print(y + x)
            pm.parent(y, x)
        for x in follGRPS:
            pm.setAttr(x + ".tx", 0)
            pm.setAttr(x + ".ty", 0)
            pm.setAttr(x + ".tz", 0)

        midGRPS = [
            "l_eye_upMiddle_CTL_fGRP", "l_eye_downMiddle_CTL_fGRP",
            "r_eye_upMiddle_CTL_fGRP", "r_eye_downMiddle_CTL_fGRP"
        ]
        for x, y in zip(follGRPS, midGRPS):
            print(y + x)
            pm.parent(y, x)