예제 #1
0
def pelvis(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(
        d=3,
        p=[(0.0, -6.3438, -6.0), (-0.5341, -6.3035, -7.2091),
           (-2.2915, -6.0529, -9.3811), (-5.648, -5.0157, -11.5076),
           (-8.9374, -3.1143, -12.3982), (-11.6652, -0.5556, -12.4423),
           (-13.7499, 2.2091, -11.651), (-15.4297, 4.2012, -9.5584),
           (-15.8023, 4.8234, -5.988), (-15.8023, 4.8234, -1.7349),
           (-15.5237, 4.2493, 2.6878), (-14.2405, 2.4604, 7.1112),
           (-12.3627, -0.1983, 10.573), (-9.3219, -2.9173, 12.0942),
           (-5.6987, -4.9897, 11.5076), (-2.2915, -6.0529, 9.3811),
           (-0.5341, -6.3035, 7.2091), (0.0, -6.3438, 6.0),
           (0.5341, -6.3035, 7.2091), (2.2916, -6.0529, 9.3811),
           (5.6987, -4.9897, 11.5076), (9.3219, -2.9173, 12.0942),
           (12.3627, -0.1983, 10.573), (14.2406, 2.4604, 7.1112),
           (15.5237, 4.2493, 2.6878), (15.8023, 4.8234, -1.7349),
           (15.8023, 4.8234, -5.988), (15.4297, 4.2012, -9.5584),
           (13.7499, 2.2091, -11.651), (11.6652, -0.5556, -12.4423),
           (8.9374, -3.1143, -12.3982), (5.648, -5.0157, -11.5076),
           (2.2916, -6.0529, -9.3811), (0.5341, -6.3035, -7.2091),
           (0.0, -6.3438, -6.0)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #2
0
def legIK(ikFootScale, legikHandle, pvName):

    ballikHandle = cmds.ikHandle(sj=ogChain[2] + "_ik", ee=ogChain[3] + "_ik", sol="ikSCsolver", n=side + "ball_ikHandle")
    toeikHandle = cmds.ikHandle(sj=ogChain[3] + "_ik", ee=ogChain[4] + "_ik", sol="ikSCsolver", n=side + "toe_ikHandle")
    
    # Create and place ik controller
    ikFootControl = cmds.curve(d=2, p=[(0.997, 0, 1.789), (0, 0, 2.39), (-0.997,0,1.789), (-1.108, 0, 0), (-0.784, 0,-2.5),
              (0, 0,-3), (0.784, 0, -2.5), (1.108, 0, 0), (0.997, 0, 1.789), (0, 0, 2.39)],
              k=[0,1,2,3,4,5,6,7,8,9,10], n=side + "leg_anim_ik")

    # Rename shape node
    shapeList = cmds.listRelatives(ikFootControl, s = True)
    cmds.rename(shapeList, ikFootControl + "Shape")
              
    ikFootControlGrp = cmds.group(em=1, n=ikFootControl + "_grp")
    cmds.parent(ikFootControl, ikFootControlGrp)
    
    # Set size, freeze transform, create offset group and color
    cmds.scale(ikFootScale, ikFootScale, ikFootScale, ikFootControlGrp)  
    cmds.move(0,-3.2,0, ikFootControl, r=1)
    cmds.makeIdentity(ikFootControl, a = 1, t = 1, r = 1, s = 1)
    cmds.delete(ikFootControl, ch = 1)
    cmds.delete(cmds.pointConstraint(ogChain[3] + "_ik", ikFootControlGrp))
    cmds.color(ikFootControl, rgb=controllerColor) 
    
    # pivot snapping on ankle joint
    piv = cmds.xform(ogChain[2], q=True, ws=True, t=True)
    cmds.xform(ikFootControl, ws=True, piv=piv)

    cmds.parent(ballikHandle[0], toeikHandle[0], legikHandle[0], ikFootControl)
    
    #---------- Making Pole Vector -------------#
    # Pole Vector controller ---> Sphere
    pvController = createSphere(nome= side+pvName+"_PV")

    findPoleVector(loc=pvController, targetHandle=legikHandle[0])

    cmds.addAttr(pvController, ln="Follow", k=1, r=1, min=0, max=1)
    cmds.addAttr(pvController, ln="Follow_Leg_Foot", k=1, r=1, min=0, max=1, dv=0.5)
    
    # Create attributes on ikController
    cmds.addAttr(ikFootControl, at="enum",enumName = "------", ln="Attributes", k=1, r=1)
    cmds.addAttr(ikFootControl, ln="Twist", k=1, r=1)
    cmds.addAttr(ikFootControl, ln="Lateral_Roll", k=1, r=1)
    for bone in ["Ankle", "Ball", "Toe_Tap"]:
        cmds.addAttr(ikFootControl, at="enum", enumName = "------", ln=bone, k=1, r=1)
        for coord in ["X", "Y", "Z"]:
            cmds.addAttr(ikFootControl, ln=bone+coord, k=1, r=1)

    # Parent ikController and PV under _rig_GRP
    cmds.parent(ikFootControlGrp, pvController + "_grp" ,rigGrp)
    
    # Set SDK visibility
    sdkDriver = switcherLoc[0] + ".FKIK_Mode"
    cmds.setAttr(sdkDriver, 0)
    cmds.setDrivenKeyframe(ikFootControlGrp + ".visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setAttr(sdkDriver, 1)
    cmds.setDrivenKeyframe(ikFootControlGrp + ".visibility", cd=sdkDriver, v=1, dv=1)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=1, dv=1)
예제 #3
0
def body(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=1,
                       p=[(3.3105, -4.6784, -10.4012), (3.3105, -4.6784,
                                                        8.4003),
                          (-3.3105, -4.6784, 8.4003),
                          (-3.3105, -4.6784, -10.4012),
                          (-13.9339, 7.1554, -14.1022),
                          (-13.9339, 7.1554, 13.2724),
                          (-3.3105, -4.6784, 8.4003),
                          (3.3105, -4.6784, 8.4003),
                          (13.9339, 7.1554, 13.2724),
                          (13.9339, 7.1554, -14.1022),
                          (3.3105, -4.6784, -10.4012),
                          (-3.3105, -4.6784, -10.4012),
                          (-13.9339, 7.1554, -14.1022),
                          (13.9339, 7.1554, -14.1022),
                          (11.8598, 12.1072, -12.3703),
                          (-11.8598, 12.1072, -12.3703),
                          (-13.9339, 7.1554, -14.1022),
                          (-13.9339, 7.1554, 13.2724),
                          (13.9339, 7.1554, 13.2724),
                          (11.8598, 12.1072, 11.5405),
                          (-11.8598, 12.1072, 11.5405),
                          (-13.9339, 7.1554, 13.2724),
                          (-13.9339, 7.1554, -14.1022),
                          (-11.8598, 12.1072, -12.3703),
                          (-11.8598, 12.1072, 11.5405),
                          (11.8598, 12.1072, 11.5405),
                          (11.8598, 12.1072, -12.3703)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #4
0
def setDrawOverrideColor( obj, color=17 ):
	"""
	edit the given object's shape node override color
	"""
	shapes = []
	if not cmd.objectType( obj, i='nurbsCurve' ) or not cmd.objectType( obj, i='nurbsSurface' ) or not cmd.objectType( obj, i='mesh' ):
		shapes.append( obj )
	for s in listRelatives( obj, s=True, pa=True ) or []:
		shapes.append( s )

        if shapes:
		for s in shapes:
			conns = cmd.listConnections( '%s.drawOverride' % s, s=True )
			if not conns:
				if not color == 0:
					cmd.setAttr ('%s.overrideEnabled' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideEnabled' % s, 1 )

					cmd.setAttr ('%s.overrideColor' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideColor' % s, color )
				else:
					cmd.color( s )

					cmd.setAttr ('%s.overrideColor' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideColor' % s, color )

					cmd.setAttr ('%s.overrideEnabled' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideEnabled' % s, 0 )
예제 #5
0
def createCircleControl(name=None, x=1, y=1, z=1, radius=1, color=None, type='strip', heightRatio=0.007):
    if not name:
        name = 'circle_CTRL'
    xform = cmds.group(name=name, em=1)
    circleShapes = []
    circleTransforms = []
    vectors = getAxisWorldVectors(xform)
    
    xyz = [x,y,z]
    for i in range(0, len(xyz)):
        if xyz[i]:
            circ = None
            if type == 'curve':
                circ = cmds.circle(radius=radius, name='jointMoverAxisCtrl', normal=vectors[i], sections=1, ch=0)
                if color:
                    cmds.color(circ, ud=color)
            if type == 'strip' or type == 'toroid':
                circ = None
                if type == 'strip':
                    circ = cmds.cylinder(radius=radius, name='jointMoverAxisCtrl', axis=vectors[i], sections=7, ch=0, heightRatio=heightRatio)
                elif type == 'toroid':
                    circ = cmds.torus(radius=radius, name='jointMoverAxisCtrl', axis=vectors[i], sections=7, ch=0, heightRatio=heightRatio)
                if color:
                    if color == 'xyz':
                        if i == 0: colorControl(circ, name='red_m', color=(1,0,0))
                        if i == 1: colorControl(circ, name='green_m', color=(0,1,0))
                        if i == 2: colorControl(circ, name='blue_m', color=(0,0,1))
                    else:
                        if len(color) == 3: colorControl(circ, color=color)
            circleShapes.append(cmds.listRelatives(circ[0], fullPath=1, shapes=1)[0])
            circleTransforms.append(circ[0])
    cmds.parent(circleShapes, xform, r=1, s=1)
    cmds.delete(circleTransforms)
    return xform
예제 #6
0
def findPoleVector(loc, targetHandle):

    # This func is kinda black magic
    # All credits to https://vimeo.com/66015036
    start = cmds.xform(ogChain[0], q=1, ws=1, t=1)
    mid = cmds.xform(ogChain[1], q=1, ws=1, t=1)
    end = cmds.xform(ogChain[2], q=1, ws=1, t=1)

    startV = om.MVector(start[0], start[1], start[2])
    midV = om.MVector(mid[0], mid[1], mid[2])
    endV = om.MVector(end[0], end[1], end[2])

    startEnd = endV - startV
    startMid = midV - startV

    dotP = startMid * startEnd
    proj = float(dotP) / float(startEnd.length())
    startEndN = startEnd.normal()
    projV = startEndN * proj

    arrowV = startMid - projV
    arrowV*= 10 #distance from joint
    finalV = arrowV + midV
    
    cmds.xform(loc, ws=1, t=(finalV.x, finalV.y ,finalV.z))

    locGrp = cmds.group(em=1, n=loc + "_grp")

    #snap, parent offsetGrp, set color and then make Constraint
    cmds.delete(cmds.pointConstraint(loc, locGrp))
    cmds.parent(loc, locGrp)
    cmds.makeIdentity(loc, a=1, t=1, r=1, s=1)
    cmds.color(loc, rgb=controllerColor)

    cmds.poleVectorConstraint(loc, targetHandle)
예제 #7
0
def createReverseFoot():
    joints = []
    mc.select(clear=True)
    #get pos of locators and add Joints to them
    for i in reverseFootL:
        print i
        pos = mc.pointPosition(i)
        print pos
        joints.append(mc.joint(p=pos, n=str(i), radius=0.75))
        mc.color(rgb=(1, 1, 1))

    RFL[:] = joints[:]

    #mc.parent(iklegL,RFL[3])
    joints[:] = []
    mc.select(clear=True)

    for i in reverseFootR:
        print i
        pos = mc.pointPosition(i)
        print pos
        joints.append(mc.joint(p=pos, n=str(i), radius=0.75))
        mc.color(rgb=(1, 1, 1))

    RFR[:] = joints[:]
    #mc.parent(iklegR, joints[3])
    mc.select(clear=True)
예제 #8
0
def onNodeNameChange():
    global selectedObject
    oldSelectedObject = selectedObject
    selectedObject = cmds.ls(selection=True)
    selectedObject = selectedObject[0]
    if(selectedObject.startswith('o_')):
        args = selectedObject[2:].split('_')
        print('args ' + str(len(args)))
        if(len(args) == 2):
            objname = args[0]
            className = args[1]
            
            oldargs = selectedObject[2:].split('_')
            if(len(oldargs) == 2):
                oldobjname = args[0]
                oldclassName = args[1]
                # delete old label
                if(cmds.objExists(oldobjname + '_label')):
                    cmds.delete(oldobjname + '_label')
            
            x = cmds.getAttr(selectedObject + '.translateX')
            y = cmds.getAttr(selectedObject + '.translateY')
            z = cmds.getAttr(selectedObject + '.translateZ')
            a = cmds.annotate(selectedObject, point=(x,y + 1,z), text=className)
            a = cmds.rename(a, objname + '_label')
            cmds.parent(a, selectedObject, shape=True)
            
            # color this object wireframe differently
            cmds.color(selectedObject, userDefined = 1)
            cmds.color(a, userDefined = 1)
            
            # After creating the annotation, it will be selected.
            # re-select the original object
            cmds.select(selectedObject)
예제 #9
0
def setDrawOverrideColor( obj, color=17 ):
	"""
	edit the given object's shape node override color
	"""
	shapes = []
	if not cmd.objectType( obj, i='nurbsCurve' ) or not cmd.objectType( obj, i='nurbsSurface' ) or not cmd.objectType( obj, i='mesh' ):
		shapes.append( obj )
	for s in listRelatives( obj, s=True, pa=True ) or []:
		shapes.append( s )

	if shapes:
		for s in shapes:
			conns = cmd.listConnections( '%s.drawOverride' % s, s=True )
			if not conns:
				if not color == 0:
					cmd.setAttr ('%s.overrideEnabled' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideEnabled' % s, 1 )

					cmd.setAttr ('%s.overrideColor' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideColor' % s, color )
				else:
					cmd.color( s )

					cmd.setAttr ('%s.overrideColor' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideColor' % s, color )

					cmd.setAttr ('%s.overrideEnabled' % s, e=True, l=False )
					cmd.setAttr ('%s.overrideEnabled' % s, 0 )


#end
예제 #10
0
            def set_color_reset(obj_to_set,
                                reset_overrides=False,
                                reset_wireframe=False,
                                reset_outliner=False):
                ''' Resets the color of the selected objects
                
                        Parameters:
                            obj_to_set (str): Name (path) of the object to affect.
                            reset_overrides (bool) : Reseting Overrides
                            reset_wireframe (bool) : Reseting Wireframe
                            reset_outliner (bool) : Reseting Outliner
                
                '''
                if reset_overrides:
                    using_override = cmds.getAttr(obj_to_set +
                                                  '.overrideEnabled')
                    if using_override:
                        cmds.setAttr(obj_to_set + '.overrideEnabled', 0)
                        cmds.setAttr(obj_to_set + '.overrideColorR', 0)
                        cmds.setAttr(obj_to_set + '.overrideColorG', 0)
                        cmds.setAttr(obj_to_set + '.overrideColorB', 0)

                if reset_wireframe:
                    using_wireframe = cmds.getAttr(obj_to_set +
                                                   '.useObjectColor')
                    if using_wireframe != 0:
                        cmds.color(obj_to_set)

                if reset_outliner:
                    try:
                        cmds.setAttr(obj_to_set + '.useOutlinerColor', 0)
                    except:
                        pass
                return 1
예제 #11
0
def clavSel(scaleClav):

    # Select clavicle Joint moving up and put it at the top of the chain
    clavJoint = cmds.pickWalk(ogChain[0], d="up")[0]
    #ogChain.insert(0, clavJoint)

    clavController = createClav2(clavJoint + "_anim") # Import coordinates from ctrlUI_lib
    cmds.delete(cmds.pointConstraint(clavJoint, clavController))

    # Create offset group, FDH and move up 
    clavControllerGrp = cmds.group(n=clavController + "_grp", em=1)
    cmds.delete(cmds.parentConstraint(clavJoint, clavControllerGrp))
    cmds.parent(clavController, clavControllerGrp)
    fixedScale = scaleClav/4
    cmds.scale(fixedScale, fixedScale, fixedScale, clavController)
    cmds.makeIdentity(clavController, a=1)
    cmds.move(0,10,0, clavControllerGrp, ws=1, r=1)
    cmds.color(clavController, rgb=controllerColor)
    
    # Move pivots on clavicle joint
    piv = cmds.xform(clavJoint, q=True, ws=True, t=True)
    cmds.xform(clavController, ws=True, piv=piv)
    cmds.xform(clavControllerGrp, ws=True, piv=piv)
    
    cmds.orientConstraint(clavController, clavJoint)

    # Parent ik and fk chain under clavicle controller    
    cmds.parent((ogChain[0]+"_fk_anim_grp"),(ogChain[0] + "_ik"), (ogChain[0] + "_fk"), clavController)

    cmds.parent(clavControllerGrp, ctrlGrp)
예제 #12
0
def square(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=1,
                       p=[(-0.5, 0.0, 0.5), (0.5, 0.0, 0.5), (0.5, 0.0, -0.5),
                          (-0.5, 0.0, -0.5), (-0.5, 0.0, 0.5)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #13
0
def setUserColor(inObjName, userColor=None):
    """
    @param inObjName: String. Name of object.
    @param userColor: Int. 1-8. User defined color to use.
    """
    if userColor is not None:
        cmds.color(inObjName, userDefined=userColor)
    else:
        cmds.color(inObjName)
예제 #14
0
def quarterSphere(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=1,
                       p=[(0.0, 3.0, 0.0), (2.0, 2.0, 0.0), (3.0, -0.0, 0.0),
                          (2.0, -0.0, 2.0), (0.0, -0.0, 3.0), (0.0, 2.0, 2.0),
                          (0.0, 3.0, 0.0), (0.0, 2.0, -2.0), (0.0, -0.0, -3.0),
                          (2.0, -0.0, -2.0), (3.0, -0.0, 0.0)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #15
0
def arrow(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=1,
                       p=[(0, 0.6724194, 0.4034517), (0, 0, 0.4034517),
                          (0, 0, 0.6724194), (0, -0.4034517, 0),
                          (0, 0, -0.6724194), (0, 0, -0.4034517),
                          (0, 0.6724194, -0.4034517),
                          (0, 0.6724194, 0.4034517)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #16
0
def assignDefaultShader():

    global switch
    activeModel = cmds.getPanel(wf=True)
    cmds.modelEditor(activeModel, e=True, udm=0)
    cmds.displayRGBColor( 'background', 0.61, 0.61, 0.61 )
    cmds.setAttr('lambert1.color', 0.5, 0.5, 0.5, type="double3")
    cmds.setAttr('lambert1.diffuse', 0.5)
    for node in cmds.ls(sl=True):
        cmds.color() # assign default wireframes
    switch = 1
예제 #17
0
def mirrorJoints():
    sel = cmds.ls(sl=True)  #joint selection
    for j in sel:  #loop through selected joints
        mj = cmds.mirrorJoint(j, mirrorYZ=True, searchReplace=["_R", "_L"])
        #mirror the joint
        mj = mj[0]  #redefine result as string using the first object
        ry = cmds.getAttr("%s.rotateY" % mj)  #get rotate Y
        rz = cmds.getAttr("%s.rotateZ" % mj)  #get rotate Z
        cmds.setAttr("%s.rotateY" % mj, ry * -1)  #correct Y rotation
        cmds.setAttr("%s.rotateZ" % mj, rz * -1)  #correct Z rotation
        cmds.setAttr("%s.side" % mj, 1)  #set joint label side to "Left"
        cmds.color(mj, ud=6)  #change joint colour
예제 #18
0
def cross(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=1,
                       p=[(1.0, 0.0, -1.0), (2.0, 0.0, -1.0), (2.0, 0.0, 1.0),
                          (1.0, 0.0, 1.0), (1.0, 0.0, 2.0), (-1.0, 0.0, 2.0),
                          (-1.0, 0.0, 1.0), (-2.0, 0.0, 1.0),
                          (-2.0, 0.0, -1.0), (-1.0, 0.0, -1.0),
                          (-1.0, 0.0, -2.0), (1.0, 0.0, -2.0),
                          (1.0, 0.0, -1.0)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #19
0
def capsule(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=3,
                       p=[(0.0, 0.0, -1.0), (-1.7313, 0.0, -1.0),
                          (-2.0923, 0.0, -1.0), (-2.8645, 0.0, 0.0),
                          (-2.0923, 0.0, 1.0), (-1.7313, 0.0, 1.0),
                          (1.7313, 0.0, 1.0), (2.0923, 0.0, 1.0),
                          (2.8645, 0.0, 0.0), (2.0923, 0.0, -1.0),
                          (1.7313, 0.0, -1.0), (0.0, 0.0, -1.0)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #20
0
def armIk(armIkScale, armikHandle, pvName):

    ikHandJoint = cmds.joint(n=side + "hand_ik")
    cmds.delete(cmds.parentConstraint(ogChain[2] + "_ik", ikHandJoint))
    cmds.makeIdentity(ikHandJoint, a = 1, t = 1, r = 1, s = 0)
    if side == "l_":
        cmds.move(10,0,0, ikHandJoint, r=1, os=1)
    else:
        cmds.move(-10,0,0, ikHandJoint, r=1, os=1)
    cmds.parent(ikHandJoint, ogChain[2] + "_ik")
    handikHandle = cmds.ikHandle(sj=ogChain[2] + "_ik", ee=ikHandJoint, n=side + "hand_ikHandle", sol="ikSCsolver")
    cmds.parent(handikHandle[0], armikHandle[0])
    
    #create IK controller ---> CUBE
    crvIkCube = cmds.curve(d=1, p=[(-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (0.5, 0.5, 0.5),
                                    (-0.5, 0.5, 0.5), (-0.5, -0.5, 0.5), (-0.5, -0.5, -0.5),
                                    (-0.5, 0.5, -0.5), (-0.5, 0.5, 0.5), (-0.5, -0.5, 0.5),
                                    (0.5, -0.5, 0.5), (0.5, 0.5, 0.5), (0.5, 0.5, -0.5),
                                    (0.5, -0.5, -0.5), (0.5, -0.5, 0.5), (0.5, -0.5, -0.5), (-0.5, -0.5, -0.5)], 
                                    k=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5], n=side + "hand_ik_anim" )

    # Rename shape node                 
    shapeList = cmds.listRelatives(crvIkCube, s = True)
    cmds.rename(shapeList, crvIkCube + "Shape")
    
    crvIkCubeGrp = cmds.group(n=crvIkCube + "_grp")
    cmds.delete(cmds.parentConstraint(ogChain[2] + "_ik", crvIkCubeGrp))

    cmds.color(crvIkCube, rgb=controllerColor)
    cmds.scale(armIkScale, armIkScale, armIkScale, crvIkCubeGrp)

    cmds.parent(armikHandle[0], crvIkCube)

    pvController = createSphere(nome= side+pvName+"_PV")

    findPoleVector(loc=pvController, targetHandle=armikHandle[0])

    cmds.addAttr(pvController, at="enum", enumName = "------", ln="Attributes", k=1, r=1)
    cmds.addAttr(pvController, ln="Follow", k=1, r=1, min=0, max=1)
    cmds.addAttr(pvController, ln="Follow_Clav_Hand", k=1, r=1, min=0, max=1, dv=0.5)

    # Parent ikController and PV under _rig_GRP
    cmds.parent(crvIkCubeGrp, pvController + "_grp" ,rigGrp)
    
    #set SDK visibility
    sdkDriver = switcherLoc[0] + ".FKIK_Mode"
    cmds.setAttr(sdkDriver, 0)
    cmds.setDrivenKeyframe(crvIkCubeGrp + ".visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=0, dv=0)
    cmds.setAttr(sdkDriver, 1)
    cmds.setDrivenKeyframe(crvIkCubeGrp + ".visibility", cd=sdkDriver, v=1, dv=1)
    cmds.setDrivenKeyframe(pvController + "_grp.visibility", cd=sdkDriver, v=1, dv=1)
예제 #21
0
def fkControllerCreator(fkSize, legOrArm):
    
    orientController = cmds.optionMenu("UI_orientControllerMenu", q=1, v=1)

    # Create controllers and group offsets
    # Change rotation, color
    for y in range(chainLen):
        anim_group = cmds.group(em=1, n=ogChain[y] + "_fk_anim_grp")
        fk_controller = cmds.circle(n=ogChain[y] + "_fk_anim")[0] # If not [0] it'll warn some stuff related to Maya underworld

        # Set scale 
        cmds.scale(fkSize, fkSize, fkSize, fk_controller)
            
        cmds.matchTransform(anim_group, ogChain[y])
        cmds.delete(cmds.parentConstraint(ogChain[y], fk_controller))
        cmds.parent(fk_controller, anim_group)

        # Set controller orientation based on second axis 
        if orientController == "x": cmds.rotate(90,0,0, fk_controller)
        if orientController == "y": cmds.rotate(0,90,0, fk_controller)
        if orientController == "z": cmds.rotate(0,0,90, fk_controller)
        
        # Freeze transform, delete history and set color
        cmds.makeIdentity(fk_controller, a = 1, t = 1, r = 1, s = 0)
        cmds.delete(fk_controller, ch = 1)
        cmds.color(fk_controller, rgb=controllerColor)
        
        # Set SDK visibility
        sdkDriver = switcherLoc[0] + ".FKIK_Mode"
        cmds.setAttr(sdkDriver, 1)
        cmds.setDrivenKeyframe(ogChain[0] + "_fk_anim_grp.visibility", cd=sdkDriver, v=1, dv=0)
        cmds.setAttr(sdkDriver, 0)
        cmds.setDrivenKeyframe(ogChain[0] + "_fk_anim_grp.visibility", cd=sdkDriver, v=0, dv=1)

        # Lock .t and .s attributes
        #for x in ["X", "Y", "Z"]:
            #cmds.setAttr(fk_controller + ".translate" + x, k=0, l=1)
            #cmds.setAttr(fk_controller + ".scale" + x, k=0, l=1)

    # Create ordered hierarchy
    for x in reversed(range(chainLen)):
        if x == 0:
            continue
        cmds.parent(ogChain[x] + "_fk_anim_grp", ogChain[x-1] + "_fk_anim")

    # Set orientConstraint _anim controllers with _fk hierarchy
    for x in range(chainLen):
        cmds.parentConstraint(ogChain[x] + "_fk_anim", ogChain[x] + "_fk")
        # If leg chain is selected delete toe controller, else not
        if legOrArm == "Leg":
            if x == (chainLen-1):
                cmds.delete(ogChain[chainLen-1] + "_fk_anim_grp")
예제 #22
0
	def C (self):
		if self.getType(0) == 'locator' or self.getType(0)[0] == 'camera':
			cmds.color(ud = 2)
		elif self.getType(0) == 'face' or self.getType(0) == 'mesh':
			self.splitFaceTool()
		else:
			if Cache.currentCategory == 'frostbite':
				Cache.currentTool = ''
				self.cameraTool(Cache.currentCategory)
			else:
				Cache.currentTool = ''
				self.cameraTool() # just creates a normal camera, nothing special inside
		self.updateToolHUD()
예제 #23
0
def assignBlackShader():

    global switch
    activeModel = cmds.getPanel(wf=True)
    cmds.modelEditor(activeModel, e=True, udm=1)
    cmds.displayRGBColor( 'background', 0, 0, 0 )
    cmds.setAttr('lambert1.color', 0, 0, 0, type="double3")
    cmds.setAttr('lambert1.diffuse', 0)
    cmds.displayRGBColor('userDefined1', 1 ,1 ,1 )

    for node in cmds.ls(sl = True):
        cmds.color(ud = 1) # assign white wireframes
    switch = 1
예제 #24
0
def picker(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=3,
                       p=[(-0.0, 0.0, 0.0), (-0.0, 0.6819, 0.0),
                          (-0.0001, 1.4198, 0.0), (-0.0001, 1.9465, 0.0),
                          (0.2888, 1.9382, 0.0), (0.766, 2.0937, 0.0),
                          (1.307, 2.6237, 0.0), (1.4351, 3.5862, -0.0287),
                          (0.3997, 4.6077, -0.2737), (-1.2274, 4.0054, -0.178),
                          (-0.9735, 2.4797, 0.2067), (0.111, 2.442, 0.3148),
                          (0.4157, 3.0141, 0.3105), (0.2284, 3.3932, 0.2834),
                          (0.0, 3.4611, 0.2782)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #25
0
 def onEnter(self):
     cmds.undoInfo(openChunk=True)
     self.anns = []
     sel = cmds.ls(selection=True, flatten=True)
     for alpha, name in zip(
             "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
             self.transforms):
         print alpha, name
         ann = cmds.annotate(name, tx=alpha, point=wspos(name))
         cmds.color(ann, rgbColor=(1, 1, 1))
         self.anns.append(ann)
         self.keymap[(alpha, NOALT, NOCTRL,
                      PRESS)] = ("RUN", self.toggleSelection(name))
     cmds.select(sel)
예제 #26
0
 def C(self):
     if self.getType(0) == 'locator' or self.getType(0)[0] == 'camera':
         cmds.color(ud=2)
     elif self.getType(0) == 'face' or self.getType(0) == 'mesh':
         self.splitFaceTool()
     else:
         if Cache.currentCategory == 'frostbite':
             Cache.currentTool = ''
             self.cameraTool(Cache.currentCategory)
         else:
             Cache.currentTool = ''
             self.cameraTool(
             )  # just creates a normal camera, nothing special inside
     self.updateToolHUD()
예제 #27
0
	def cameraTool(self, category = 'NA'):
		if category == 'frostbite':
			frostbiteCam = cmds.camera(dr = 1, dgm = 1, ncp = .1, fcp = 10000 )
			cmds.addAttr( frostbiteCam [0], longName = 'isCamera', attributeType = 'bool' )
			cmds.setAttr( str(frostbiteCam [0]) + '.horizontalFilmAperture',  1.4173228346472 )
			cmds.setAttr( str(frostbiteCam [0]) + '.verticalFilmAperture', 0.79724409448905 )
			cmds.setAttr( str(frostbiteCam [0]) + ".isCamera", True )
			cmds.addAttr( longName = 'animPath', dataType = 'string' )
			cmds.setAttr( str(frostbiteCam [0]) + ".animPath" , type = 'string' )
			cmds.addAttr( frostbiteCam [0], longName = 'FOV' )
			cmds.setAttr( str(frostbiteCam [0]) +'.FOV', keyable = True )
			cmds.color( frostbiteCam[0], ud=2 )
		elif category == 'NA':
			cmds.camera(dr = 1, dgm = 1, ncp = .01, fcp = 10000 )
		self.setAttributes()
def maketwistJoints(baseRig, parentJoints):

    twistJointsMainGrp = mc.group(n='twistJoints_grp',
                                  p=baseRig.jointsGrp,
                                  em=1)

    for parentJnt in parentJoints:

        prefix = name.removeSuffix(parentJnt)
        prefix = prefix[:-1]
        parentJntChild = mc.listRelatives(parentJnt, c=1, type='joint')[0]

        # make twist joints

        twistJntGrp = mc.group(n=prefix + 'TwistJoint_grp',
                               p=twistJointsMainGrp,
                               em=1)

        twistParentJnt = mc.duplicate(parentJnt,
                                      n=prefix + 'Twist1_jnt',
                                      parentOnly=True)[0]
        twistChildJnt = mc.duplicate(parentJntChild,
                                     n=prefix + 'Twist2_jnt',
                                     parentOnly=True)[0]

        # adjust twist joints

        origJntRadius = mc.getAttr(parentJnt + '.radius')

        for j in [twistParentJnt, twistChildJnt]:

            mc.setAttr(j + '.radius', origJntRadius * 2)
            mc.color(j, ud=1)

        mc.parent(twistChildJnt, twistParentJnt)
        mc.parent(twistParentJnt, twistJntGrp)

        # attach twist joints
        mc.pointConstraint(parentJnt, twistParentJnt)

        # make IK handle
        twistIk = mc.ikHandle(n=prefix + 'TwistJoint_ikh',
                              sol='ikSCsolver',
                              sj=twistParentJnt,
                              ee=twistChildJnt)[0]
        mc.hide(twistIk)
        mc.parent(twistIk, twistJntGrp)
        mc.parentConstraint(parentJntChild, twistIk)
예제 #29
0
def maketwistJoints(baseRig, parentJoints):

    twistJointsMainGrp = cmds.group(n='twistJoints_grp',
                                    p=baseRig.jointGrp,
                                    em=1)

    for parentJnt in parentJoints:
        prefix = name.removeSuffix(parentJnt)

        # remove the number in prefix
        prefix = prefix[:-1]

        parentjntChild = cmds.listRelatives(parentJnt, c=1, type='joint')[0]

        # make twist joints
        twistJntGrp = cmds.group(n=prefix + 'twistJoint_grp',
                                 p=twistJointsMainGrp,
                                 em=1)

        twistParentJnt = cmds.duplicate(parentJnt,
                                        n=prefix + 'Twist1_jnt',
                                        parentOnly=1)[0]
        twistChildJnt = cmds.duplicate(parentjntChild,
                                       n=prefix + 'Twist2_jnt',
                                       parentOnly=1)[0]

        # adjust twist joints

        origJntRadius = cmds.getAttr(parentJnt + '.radius')
        for j in [twistParentJnt, twistChildJnt]:
            cmds.setAttr(j + '.radius', origJntRadius * 2)
            cmds.color(j, ud=1)

        cmds.parent(twistChildJnt, twistParentJnt)
        cmds.parent(twistParentJnt, twistJntGrp)

        #attach twist joints
        cmds.pointConstraint(parentJnt, twistParentJnt)

        #make IK handle
        twistIK = cmds.ikHandle(n=prefix + 'TwistJoint_ikh',
                                solver='ikSCsolver',
                                startJoint=twistParentJnt,
                                endEffector=twistChildJnt)[0]

        cmds.hide(twistIK)
        cmds.parent(twistIK, twistJntGrp)
        cmds.parentConstraint(parentjntChild, twistIK)
예제 #30
0
 def set_color_wireframe_tool(obj_to_set):
     ''' 
     Uses wireframe color to set the color of an object 
     
             Parameters:
                 obj_to_set (str): Name (path) of the object to affect.
     
     '''
     using_override = cmds.getAttr(obj_to_set + '.overrideEnabled')
     if using_override:
         cmds.setAttr(obj_to_set + '.overrideEnabled', 0)
         cmds.setAttr(obj_to_set + '.overrideColorR', 0)
         cmds.setAttr(obj_to_set + '.overrideColorG', 0)
         cmds.setAttr(obj_to_set + '.overrideColorB', 0)
     cmds.color(obj_to_set, rgb=(color[0], color[1], color[2]))
     return 1
예제 #31
0
            def set_color_drawing_override(obj_to_set):
                ''' 
                Uses drawing override settings to set the color of an object 

                        Parameters:
                            obj_to_set (str): Name (path) of the object to affect.
                
                '''
                using_wireframe = cmds.getAttr(obj_to_set + '.useObjectColor')
                if using_wireframe != 0:
                    cmds.color(obj_to_set)
                cmds.setAttr(obj_to_set + '.overrideEnabled', 1)
                cmds.setAttr(obj_to_set + '.overrideRGBColors', 1)
                cmds.setAttr(obj_to_set + '.overrideColorR', color[0])
                cmds.setAttr(obj_to_set + '.overrideColorG', color[1])
                cmds.setAttr(obj_to_set + '.overrideColorB', color[2])
                return 1
예제 #32
0
def recolorCtrls(startColor, endColor, ctrls):

    colorDiff = [
        endColor[0] - startColor[0], endColor[1] - startColor[1],
        endColor[2] - startColor[2]
    ]
    numCtrls = len(ctrls)

    for i, ctrl in enumerate(ctrls):

        # Interpolate color
        color = [
            startColor[0] + (float(i) / (numCtrls - 1)) * colorDiff[0],
            startColor[1] + (float(i) / (numCtrls - 1)) * colorDiff[1],
            startColor[2] + (float(i) / (numCtrls - 1)) * colorDiff[2]
        ]
        cmds.color(ctrl, rgbColor=color)
예제 #33
0
def clavicle(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(
        d=3,
        p=[(7.7788, 0.0034, -4.2633), (7.848, 1.0358, -4.2256),
           (7.7465, 3.1819, -4.0488), (6.4843, 6.008, -3.6314),
           (3.7945, 7.9684, -3.2352), (-0.0, 8.6689, -3.0743),
           (-3.7945, 7.9684, -3.2352), (-6.4843, 6.008, -3.6314),
           (-7.7044, 3.2761, -4.0349), (-7.8429, 1.1431, -4.2167),
           (-7.78, 0.003, -4.2638), (-8.2031, 1.156, -4.2063),
           (-9.0875, 3.5917, -3.6243), (-8.8303, 7.2756, -1.9342),
           (-5.3856, 10.2978, -0.094), (-0.0, 11.4494, 0.6819),
           (5.3856, 10.2978, -0.094), (8.8303, 7.2756, -1.9342),
           (9.0964, 3.4647, -3.6826), (8.1561, 1.0344, -4.2339),
           (7.7788, 0.0034, -4.2633)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #34
0
def heart(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=3,
                       p=[(-0.0, -0.5189, 1.1962), (-0.1075, -0.1769, 1.1447),
                          (-0.3128, 0.0787, 1.0075), (-0.5663, 0.3427, 0.568),
                          (-0.7241, 0.5189, 0.0414), (-0.7627, 0.4718,
                                                      -0.8194),
                          (-0.5773, 0.0921, -1.1727), (-0.3232, 0.11, -1.1962),
                          (-0.1807, 0.4583, -0.4181),
                          (-0.1739, 0.1599, 0.3782), (0.0, -0.1892, 0.632),
                          (0.1739, 0.1599, 0.3782), (0.1807, 0.4583, -0.4181),
                          (0.3232, 0.11, -1.1962), (0.5773, 0.0921, -1.1727),
                          (0.7627, 0.4718, -0.8194), (0.7241, 0.5189, 0.0414),
                          (0.5663, 0.3427, 0.568), (0.3128, 0.0787, 1.0075),
                          (0.1075, -0.1769, 1.1447), (-0.0, -0.5189, 1.1962)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #35
0
def circleArrow(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=3,
                       p=[(0.0, 0.0, 72.8198), (3.3333, 0.0, 69.6114),
                          (6.6667, 0.0, 66.4031), (10.0, 0.0, 63.1947),
                          (13.3333, 0.0, 59.9864), (16.6667, 0.0, 56.778),
                          (20.0, 0.0, 53.5697), (23.3333, 0.0, 50.3613),
                          (26.6667, 0.0, 47.153), (30.0, 0.0, 43.9446),
                          (28.8889, 0.0, 43.9446), (27.7778, 0.0, 43.9446),
                          (26.6667, 0.0, 43.9446), (25.5556, 0.0, 43.9446),
                          (24.4444, 0.0, 43.9446), (23.3333, 0.0, 43.9446),
                          (22.2222, 0.0, 43.9446), (21.1111, 0.0, 43.9446),
                          (20.0, 0.0, 43.9446), (20.0, 0.0, 42.9109),
                          (20.0, 0.0, 41.8772), (20.0, 0.0, 40.8434),
                          (20.0, 0.0, 39.8097), (20.0, 0.0, 38.776),
                          (20.0, 0.0, 37.7422), (20.0, 0.0, 36.7085),
                          (20.0, 0.0, 35.6748), (20.0, 0.0, 34.641),
                          (24.0303, 0.0, 32.3141), (31.2704, 0.0, 26.239),
                          (38.3588, 0.0, 13.9615), (40.8206, 0.0, 0.0),
                          (38.3588, 0.0, -13.9615), (31.2704, -0.0, -26.239),
                          (20.4103, -0.0, -35.3517), (7.0884, -0.0, -40.2004),
                          (-7.0884, -0.0, -40.2004), (-20.4103, -0.0,
                                                      -35.3517),
                          (-31.2704, -0.0, -26.239),
                          (-38.3588, -0.0, -13.9615), (-40.8206, -0.0, -0.0),
                          (-38.3588, -0.0, 13.9615), (-31.5067, 0.0, 25.8297),
                          (-24.3923, 0.0, 32.0103), (-20.0041, 0.0, 34.6481),
                          (-20.0, 0.0, 35.7781), (-20.0, 0.0, 36.8119),
                          (-20.0, 0.0, 37.7422), (-20.0, 0.0, 38.776),
                          (-20.0, 0.0, 39.8097), (-20.0, 0.0, 40.8434),
                          (-20.0, 0.0, 41.8772), (-20.0, 0.0, 42.9109),
                          (-20.0, 0.0, 43.9446), (-21.1111, 0.0, 43.9446),
                          (-22.2222, 0.0, 43.9446), (-23.3333, 0.0, 43.9446),
                          (-24.4444, 0.0, 43.9446), (-25.5556, 0.0, 43.9446),
                          (-26.6667, 0.0, 43.9446), (-27.7778, 0.0, 43.9446),
                          (-28.8889, 0.0, 43.9446), (-30.0, 0.0, 43.9446),
                          (-26.6667, 0.0, 47.153), (-23.3333, 0.0, 50.3613),
                          (-20.0, 0.0, 53.5697), (-16.6667, 0.0, 56.778),
                          (-13.3333, 0.0, 59.9864), (-10.0, 0.0, 63.1947),
                          (-6.6667, 0.0, 66.4031), (-3.3333, 0.0, 69.6114),
                          (0.0, 0.0, 72.8198)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
예제 #36
0
def createFkControls(fkJoint, jointNameSuffix):

    fkControl = createControlSphere(0.5)
    fkControl = cmds.rename(fkControl, fkJoint.replace(jointNameSuffix,
                                                       '_CTRL'))

    # Color handling
    if fkControl.startswith('LF'):
        cmds.color(fkControl, rgb=(0, 0, 1))
    elif fkControl.startswith('RT'):
        cmds.color(fkControl, rgb=(1, 0, 0))

    # Lock translation and scale
    cmds.setAttr(fkControl + '.tx', lock=1, keyable=0)
    cmds.setAttr(fkControl + '.ty', lock=1, keyable=0)
    cmds.setAttr(fkControl + '.tz', lock=1, keyable=0)
    cmds.setAttr(fkControl + '.sx', lock=1, keyable=0)
    cmds.setAttr(fkControl + '.sy', lock=1, keyable=0)
    cmds.setAttr(fkControl + '.sz', lock=1, keyable=0)

    # Create group node
    grp = cmds.group(fkControl, name=fkControl.replace('_CTRL', '_GRP'))
    cmds.matchTransform(grp, fkJoint)

    # Constrain joint to control
    cmds.parentConstraint(fkControl, fkJoint, maintainOffset=1)

    fkChildren = cmds.listRelatives(fkJoint, children=1)
    if fkChildren is not None:

        numChildJoints = 0

        for fkChild in fkChildren:
            if cmds.objectType(fkChild) == 'joint':
                numChildJoints += 1

        if numChildJoints == 1:
            fkChildGrp = createFkControls(fkChildren[0], jointNameSuffix)
            if fkChildGrp is not None:
                cmds.parent(fkChildGrp, fkControl)

    return grp
예제 #37
0
def tearDrop(color=1):
    sel = cmds.ls(sl=1)
    shape = cmds.curve(d=3,
                       p=[(-0.0, -4.1153, 8.4438), (1.6329, -2.5612, 8.5338),
                          (4.7501, -1.3951, 7.1464), (8.6014, -0.3202, 5.1091),
                          (10.9967, 0.1603, 2.4053), (11.5838, 0.4597,
                                                      -0.6703),
                          (10.9968, 0.9566, -3.7118), (9.3077, 1.61, -6.388),
                          (6.7151, 2.2914, -8.4414), (3.5039, 2.8148, -9.7176),
                          (-0.0, 3.012, -10.1481), (-3.5039, 2.8148, -9.7176),
                          (-6.7151, 2.2914, -8.4414), (-9.3077, 1.61, -6.388),
                          (-10.9968, 0.9566, -3.7118),
                          (-11.5838, 0.4597, -0.6703),
                          (-10.9967, 0.1603, 2.4053), (-8.6014, -0.3202,
                                                       5.1091),
                          (-4.7501, -1.3951, 7.1464),
                          (-1.6329, -2.5612, 8.5338), (-0.0, -4.1153, 8.4438)])
    cmds.color(shape, ud=color)
    alignAtoB(shape, sel)
    return shape
def make_twist_jnts(base_rig, parent_jnts):
    twist_jnts_main_grp = cmds.group(n='twist_joints_bnd_grp',
                                     p=base_rig.jnt_grp,
                                     em=True)
    for parent_jnt in parent_jnts:
        prefix = name.remove_suffix(parent_jnt)
        parent_jnt_child = cmds.listRelatives(parent_jnt, c=True,
                                              type='joint')[0]

        #make twist joints
        twist_jnt_grp = cmds.group(n=prefix + '_twist_jnt',
                                   p=twist_jnts_main_grp,
                                   em=1)

        twist_parent_jnt = cmds.duplicate(parent_jnt,
                                          n=prefix + 'twistjnt_01',
                                          parentOnly=True)[0]
        twist_child_jnt = cmds.duplicate(parent_jnt_child,
                                         n=prefix + 'twistjnt_02',
                                         parentOnly=True)[0]

        #adjust twist joints
        orig_jnt_radius = cmds.getAttr(parent_jnt + '.radius')
        for j in [twist_parent_jnt, twist_child_jnt]:
            cmds.setAttr(j + '.radius', orig_jnt_radius * 2)
            cmds.color(j, ud=1)

        cmds.parent(twist_child_jnt, twist_parent_jnt)
        cmds.parent(twist_parent_jnt, twist_jnt_grp)

        #attach twist joints
        cmds.pointConstraint(parent_jnt, twist_parent_jnt)

        #make IK handle
        twist_ik = cmds.ikHandle(n=prefix + 'twist_jnt_ikhandle',
                                 sol='ikSCsolver',
                                 sj=twist_parent_jnt,
                                 ee=twist_child_jnt)[0]
        cmds.hide(twist_ik)
        cmds.parent(twist_ik, twist_jnt_grp)
        cmds.parentConstraint(parent_jnt_child, twist_ik)
for ctrl in range(3):
    
    newCtrl = mc.circle(n=ctrlNames[inc], r = 3000)    
    mc.rotate('90deg', 0, 0, r=True )
    mc.move(0, 1500, 0)
    
    inc = inc + 1

#adjust the scale

mc.setAttr("makeNurbCircle2.radius", 3440)
mc.setAttr("makeNurbCircle3.radius", 3880)
    
#change colour of the control rings

mc.color("c_ForegroundMatte", rgb=(1, 0.5, 0.5))
mc.color("c_MidgroundMatte",  rgb=(1, 0.5, 1))
mc.color("c_BackgroundMatte", rgb=(0, 1, 2))

#create a square control
mc.circle(n="POS", nr = (0,1,0,), d = 1, s=4, r = 1)
mc.scale(7876, 7876, 7876, "POS")
mc.rotate(0, "45deg", 0,  "POS")

# select backgrounds and the controls
mc.select(matteNames, ctrlNames, "POS", r=True )
#freeze transformations
mc.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
#delete history
mc.bakePartialHistory(matteNames, ctrlNames, "POS", prePostDeformers=True)
# clear selection