Exemplo n.º 1
0
def annotation(*args):
	# select the joint, then the poleVec control

	sel = cmds.ls(sl=1)

	loc_1 = cmds.spaceLocator()
	loc_2 = cmds.spaceLocator()

	cmds.parentConstraint(sel[0], loc_1)
	cmds.parentConstraint(sel[1], loc_2)

	anno = cmds.annotate(loc_1, tx='', p=[0,0,0])

	anno_grp = cmds.group(anno)
	   
	cmds.parent(anno_grp, loc_2)

	cmds.xform(t=(0,0,0))

	cmds.group(loc_1, loc_2, n='annotation_grp_0#')

	cmds.select(cl=1)

	for obj in loc_1:
		shapeNodes=cmds.listRelatives(obj, shapes=1)
		for shape in shapeNodes:
			# locator visability
			cmds.setAttr("{0}.visibility".format(shape), 0)

	for obj in loc_2:
		shapeNodes=cmds.listRelatives(obj, shapes=1)
		for shape in shapeNodes:
			# locator visability
			cmds.setAttr("{0}.visibility".format(shape), 0)
Exemplo n.º 2
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)
Exemplo n.º 3
0
 def __init__(s, obj, text):
     """ Create annotation """
     ann_shape = cmds.annotate(obj, tx=text)
     s.trans = cmds.listRelatives(ann_shape, p=True, pa=True)[0]
     for a in ("t", "r", "s"):
         for b in ("x", "y", "z"):
             cmds.setAttr(s._attr(a, b), k=False, cb=False)
Exemplo n.º 4
0
	def createPreview(self, name, tiles=(100,100)):
		""" Generate preview plane from terrain data.
		"""
		# Check dimensions
		if not self.checkDimensions():
			return False

		# Initialise progress bar and start timer
		mc.progressBar(self.gMainProgressBar, edit=True, beginProgress=True, isInterruptable=True, maxValue=tiles[0]*tiles[1]) # Initialise progress bar
		startTime = time.time()

		# Delete preview plane if it already exists
		planeName = "%s_previewPlane" %name
		if mc.objExists(planeName):
			mc.delete(planeName)

		# Create preview plane with annotation
		size = (self.size[0]+self.res, self.size[1]+self.res)
		plane = mc.polyPlane(n=planeName, w=size[0], h=size[1], sx=tiles[0], sy=tiles[1], ax=[0,0,1], cuv=1, ch=0)

		annotationShape = mc.annotate(plane, tx=name, p=(0,0,0))
		annotation = mc.listRelatives(annotationShape, parent=True)
		mc.setAttr(annotationShape+".displayArrow", 0)
		mc.parent(annotation, plane[0], relative=True)
		mc.rename(annotation, "%s_annotation" %name)

		mc.xform(plane[0], t=(size[0]/2, size[1]/2, 0))
		mc.makeIdentity(plane[0], apply=True)
		mc.xform(plane[0], rotatePivot=(0,0,0), scalePivot=(0,0,0))
		mc.xform(plane[0], t=(self.offset[0], self.offset[1], 0))

		#mc.setAttr(plane[0]+".template", True)
		mc.setAttr(plane[0]+".t", lock=True)
		mc.setAttr(plane[0]+".r", lock=True)
		mc.setAttr(plane[0]+".s", lock=True)

		vtxID = 0

		for j in range(tiles[1]+1):
			for i in range(tiles[0]+1):

				# Progress bar
				if mc.progressBar(self.gMainProgressBar, query=True, isCancelled=True): # Cancel operation if esc key pressed
					mc.progressBar(self.gMainProgressBar, edit=True, endProgress=True) # Complete progress bar
					mc.warning("Terrain generation cancelled when partially completed. You may wish to undo.")
					return False
				else:
					mc.progressBar(self.gMainProgressBar, edit=True, step=1, status="Generating preview...") # Increment progress bar

					vtxX, vtxY, vtxZ = mc.pointPosition("%s.vtx[%d]" %(plane[0], vtxID), world=True)
					x, y = self.getArrID((vtxX, vtxY))
					z = self.data[min(x, self.dim[0]-1)][min(y, self.dim[1]-1)]
					mc.xform("%s.vtx[%d]" %(plane[0], vtxID), t=(0,0,z), relative=True) #, worldSpace=True) # Test in local space
					vtxID += 1

		# Complete progress bar and end timer
		mc.progressBar(self.gMainProgressBar, edit=True, endProgress=True) # Complete progress bar
		totalTime = time.time() - startTime
		print "Processed %d points in %f seconds.\n" %(vtxID, totalTime)
		return plane
Exemplo n.º 5
0
def pole_vector_arrow(start_transform,
                      end_transform,
                      name="default",
                      annotation_text=""):
    """
    creating an annotation arrow which will be used commonly for pointing where the poleVector ctrl is
    
    Args:
    
    Returns:
    
    """
    start_position = cmds.xform(start_transform,
                                query=True,
                                worldSpace=True,
                                translation=True)
    tmp_annotation = cmds.annotate(end_transform,
                                   text=annotation_text,
                                   point=start_position)
    annotationTransform = cmds.listRelatives(tmp_annotation, parent=True)

    annotation = cmds.rename(annotationTransform, name)

    cmds.pointConstraint(start_transform, annotation, maintainOffset=True)

    cmds.setAttr("{}.overrideEnabled".format(annotation), 1)
    cmds.setAttr("{}.overrideDisplayType".format(annotation), 2)

    return annotation
Exemplo n.º 6
0
def addMarksToScene(marks):
    '''
    This is temp and will possibly be rolled into future releases.
    '''

    start, end = utl.frameRange()
    camera = utl.getCurrentCamera()
    camShape = mc.listRelatives(camera, shapes=True)[0]
    aov = mc.getAttr(camShape + '.horizontalFilmAperture')

    name = 'ml_stopwatch_'

    numStopwatches = len(mc.ls(name + '*', type='locator'))
    top = mc.spaceLocator(name=name + '#')

    ename = ':'.join([str(x) for x in marks])
    mc.addAttr(top,
               longName='keyTimes',
               at='enum',
               enumName=ename,
               keyable=True)

    markRange = float(marks[-1] - marks[0])
    viewWidth = aov * 2
    viewHeight = -0.4 * aov + (numStopwatches * aov * 0.08)
    depth = 5

    for mark in marks[1:-1]:

        ann = mc.annotate(top, text=str(mark))
        mc.setAttr(ann + '.displayArrow', 0)

        #parent
        annT = mc.parent(mc.listRelatives(ann, parent=True, path=True), top)[0]
        annT = mc.rename(annT, 'mark_' + str(round(mark)))
        ann = mc.listRelatives(annT, shapes=True, path=True)[0]

        #set the position
        normalX = float(mark - marks[0]) / markRange - 0.5
        mc.setAttr(annT + '.translateX', viewWidth * normalX * 2)
        mc.setAttr(annT + '.translateY', viewHeight)
        mc.setAttr(annT + '.translateZ', -depth)

        #keyframe for color
        mc.setAttr(ann + '.overrideEnabled', 1)

        mc.setKeyframe(ann,
                       attribute='overrideColor',
                       value=17,
                       time=(int(marks[0] - 1), int(mark + 1)))
        mc.setKeyframe(ann,
                       attribute='overrideColor',
                       value=13,
                       time=(int(mark), ))
        mc.keyTangent(ann + '.overrideColor', ott='step')

    mc.select(clear=True)
    mc.parentConstraint(camera, top)
Exemplo n.º 7
0
def mkCam(name=None, img_plane_imgs=None, *args, **kwds):
    camera_node = mkNode("%s_cam" % name, "camera", *args, **kwds)
    img_plane_node = mkNode("%s_imagePlane" % name, "imagePlane")
    img_plane_node = mc.listRelatives(img_plane_node,
                                      shapes=True,
                                      fullPath=True)[0]
    annotate_node = mc.annotate("%s_cam" % name,
                                text="tc=...",
                                point=(0, -3, -10))
    annotate_node = mc.rename(
        mc.listRelatives(annotate_node, parent=True, fullPath=True),
        "%s_timecode" % name)

    if img_plane_imgs:
        if ROOT_DIR is not None:
            img_plane_imgs = os.path.join(ROOT_DIR, img_plane_imgs)
        mc.setAttr("%s.imageName" % img_plane_node,
                   img_plane_imgs,
                   type="string")
    mc.connectAttr("%s.message" % img_plane_node,
                   "%s.imagePlane[0]" % camera_node)
    # you'd think that this was the default, to actually use frameOffset, but nooooooo....
    mc.expression(s="%s.frameExtension=frame+%s.frameOffset" %
                  (img_plane_node, img_plane_node))

    mc.setAttr("%s.rotateOrder" % camera_node, 3)
    mc.setAttr("%s.focalLength" % camera_node, 28.0)
    mc.setAttr("%s.alphaGain" % img_plane_node, 0.85)
    mc.setAttr("%s.useFrameExtension" % img_plane_node, 1)

    mc.addAttr(camera_node, longName="tc_h", attributeType="byte")
    mc.addAttr(camera_node, longName="tc_m", attributeType="byte")
    mc.addAttr(camera_node, longName="tc_s", attributeType="byte")
    mc.addAttr(camera_node, longName="tc_f", attributeType="byte")
    mc.addAttr(camera_node, longName="msg_num", attributeType="long")

    mc.parent(annotate_node, img_plane_node, camera_node, relative=True)

    script = """string $tc = "";
string $h = $$NAME$$_cam.tc_h;
string $m = $$NAME$$_cam.tc_m;
string $s = $$NAME$$_cam.tc_s;
string $f = $$NAME$$_cam.tc_f;
if (size($h)==1) $h = "0" + $h;
if (size($m)==1) $m = "0" + $m;
if (size($s)==1) $s = "0" + $s;
if (size($f)==1) $f = "0" + $f;
$tc = "tc=" + $h + ":" + $m + ":" + $s + "." + $f;
setAttr $$NAME$$_timecodeShape.text -type \"string\" $tc;
""".replace("$$NAME$$", name)
    mc.expression(name="%s_tc_update" % annotate_node,
                  object=annotate_node,
                  string=script)

    mc.select(camera_node)

    return camera_node
Exemplo n.º 8
0
def psd_driver_display(psd_driver, mode=1):

    if psd_driver.find("_psd_driver_gr") == -1: # not found
        cmds.warning('PSD Driver is not selected, aborting...')
        return
    
    prefix = psd_driver.replace('_psd_driver_gr', '')    
    goal_pos = prefix + '_goal_pos'
    target_pos = prefix + '_goal_pos'
    
    display_object = prefix + "psd_driver_display"
    angle_mult = prefix + "_angle_mult"
    annotation = prefix + '_annotation'
    num_to_str = prefix + "_num_to_str"
    
    if mode == 0 : #delete
        try:
            cmds.delete(display_object, angle_mult)
        except:
            pass
        
        return

    if mode == 1 : #create
        
        if not cmds.objExists(display_object):
            cmds.spotLight(intensity=0, name = display_object)

            display_object_shape = cmds.listRelatives(display_object)[0]
            cmds.setAttr(display_object_shape + '.overrideEnabled', 1)
            cmds.setAttr(display_object_shape + '.overrideDisplayType', 2)        
    
            cmds.parent(display_object, psd_driver, relative=True)
            cmds.aimConstraint(goal_pos, display_object, aimVector=[0,0,-1])
            
            angle_mult = cmds.createNode('multDoubleLinear', name = angle_mult)
            cmds.connectAttr(psd_driver + ".startAngle", angle_mult + ".input1")
            cmds.setAttr(angle_mult + ".input2", 2)
            cmds.connectAttr(angle_mult + ".output", display_object + ".coneAngle")
            
            annotation_shape = cmds.annotate(display_object, text='temp', p=[0,0,0])
            print annotation_shape
            cmds.setAttr(annotation_shape + '.displayArrow', 0)
            annotationNode = cmds.listRelatives(annotation_shape, p=True)[0]
            cmds.parent(annotationNode, display_object, r=True)
            cmds.setAttr(annotationNode + ".translateZ", -1.0)
            
            cmds.createNode('numToStr', name=num_to_str)
            cmds.connectAttr(psd_driver + ".psdBlend", num_to_str + ".input")
            cmds.connectAttr(num_to_str + ".output", annotation_shape + ".text")
            
            #cmds.rename (annotationNode, annotation)
            
            
        return display_object
Exemplo n.º 9
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)
Exemplo n.º 10
0
def addMarksToScene(marks):
    '''
    This is temp and will possibly be rolled into future releases.
    '''
    
    start,end = utl.frameRange()
    camera = utl.getCurrentCamera()
    camShape = mc.listRelatives(camera, shapes=True)[0]
    aov = mc.getAttr(camShape+'.horizontalFilmAperture')
    
    name = 'ml_stopwatch_'
    
    numStopwatches = len(mc.ls(name+'*', type='locator'))
    top = mc.spaceLocator(name=name+'#')
    
    ename = ':'.join([str(x) for x in marks])
    mc.addAttr(top, longName='keyTimes', at='enum', enumName=ename, keyable=True)
    
    markRange = float(marks[-1]-marks[0])
    viewWidth = aov*2
    viewHeight = -0.4*aov+(numStopwatches*aov*0.08)
    depth = 5
    
    for mark in marks[1:-1]:
    
        ann = mc.annotate(top, text=str(mark))
        mc.setAttr(ann+'.displayArrow', 0)
        
        #parent
        annT = mc.parent(mc.listRelatives(ann, parent=True, path=True), top)[0]
        annT = mc.rename(annT, 'mark_'+str(round(mark)))
        ann = mc.listRelatives(annT, shapes=True, path=True)[0]
        
        #set the position
        normalX = float(mark-marks[0])/markRange-0.5
        mc.setAttr(annT+'.translateX', viewWidth*normalX*2)
        mc.setAttr(annT+'.translateY', viewHeight)
        mc.setAttr(annT+'.translateZ', -depth)
        
        #keyframe for color
        mc.setAttr(ann+'.overrideEnabled', 1)
        
        mc.setKeyframe(ann, attribute='overrideColor', value=17, time=(int(marks[0]-1),int(mark+1)))
        mc.setKeyframe(ann, attribute='overrideColor', value=13, time=(int(mark),))
        mc.keyTangent(ann+'.overrideColor', ott='step')
        
        
    mc.select(clear=True)    
    mc.parentConstraint(camera, top)
Exemplo n.º 11
0
    def createAnnotateNode(self,footJoints):
        self.getPosition = cmds.xform(footJoints,q=True,ws=True,t=True)
        self.annotateNull = cmds.spaceLocator(n="%s_annotateNull"%footJoints)
        cmds.xform(self.annotateNull,t=self.getPosition)
        self.annotate = cmds.annotate(self.annotateNull)
        self.annotate = cmds.rename(cmds.listRelatives(self.annotate,p=True),"%s_annotate"%footJoints)
        cmds.setAttr(self.annotate+"Shape.overrideEnabled",1)
        cmds.setAttr(self.annotate+"Shape.overrideDisplayType",2)
        cmds.setAttr(self.annotateNull[0]+".visibility",0)
        cmds.pointConstraint(self.kneeIKCtl[1],self.annotateNull)
        cmds.parentConstraint(footJoints,self.annotate)
        self.footAnnotateGrp = cmds.group(self.annotate,self.annotateNull,name="%sAnnotate_Grp"%footJoints)
        cmds.xform(self.footAnnotateGrp,piv=[0,0,0])

        return [self.footAnnotateGrp]
Exemplo n.º 12
0
def createAnnotation(rootObj, endObj, text=None, name=None):
    name = name or "annotation"
    rootDag = om2.MFnDagNode(rootObj)
    boundingBox = rootDag.boundingBox
    center = om2.MVector(boundingBox.center)
    locator = asMObject(cmds.createNode("locator"))
    locatorTransform = getParent(locator)
    rename(locatorTransform, "_".join([name, "loc"]))
    setTranslation(locatorTransform, getTranslation(rootObj, om2.MSpace.kWorld), om2.MSpace.kWorld)
    annotationNode = asMObject(cmds.annotate(nameFromMObject(locatorTransform), tx=text))
    annParent = getParent(annotationNode)
    rename(annParent, name)
    plugs.setPlugValue(om2.MFnDagNode(annotationNode).findPlug("position", False), center)
    setParent(locatorTransform, rootObj, True)
    setParent(annParent, endObj, False)
    return annotationNode, locatorTransform
Exemplo n.º 13
0
 def createGuide(self, *args):
     """ Create the elements to Guide module in the scene, like controls, etc...
     """
     # GUIDE:
     utils.useDefaultRenderLayer()
     # create guide base (moduleGrp):
     guideBaseList = self.ctrls.cvBaseGuide(self.moduleGrp, r=2)
     self.moduleGrp = guideBaseList[0]
     self.radiusCtrl = guideBaseList[1]
     # add attributes to be read when rigging module:
     baseBooleanAttrList = ['guideBase', 'mirrorEnable', 'displayAnnotation']
     for baseBooleanAttr in baseBooleanAttrList:
         cmds.addAttr(self.moduleGrp, longName=baseBooleanAttr, attributeType='bool')
         cmds.setAttr(self.moduleGrp+"."+baseBooleanAttr, 1)
     
     baseIntegerAttrList = ['guideColor']
     for baseIntegerAttr in baseIntegerAttrList:
         cmds.addAttr(self.moduleGrp, longName=baseIntegerAttr, attributeType='long')
     
     baseStringAttrList  = ['moduleNamespace', 'customName', 'mirrorAxis', 'mirrorName', 'mirrorNameList', 'hookNode', 'moduleInstanceInfo', 'guideObjectInfo', 'rigType', 'dpARVersion']
     for baseStringAttr in baseStringAttrList:
         cmds.addAttr(self.moduleGrp, longName=baseStringAttr, dataType='string')
     cmds.setAttr(self.moduleGrp+".mirrorAxis", "off", type='string')
     cmds.setAttr(self.moduleGrp+".mirrorName", self.langDic[self.langName]['p002_left']+' --> '+self.langDic[self.langName]['p003_right'], type='string')
     cmds.setAttr(self.moduleGrp+".hookNode", "_Grp", type='string')
     cmds.setAttr(self.moduleGrp+".moduleInstanceInfo", self, type='string')
     cmds.setAttr(self.moduleGrp+".guideObjectInfo", self.dpUIinst.guide, type='string')
     cmds.setAttr(self.moduleGrp+".rigType", self.rigType, type='string')
     cmds.setAttr(self.moduleGrp+".dpARVersion", self.dpUIinst.dpARVersion, type='string')
     
     baseFloatAttrList = ['shapeSize']
     for baseFloatAttr in baseFloatAttrList:
         cmds.addAttr(self.moduleGrp, longName=baseFloatAttr, attributeType='float')
     cmds.setAttr(self.moduleGrp+".shapeSize", 1)
     
     baseIntegerAttrList = ['degree']
     for baseIntAttr in baseIntegerAttrList:
         cmds.addAttr(self.moduleGrp, longName=baseIntAttr, attributeType='short')
     cmds.setAttr(self.moduleGrp+".degree", self.dpUIinst.degreeOption)
     
     # create annotation to this module:
     self.annotation = cmds.annotate( self.moduleGrp, tx=self.moduleGrp, point=(0,2,0) )
     self.annotation = cmds.listRelatives(self.annotation, parent=True)[0]
     self.annotation = cmds.rename(self.annotation, self.moduleGrp+"_Ant")
     cmds.parent(self.annotation, self.moduleGrp)
     cmds.setAttr(self.annotation+'.text', self.moduleGrp[self.moduleGrp.find("__")+2:self.moduleGrp.rfind(":")], type='string')
     cmds.setAttr(self.annotation+'.template', 1)
Exemplo n.º 14
0
    def createAnnotation(self):
        if not self.isValid():
            return

        annotationShapes = self.refLocator.getChildren(allDescendants=True, typ='annotationShape')
        for s in annotationShapes:
            m.delete(getParent(s))

        annotationSh = m.annotate(self.refLocator.transform, p=(0, -0.5, 0))
        annotationTr = getParent(annotationSh)
        annotationTr = m.parent(annotationTr, self.refLocator.transform, relative=True)[0]
        lockTransformations(annotationTr)
        self.annotation = TransformHandle(transform=getLongName(annotationTr))

        m.setAttr(self.annotation.shape + '.displayArrow', False)
        m.setAttr(self.annotation.transform + '.overrideEnabled', True)
        m.setAttr(self.annotation.transform + '.overrideDisplayType', 2)
Exemplo n.º 15
0
def mkCam(name=None, img_plane_imgs=None, *args, **kwds):
    camera_node = mkNode("%s_cam"%name, "camera", *args, **kwds)
    img_plane_node = mkNode("%s_imagePlane"%name, "imagePlane")
    img_plane_node = mc.listRelatives(img_plane_node, shapes=True, fullPath=True)[0]
    annotate_node = mc.annotate("%s_cam"%name, text="tc=...", point=(0, -3, -10))
    annotate_node = mc.rename(mc.listRelatives(annotate_node, parent=True, fullPath=True), "%s_timecode"%name)

    if img_plane_imgs:
        if ROOT_DIR is not None:
            img_plane_imgs = os.path.join(ROOT_DIR,img_plane_imgs)
        mc.setAttr( "%s.imageName" % img_plane_node, img_plane_imgs, type="string")
    mc.connectAttr("%s.message" % img_plane_node, "%s.imagePlane[0]" % camera_node)
    # you'd think that this was the default, to actually use frameOffset, but nooooooo....
    mc.expression(s="%s.frameExtension=frame+%s.frameOffset"%(img_plane_node,img_plane_node))

    mc.setAttr("%s.rotateOrder"%camera_node, 3)
    mc.setAttr("%s.focalLength"%camera_node, 28.0)
    mc.setAttr("%s.alphaGain"%img_plane_node, 0.85)
    mc.setAttr("%s.useFrameExtension"%img_plane_node, 1)

    mc.addAttr(camera_node, longName="tc_h", attributeType="byte")
    mc.addAttr(camera_node, longName="tc_m", attributeType="byte")
    mc.addAttr(camera_node, longName="tc_s", attributeType="byte")
    mc.addAttr(camera_node, longName="tc_f", attributeType="byte")
    mc.addAttr(camera_node, longName="msg_num", attributeType="long")

    mc.parent(annotate_node, img_plane_node, camera_node, relative=True)

    script="""string $tc = "";
string $h = $$NAME$$_cam.tc_h;
string $m = $$NAME$$_cam.tc_m;
string $s = $$NAME$$_cam.tc_s;
string $f = $$NAME$$_cam.tc_f;
if (size($h)==1) $h = "0" + $h;
if (size($m)==1) $m = "0" + $m;
if (size($s)==1) $s = "0" + $s;
if (size($f)==1) $f = "0" + $f;
$tc = "tc=" + $h + ":" + $m + ":" + $s + "." + $f;
setAttr $$NAME$$_timecodeShape.text -type \"string\" $tc;
""".replace("$$NAME$$",name)
    mc.expression(name="%s_tc_update"%annotate_node, object=annotate_node, string=script)

    mc.select(camera_node)

    return camera_node
Exemplo n.º 16
0
def k_ann():
    k_locas=cc.ls(sl=1)
    
    for k_loca in k_locas:
        k_locass=cc.listRelatives(k_loca)
        if cc.nodeType(k_locass)=="locator":
            kl_tx=cc.getAttr(k_loca+".tx")
            kl_ty=cc.getAttr(k_loca+".ty")
            kl_tz=cc.getAttr(k_loca+".tz")        
            kl_tya=abs(kl_ty)
            kl_tza=abs(kl_tz)
            kl_txt=str(kl_tx)
            kl_tyt=str(kl_tya)
            kl_tzt=str(kl_tza)
            
            kt_zuobiao=cc.annotate (k_loca,tx='('+kl_txt[0:5]+','+kl_tzt[0:4]+','+kl_tyt[0:4]+')')
            kr_zuobiao=cc.listRelatives(kt_zuobiao,p=1)
            kpc_zuobaio=cc.pointConstraint(k_loca,kr_zuobiao)
            cc.delete(kpc_zuobaio)
Exemplo n.º 17
0
def createAnnotation(rootObj, endObj, text=None, name=None):
    name = name or "annotation"
    rootDag = om2.MFnDagNode(rootObj)
    boundingBox = rootDag.boundingBox
    center = om2.MVector(boundingBox.center)
    transform = nodes.createDagNode("_".join([name, "loc"]),
                                    "transform",
                                    parent=rootObj)
    nodes.setTranslation(transform,
                         nodes.getTranslation(rootObj, om2.MSpace.kWorld),
                         om2.MSpace.kWorld)
    annotationNode = nodes.asMObject(
        cmds.annotate(nodes.nameFromMObject(transform), tx=text))
    annParent = nodes.getParent(annotationNode)
    nodes.rename(annParent, name)
    plugs.setPlugValue(
        om2.MFnDagNode(annotationNode).findPlug("position", False), center)
    nodes.setParent(annParent, endObj, False)
    return annotationNode, transform
Exemplo n.º 18
0
    def createGuide(self, *args):
        """ Create the elements to Guide module in the scene, like controls, etc...
        """
        # GUIDE:
        utils.useDefaultRenderLayer()
        # create guide base (moduleGrp):
        guideBaseList = ctrls.cvBaseGuide(self.moduleGrp, r=2)
        self.moduleGrp = guideBaseList[0]
        self.radiusCtrl = guideBaseList[1]
        # add attributes to be read when rigging module:
        baseBooleanAttrList = ['guideBase', 'mirrorEnable', 'displayAnnotation']
        for baseBooleanAttr in baseBooleanAttrList:
            cmds.addAttr(self.moduleGrp, longName=baseBooleanAttr, attributeType='bool')
            cmds.setAttr(self.moduleGrp+"."+baseBooleanAttr, 1)
        
        baseIntegerAttrList = ['guideColor']
        for baseIntegerAttr in baseIntegerAttrList:
            cmds.addAttr(self.moduleGrp, longName=baseIntegerAttr, attributeType='long')
        
        baseStringAttrList  = ['moduleNamespace', 'customName', 'mirrorAxis', 'mirrorName', 'mirrorNameList', 'hookNode', 'moduleInstanceInfo', 'guideObjectInfo', 'rigType']
        for baseStringAttr in baseStringAttrList:
            cmds.addAttr(self.moduleGrp, longName=baseStringAttr, dataType='string')
        cmds.setAttr(self.moduleGrp+".mirrorAxis", "off", type='string')
        cmds.setAttr(self.moduleGrp+".mirrorName", self.langDic[self.langName]['p002_left']+' --> '+self.langDic[self.langName]['p003_right'], type='string')
        cmds.setAttr(self.moduleGrp+".hookNode", "_Grp", type='string')
        cmds.setAttr(self.moduleGrp+".moduleInstanceInfo", self, type='string')
        cmds.setAttr(self.moduleGrp+".guideObjectInfo", self.dpUIinst.guide, type='string')
        cmds.setAttr(self.moduleGrp+".rigType", self.rigType, type='string')
        
        baseFloatAttrList = ['shapeSize']
        for baseFloatAttr in baseFloatAttrList:
            cmds.addAttr(self.moduleGrp, longName=baseFloatAttr, attributeType='float')
        cmds.setAttr(self.moduleGrp+".shapeSize", 1)

        # create annotation to this module:
        self.annotation = cmds.annotate( self.moduleGrp, tx=self.moduleGrp, point=(0,2,0) )
        self.annotation = cmds.listRelatives(self.annotation, parent=True)[0]
        self.annotation = cmds.rename(self.annotation, self.moduleGrp+"_Ant")
        cmds.parent(self.annotation, self.moduleGrp)
        cmds.setAttr(self.annotation+'.text', self.moduleGrp[self.moduleGrp.find("__")+2:self.moduleGrp.rfind(":")], type='string')
        cmds.setAttr(self.annotation+'.template', 1)
Exemplo n.º 19
0
def createAnnotation(rootObj, endObj, text=None, name=None):
    newparent = nodes.createDagNode("_".join([name, "ann_hrc"]), "transform")
    name = name or "annotation"
    locator = nodes.createDagNode("_".join([name, "loc"]), "locator",
                                  newparent)

    annotationNode = nodes.asMObject(
        cmds.annotate(nodes.nameFromMObject(locator), tx=text))
    annParent = nodes.getParent(annotationNode)
    nodes.rename(annParent, name)
    nodes.setParent(annParent, newparent, False)
    extras = [newparent]
    constraint = constraints.MatrixConstraint(
        name="_".join([name, "startMtx"]))

    extras.extend(
        constraint.create(endObj, locator, (True, True, True),
                          (True, True, True), (True, True, True)))
    extras.extend(
        constraint.create(rootObj, annParent, (True, True, True),
                          (True, True, True), (True, True, True)))

    return annParent, locator, extras
Exemplo n.º 20
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)
    def generateCamera(self, *args):
        if not cmds.objExists('shotMaster'):
            cmds.confirmDialog(icn='warning', title='Error', message='There is no shotMaster group in scene file', \
                               button=['Ok'])
            cmds.error('error: no shot master within the scene')
        if cmds.objExists('camMaster'):
            cmds.confirmDialog(icn='warning', title='Error', message='There is already a camMaster group in scene file', \
                               button=['Ok'])
            cmds.error('error: no shot master within the scene')

        #CREATE CAMERA==============================================================================================
        genCamera = cmds.camera(dfg=False, dr=True, ncp=1, dsa=True, dst=False, ff='horizontal',\
                                hfa=1.68, vfa=0.945, fs=5.6, fl=50, sa=144)
        genCamera = genCamera[0]
        cmds.rename(genCamera, 'shotCAM')
        #CREATE CAMERA==============================================================================================

        #CREATE ANNOTATION==========================================================================================
        cmds.annotate('shotCAM', p=(0.800, 0.511, -2.514))
        cmds.setAttr('annotationShape1.displayArrow', 0, l=True)
        cmds.setAttr('annotation1.translateX', k=False, l=True)
        cmds.setAttr('annotation1.translateY', k=False, l=True)
        cmds.setAttr('annotation1.translateZ', k=False, l=True)
        cmds.setAttr('annotation1.rotateX', k=False, l=True)
        cmds.setAttr('annotation1.rotateY', k=False, l=True)
        cmds.setAttr('annotation1.rotateZ', k=False, l=True)
        cmds.setAttr('annotation1.scaleX', k=False, l=True)
        cmds.setAttr('annotation1.scaleY', k=False, l=True)
        cmds.setAttr('annotation1.scaleZ', k=False, l=True)
        cmds.setAttr('annotationShape1.overrideEnabled', 1)
        cmds.setAttr('annotationShape1.overrideColor', 7)

        cmds.annotate('shotCAM', p=(-0.892, 0.511, -2.514))
        cmds.setAttr('annotationShape2.displayArrow', 0, l=True)
        cmds.setAttr('annotation2.translateX', k=False, l=True)
        cmds.setAttr('annotation2.translateY', k=False, l=True)
        cmds.setAttr('annotation2.translateZ', k=False, l=True)
        cmds.setAttr('annotation2.rotateX', k=False, l=True)
        cmds.setAttr('annotation2.rotateY', k=False, l=True)
        cmds.setAttr('annotation2.rotateZ', k=False, l=True)
        cmds.setAttr('annotation2.scaleX', k=False, l=True)
        cmds.setAttr('annotation2.scaleY', k=False, l=True)
        cmds.setAttr('annotation2.scaleZ', k=False, l=True)
        cmds.setAttr('annotationShape2.overrideEnabled', 1)
        cmds.setAttr('annotationShape2.overrideColor', 7)

        cmds.annotate('shotCAM', p=(0.000, 0.511, -2.514))
        cmds.setAttr('annotationShape3.displayArrow', 0, l=True)
        cmds.setAttr('annotation3.translateX', k=False, l=True)
        cmds.setAttr('annotation3.translateY', k=False, l=True)
        cmds.setAttr('annotation3.translateZ', k=False, l=True)
        cmds.setAttr('annotation3.rotateX', k=False, l=True)
        cmds.setAttr('annotation3.rotateY', k=False, l=True)
        cmds.setAttr('annotation3.rotateZ', k=False, l=True)
        cmds.setAttr('annotation3.scaleX', k=False, l=True)
        cmds.setAttr('annotation3.scaleY', k=False, l=True)
        cmds.setAttr('annotation3.scaleZ', k=False, l=True)
        cmds.setAttr('annotationShape3.overrideEnabled', 1)
        cmds.setAttr('annotationShape3.overrideColor', 7)

        cmds.setAttr('shotCAM.translateX', l=True)
        cmds.setAttr('shotCAM.translateY', l=True)
        cmds.setAttr('shotCAM.translateZ', l=True)
        cmds.setAttr('shotCAM.rotateX', l=True)
        cmds.setAttr('shotCAM.rotateY', l=True)
        cmds.setAttr('shotCAM.rotateZ', l=True)
        cmds.setAttr('shotCAM.scaleX', l=True)
        cmds.setAttr('shotCAM.scaleY', l=True)
        cmds.setAttr('shotCAM.scaleZ', l=True)
        cmds.setAttr('shotCAM.visibility', l=True)
        cmds.group('shotCAM',
                   'annotation1',
                   'annotation2',
                   'annotation3',
                   n='CAMGRP')
        cmds.setAttr('CAMGRP.translateX', k=False, l=True)
        cmds.setAttr('CAMGRP.translateY', k=False, l=True)
        cmds.setAttr('CAMGRP.translateZ', k=False, l=True)
        cmds.setAttr('CAMGRP.rotateX', k=False, l=True)
        cmds.setAttr('CAMGRP.rotateY', k=False, l=True)
        cmds.setAttr('CAMGRP.rotateZ', k=False, l=True)
        cmds.setAttr('CAMGRP.scaleX', k=False, l=True)
        cmds.setAttr('CAMGRP.scaleY', k=False, l=True)
        cmds.setAttr('CAMGRP.scaleZ', k=False, l=True)
        cmds.setAttr('CAMGRP.visibility', k=False, l=True)
        cmds.group('CAMGRP', n='CAMTILT')
        cmds.setAttr('CAMTILT.scaleX', k=False, l=True)
        cmds.setAttr('CAMTILT.scaleY', k=False, l=True)
        cmds.setAttr('CAMTILT.scaleZ', k=False, l=True)
        cmds.setAttr('CAMTILT.visibility', k=False, l=True)
        cmds.group('CAMTILT', n='CAMPOS')
        cmds.setAttr('CAMPOS.scaleX', k=False, l=True)
        cmds.setAttr('CAMPOS.scaleY', k=False, l=True)
        cmds.setAttr('CAMPOS.scaleZ', k=False, l=True)
        cmds.setAttr('CAMPOS.visibility', k=False, l=True)
        cmds.group('CAMPOS', n='camMaster')
        cmds.setAttr('camMaster.translateX', k=False, l=True)
        cmds.setAttr('camMaster.translateY', k=False, l=True)
        cmds.setAttr('camMaster.translateZ', k=False, l=True)
        cmds.setAttr('camMaster.rotateX', k=False, l=True)
        cmds.setAttr('camMaster.rotateY', k=False, l=True)
        cmds.setAttr('camMaster.rotateZ', k=False, l=True)
        cmds.setAttr('camMaster.scaleX', k=False, l=True)
        cmds.setAttr('camMaster.scaleY', k=False, l=True)
        cmds.setAttr('camMaster.scaleZ', k=False, l=True)
        cmds.rename('annotation1', 'anShotInformation')
        cmds.rename('annotation2', 'anFramecount')
        cmds.rename('annotation3', 'anArtistName')
        cmds.expression(n='cameraex',
                        o='anFramecount',
                        s='float $f=frame; setAttr -type "string"\
         "anFramecount.text" ("Frame: "+$f);')
        cmds.expression(n='cameraex2',
                        o='anShotInformation',
                        s='string $p=`getAttr sceneInfo.key`; setAttr -type\
         "string" "anShotInformation.text" ("Scene: "+"' + PRJ_CODE + '_' +
                        SCN_EPS + '_' + SCN_SEQ + '_' + 'SH_"+$p);')
        cmds.setAttr('anArtistName.text',
                     'Artist: ' + str(getpass.getuser()),
                     typ='string')

        #cmds.expression(n='cameraex3',o='hud_grp',s='float $g=`getAttr CAMSET.FOV_alg_35`/50;\
        #setAttr "hud_grp.scaleZ" $g;', ae=True)

        cmds.group('anShotInformation',
                   'anFramecount',
                   'anArtistName',
                   n='hud_grp')
        cmds.move(0, 0, 0, 'hud_grp.scalePivot')
        #Change str(getpass.getuser()) to str(asmas.getuser())

        cmds.setAttr('anShotInformation.scaleX', k=True, l=False)
        cmds.setAttr('anShotInformation.scaleY', k=True, l=False)
        cmds.setAttr('anShotInformation.scaleZ', k=True, l=False)
        cmds.setAttr('anFramecount.scaleX', k=True, l=False)
        cmds.setAttr('anFramecount.scaleY', k=True, l=False)
        cmds.setAttr('anFramecount.scaleZ', k=True, l=False)
        cmds.setAttr('anArtistName.scaleX', k=True, l=False)
        cmds.setAttr('anArtistName.scaleY', k=True, l=False)
        cmds.setAttr('anArtistName.scaleZ', k=True, l=False)

        #CREATE ANNOTATION==========================================================================================

        #CREATE FULCRUM=============================================================================================
        fulcrumHeight = float(FULC_HEIGHT)
        fulcrumWidth = float(FULC_WIDTH)

        c1=cmds.curve(d=1, p=[(0, 0, 0), \
                              #top right

                              (fulcrumWidth/2,fulcrumHeight/2, -115.744), \
                              #top left

                              ((fulcrumWidth/2)*-1,fulcrumHeight/2,-115.744), \
                              #central

                              (0,0, 0), \
                              #bottom right

                              (fulcrumWidth/2,(fulcrumHeight/2)*-1, -115.744), \
                              #bottom left

                              ((fulcrumWidth/2)*-1,(fulcrumHeight/2)*-1,-115.744), \
                              #central

                              (0,0, 0), \
                              #bottom left

                              ((fulcrumWidth/2)*-1,(fulcrumHeight/2)*-1,-115.744), \
                              #top left

                              ((fulcrumWidth/2)*-1,fulcrumHeight/2, -115.744),  \
                              #top right

                              (fulcrumWidth/2,fulcrumHeight/2, -115.744), \
                              #bottom right

                              (fulcrumWidth/2,(fulcrumHeight/2)*-1, -115.744)],\
                      k=[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] )
        cmds.rename(c1, 'fulcrum')

        BASECOORDTRANSvar = cmds.xform('shotCAM', q=True, t=True, ws=True)
        cmds.group(em=True, n='fulcrum_grp')
        cmds.move(BASECOORDTRANSvar[0], BASECOORDTRANSvar[1],
                  BASECOORDTRANSvar[2], 'fulcrum_grp')

        cmds.parent('fulcrum', 'fulcrum_grp')
        cmds.parent('fulcrum_grp', 'CAMGRP')
        cmds.color('fulcrum', ud=1)

        cmds.setAttr('fulcrum_grp.translateX', k=False, l=True)
        cmds.setAttr('fulcrum_grp.translateY', k=False, l=True)
        cmds.setAttr('fulcrum_grp.translateZ', k=False, l=True)
        cmds.setAttr('fulcrum_grp.rotateX', k=False, l=True)
        cmds.setAttr('fulcrum_grp.rotateY', k=False, l=True)
        cmds.setAttr('fulcrum_grp.rotateZ', k=False, l=True)
        cmds.setAttr('fulcrum_grp.visibility', k=False, l=True)

        cmds.setAttr('fulcrum.translateX', k=False, l=True)
        cmds.setAttr('fulcrum.translateY', k=False, l=True)
        cmds.setAttr('fulcrum.translateZ', k=False, l=True)
        cmds.setAttr('fulcrum.rotateX', k=False, l=True)
        cmds.setAttr('fulcrum.rotateY', k=False, l=True)
        cmds.setAttr('fulcrum.rotateZ', k=False, l=True)

        cmds.move(0, 0, 0, 'fulcrum_grp.scalePivot')
        #CREATE FULCRUM=============================================================================================

        #CREATE 4:3 ACTION AND TITLE SAFE===========================================================================
        cmds.polyPlane(n='save',
                       sx=1,
                       sy=1,
                       w=float(SAVE_WIDTH),
                       h=float(SAVE_HEIGHT),
                       ax=[0, 0, 1])
        cmds.polyPlane(n='saveaction',
                       sx=1,
                       sy=1,
                       w=float(SAVE_ACTWIDTH),
                       h=float(SAVE_ACTHEIGHT),
                       ax=[0, 0, 1])
        cmds.move(-2.493, 'save', r=True, z=True)
        cmds.move(-2.493, 'saveaction', r=True, z=True)

        cmds.group(em=True, n='save_grp')
        cmds.move(BASECOORDTRANSvar[0], BASECOORDTRANSvar[1],
                  BASECOORDTRANSvar[2], 'save_grp')

        cmds.parent('save', 'save_grp')
        cmds.parent('saveaction', 'save_grp')
        cmds.parent('save_grp', 'CAMGRP')
        cmds.color('save', ud=1)
        cmds.color('saveaction', ud=1)
        cmds.setAttr('save.template', 1)
        cmds.setAttr('saveaction.template', 1)

        cmds.setAttr('saveaction.translateX', k=False, l=True)
        cmds.setAttr('saveaction.translateY', k=False, l=True)
        cmds.setAttr('saveaction.translateZ', k=False, l=True)
        cmds.setAttr('saveaction.rotateX', k=False, l=True)
        cmds.setAttr('saveaction.rotateY', k=False, l=True)
        cmds.setAttr('saveaction.rotateZ', k=False, l=True)
        cmds.setAttr('saveaction.visibility', 1)
        cmds.setAttr('saveaction.visibility', k=False, l=True)

        cmds.setAttr('save.translateX', k=False, l=True)
        cmds.setAttr('save.translateY', k=False, l=True)
        cmds.setAttr('save.translateZ', k=False, l=True)
        cmds.setAttr('save.rotateX', k=False, l=True)
        cmds.setAttr('save.rotateY', k=False, l=True)
        cmds.setAttr('save.rotateZ', k=False, l=True)
        cmds.setAttr('save.visibility', 1)
        cmds.setAttr('save.visibility', k=False, l=True)

        cmds.setAttr('save_grp.translateX', k=False, l=True)
        cmds.setAttr('save_grp.translateY', k=False, l=True)
        cmds.setAttr('save_grp.translateZ', k=False, l=True)
        cmds.setAttr('save_grp.rotateX', k=False, l=True)
        cmds.setAttr('save_grp.rotateY', k=False, l=True)
        cmds.setAttr('save_grp.rotateZ', k=False, l=True)
        cmds.setAttr('save_grp.visibility', k=False, l=True)

        cmds.setAttr('hud_grp.translateX', k=False, l=True)
        cmds.setAttr('hud_grp.translateY', k=False, l=True)
        cmds.setAttr('hud_grp.translateZ', k=False, l=True)
        cmds.setAttr('hud_grp.rotateX', k=False, l=True)
        cmds.setAttr('hud_grp.rotateY', k=False, l=True)
        cmds.setAttr('hud_grp.rotateZ', k=False, l=True)
        cmds.setAttr('hud_grp.visibility', k=False, l=True)
        #CREATE 4:3 ACTION AND TITLE SAFE===========================================================================

        #CAM SETTING================================================================================================
        cmds.group(em=True, n='CAMSET')
        cmds.parent('CAMSET', 'CAMGRP')

        cmds.setAttr('CAMSET.translateX', k=False, l=True)
        cmds.setAttr('CAMSET.translateY', k=False, l=True)
        cmds.setAttr('CAMSET.translateZ', k=False, l=True)
        cmds.setAttr('CAMSET.rotateX', k=False, l=True)
        cmds.setAttr('CAMSET.rotateY', k=False, l=True)
        cmds.setAttr('CAMSET.rotateZ', k=False, l=True)
        cmds.setAttr('CAMSET.scaleX', k=False, l=True)
        cmds.setAttr('CAMSET.scaleY', k=False, l=True)
        cmds.setAttr('CAMSET.scaleZ', k=False, l=True)
        cmds.setAttr('CAMSET.visibility', k=False, l=True)

        #Custom Attribute
        cmds.addAttr('CAMSET',
                     ln='Fulcrum_Size',
                     defaultValue=1.0,
                     min=1,
                     k=True)
        cmds.addAttr('CAMSET',
                     ln='Fulcrum_Visibility',
                     defaultValue=1.0,
                     min=0,
                     max=1,
                     k=True)
        cmds.addAttr('CAMSET', ln='FOV_alg_35', defaultValue=35, k=True)
        cmds.addAttr('CAMSET', ln='Far_Clip', defaultValue=100000.0, k=True)
        cmds.addAttr('CAMSET', ln='Near_Clip', defaultValue=1.0, k=True)
        cmds.addAttr('CAMSET',
                     ln='_________________',
                     attributeType='enum',
                     en='__________',
                     k=True,
                     w=True)
        cmds.setAttr('CAMSET._________________', lock=True)
        cmds.addAttr('CAMSET',
                     ln='Frame_Counter',
                     attributeType='enum',
                     en='Off:On',
                     k=True)
        cmds.addAttr('CAMSET',
                     ln='Artist_Name',
                     attributeType='enum',
                     en='Off:On',
                     k=True)
        cmds.addAttr('CAMSET',
                     ln='File_Name',
                     attributeType='enum',
                     en='Off:On',
                     k=True)

        #Connection
        cmds.connectAttr('CAMSET.Fulcrum_Size', 'fulcrum.scaleX')
        cmds.connectAttr('CAMSET.Fulcrum_Size', 'fulcrum.scaleY')
        cmds.connectAttr('CAMSET.Fulcrum_Size', 'fulcrum.scaleZ')

        cmds.connectAttr('CAMSET.Fulcrum_Visibility', 'fulcrum.visibility')

        cmds.connectAttr('CAMSET.Frame_Counter', 'anFramecount.visibility')
        cmds.connectAttr('CAMSET.File_Name', 'anShotInformation.visibility')
        cmds.connectAttr('CAMSET.Artist_Name', 'anArtistName.visibility')

        cmds.connectAttr('CAMSET.Far_Clip', 'shotCAMShape.farClipPlane')
        cmds.connectAttr('CAMSET.Near_Clip', 'shotCAMShape.nearClipPlane')

        cmds.connectAttr('CAMSET.FOV_alg_35', 'shotCAMShape.focalLength')
        cmds.setAttr('CAMSET.FOV_alg_35', 50)

        cmds.setAttr('CAMSET.Frame_Counter', 1)
        cmds.setAttr('CAMSET.Artist_Name', 1)
        cmds.setAttr('CAMSET.File_Name', 1)

        MULTIDIVvar = cmds.createNode('multiplyDivide', n='cammultiply')
        cmds.setAttr(MULTIDIVvar + '.operation', 2)
        cmds.setAttr(MULTIDIVvar + '.input2X', 50)
        cmds.connectAttr('CAMSET.FOV_alg_35', MULTIDIVvar + '.input1X')
        cmds.connectAttr(MULTIDIVvar + '.outputX', 'hud_grp.scaleZ')
        cmds.connectAttr(MULTIDIVvar + '.outputX', 'fulcrum_grp.scaleZ')
        cmds.connectAttr(MULTIDIVvar + '.outputX', 'save_grp.scaleZ')
        #CAM SETTING================================================================================================

        #NEAR CLIP GROUP============================================================================================
        cmds.group(em=True, n='nearclip_grp', p='CAMGRP')
        cmds.parent('hud_grp', 'nearclip_grp')
        cmds.parent('save_grp', 'nearclip_grp')
        cmds.parent('fulcrum_grp', 'nearclip_grp')

        cmds.connectAttr('CAMSET.Near_Clip', 'nearclip_grp.scaleX')
        cmds.connectAttr('CAMSET.Near_Clip', 'nearclip_grp.scaleY')
        cmds.connectAttr('CAMSET.Near_Clip', 'nearclip_grp.scaleZ')

        #NEAR CLIP GROUP============================================================================================

        #CELAN-UP===================================================================================================
        cmds.move(0, 0, 0, 'CAMPOS.scalePivot')
        cmds.move(0, 0, 0, 'CAMPOS.rotatePivot')

        cmds.move(0, 0, 0, 'CAMTILT.scalePivot')
        cmds.move(0, 0, 0, 'CAMTILT.rotatePivot')

        cmds.setAttr('shotCAM.translateX', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.translateY', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.translateZ', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.rotateX', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.rotateY', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.rotateZ', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.scaleX', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.scaleY', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.scaleZ', e=True, l=True, k=False)
        cmds.setAttr('shotCAM.visibility', e=True, l=True, k=False)

        cmds.setAttr('hud_grp.scaleX', e=True, l=True, k=False)
        cmds.setAttr('hud_grp.scaleY', e=True, l=True, k=False)
        cmds.setAttr('hud_grp.scaleZ', e=True, l=True, k=False)

        cmds.setAttr('fulcrum_grp.scaleX', e=True, l=True, k=False)
        cmds.setAttr('fulcrum_grp.scaleY', e=True, l=True, k=False)
        cmds.setAttr('fulcrum_grp.scaleZ', e=True, l=True, k=False)

        cmds.setAttr('save_grp.scaleX', e=True, l=True, k=False)
        cmds.setAttr('save_grp.scaleY', e=True, l=True, k=False)
        cmds.setAttr('save_grp.scaleZ', e=True, l=True, k=False)
        #CELAN-UP===================================================================================================

        #Parenting
        cmds.parent('camMaster', 'shotMaster')

        cmds.select(cl=True)

        import mncToolsLayCameraGenerator
        reload(mncToolsLayCameraGenerator)
        return
Exemplo n.º 22
0
 def poleCtrl(self, shoulder, hand, ikHendle):
     PoleCtrl = mm.eval(
         'curve -d 1 -p -8.19564e-008 0 0.5 -p 0.0975451 0 0.490393 -p 0.191342 0 0.46194 -p 0.277785 0 0.415735 -p 0.353553 0 0.353553 -p 0.415735 0 0.277785 -p 0.46194 0 0.191342 -p 0.490393 0 0.0975452 -p 0.5 0 0 -p 0.490392 0 -0.0975448 -p 0.461939 0 -0.191341 -p 0.415734 0 -0.277785 -p 0.353553 0 -0.353553 -p 0.277785 0 -0.415734 -p 0.191342 0 -0.461939 -p 0.0975453 0 -0.490392 -p 2.23517e-007 0 -0.5 -p -0.0975448 0 -0.490392 -p -0.191341 0 -0.461939 -p -0.277785 0 -0.415735 -p -0.353553 0 -0.353553 -p -0.415734 0 -0.277785 -p -0.461939 0 -0.191342 -p -0.490392 0 -0.0975453 -p -0.5 0 -1.63913e-007 -p -0.490392 0 0.097545 -p -0.46194 0 0.191341 -p -0.415735 0 0.277785 -p -0.353553 0 0.353553 -p -0.277785 0 0.415735 -p -0.191342 0 0.46194 -p -0.0975452 0 0.490392 -p -8.19564e-008 0 0.5 -p -8.03816e-008 0.0975452 0.490392 -p -7.57178e-008 0.191342 0.46194 -p -6.81442e-008 0.277785 0.415735 -p -5.79519e-008 0.353553 0.353553 -p -4.55325e-008 0.415735 0.277785 -p -3.13634e-008 0.46194 0.191342 -p -1.59889e-008 0.490393 0.0975451 -p 0 0.5 0 -p 4.36061e-008 0.490393 -0.0975451 -p 8.55364e-008 0.46194 -0.191342 -p 1.2418e-007 0.415735 -0.277785 -p 1.58051e-007 0.353553 -0.353553 -p 1.85848e-007 0.277785 -0.415734 -p 2.06503e-007 0.191342 -0.461939 -p 2.19223e-007 0.0975452 -0.490392 -p 2.23517e-007 0 -0.5 -p 2.19223e-007 -0.0975452 -0.490392 -p 2.06503e-007 -0.191342 -0.461939 -p 1.85848e-007 -0.277785 -0.415734 -p 1.58051e-007 -0.353553 -0.353553 -p 1.2418e-007 -0.415735 -0.277785 -p 8.55364e-008 -0.46194 -0.191342 -p 4.36061e-008 -0.490393 -0.0975451 -p 0 -0.5 0 -p -1.59889e-008 -0.490393 0.0975451 -p -3.13634e-008 -0.46194 0.191342 -p -4.55325e-008 -0.415735 0.277785 -p -5.79519e-008 -0.353553 0.353553 -p -6.81442e-008 -0.277785 0.415735 -p -7.57178e-008 -0.191342 0.46194 -p -8.03816e-008 -0.0975452 0.490392 -p -8.19564e-008 0 0.5 -p -0.0975452 0 0.490392 -p -0.191342 0 0.46194 -p -0.277785 0 0.415735 -p -0.353553 0 0.353553 -p -0.415735 0 0.277785 -p -0.46194 0 0.191341 -p -0.490392 0 0.097545 -p -0.5 0 -1.63913e-007 -p -0.490392 -0.0975452 -1.60763e-007 -p -0.461939 -0.191342 -1.51436e-007 -p -0.415735 -0.277785 -1.36288e-007 -p -0.353553 -0.353553 -1.15904e-007 -p -0.277785 -0.415735 -9.10651e-008 -p -0.191342 -0.46194 -6.27267e-008 -p -0.0975451 -0.490393 -3.19778e-008 -p 0 -0.5 0 -p 0.0975452 -0.490393 0 -p 0.191342 -0.46194 0 -p 0.277785 -0.415735 0 -p 0.353553 -0.353553 0 -p 0.415735 -0.277785 0 -p 0.46194 -0.191342 0 -p 0.490393 -0.0975452 0 -p 0.5 0 0 -p 0.490393 0.0975452 0 -p 0.46194 0.191342 0 -p 0.415735 0.277785 0 -p 0.353553 0.353553 0 -p 0.277785 0.415735 0 -p 0.191342 0.46194 0 -p 0.0975452 0.490393 0 -p 0 0.5 0 -p -0.0975451 0.490393 -3.19778e-008 -p -0.191342 0.46194 -6.27267e-008 -p -0.277785 0.415735 -9.10651e-008 -p -0.353553 0.353553 -1.15904e-007 -p -0.415735 0.277785 -1.36288e-007 -p -0.461939 0.191342 -1.51436e-007 -p -0.490392 0.0975452 -1.60763e-007 -p -0.5 0 -1.63913e-007 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -k 33 -k 34 -k 35 -k 36 -k 37 -k 38 -k 39 -k 40 -k 41 -k 42 -k 43 -k 44 -k 45 -k 46 -k 47 -k 48 -k 49 -k 50 -k 51 -k 52 -k 53 -k 54 -k 55 -k 56 -k 57 -k 58 -k 59 -k 60 -k 61 -k 62 -k 63 -k 64 -k 65 -k 66 -k 67 -k 68 -k 69 -k 70 -k 71 -k 72 -k 73 -k 74 -k 75 -k 76 -k 77 -k 78 -k 79 -k 80 -k 81 -k 82 -k 83 -k 84 -k 85 -k 86 -k 87 -k 88 -k 89 -k 90 -k 91 -k 92 -k 93 -k 94 -k 95 -k 96 -k 97 -k 98 -k 99 -k 100 -k 101 -k 102 -k 103 -k 104'
     )
     PoleCtrl = mc.rename(PoleCtrl,
                          self.midJoint.replace('|', '_') + "_PoleCtrl")
     PoleCtrlDriven = mc.group(PoleCtrl, n=PoleCtrl + '_driven')
     PoleCtrlGRP = mc.group(PoleCtrlDriven, n=PoleCtrl + '_GRP')
     mc.setAttr(PoleCtrl + '.overrideEnabled', 1)
     mc.setAttr(PoleCtrl + '.overrideColor', 13)
     mc.xform(PoleCtrlGRP, ws=1, t=self.midPos)
     mc.spaceLocator(p=[0, 0, 0], n='xformLocator')
     mc.xform('xformLocator', ws=1, t=self.shoulderPos)
     mc.xform('xformLocator', ws=1, ro=self.cameraRot)
     mc.parentConstraint('xformLocator', PoleCtrlGRP, w=1, mo=1)
     mc.xform('xformLocator', os=1, wd=1, r=1, t=[0, self.distance / 2, 0])
     mc.select(PoleCtrlGRP, r=1)
     mm.eval('setConstraintRestPosition;')
     mc.parentConstraint('xformLocator', PoleCtrlGRP, rm=1)
     mc.delete('xformLocator')
     mc.poleVectorConstraint(PoleCtrl, ikHendle)
     mc.connectAttr(
         shoulder.replace('|', '_') + '_' + hand.replace('|', '_') +
         '_IKFK_Blend.IK_FKBlend', PoleCtrl + '.visibility')
     annotateShape = mc.annotate(PoleCtrl, p=self.midPos)
     annotateName = mc.listRelatives(annotateShape, p=1, pa=1)[0]
     annotateName = mc.rename(annotateName,
                              self.midJoint.replace('|', '_') + '_annotate')
     mc.parentConstraint(self.midJoint.replace('|', '_') + '_IKCtrlJoint',
                         annotateName,
                         w=1,
                         mo=1)
     mc.setAttr(annotateName + '.overrideEnabled', 1)
     mc.setAttr(annotateName + '.overrideDisplayType', 2)
     mc.parentConstraint(hand.replace('|', '_') + '_IKCtrl',
                         PoleCtrlGRP,
                         w=1,
                         mo=1,
                         n=PoleCtrlGRP.replace('|', '_') +
                         '_parentConstraint')
     mc.connectAttr(
         shoulder.replace('|', '_') + '_' + hand.replace('|', '_') +
         '_IKFK_Blend.IK_FKBlend', annotateName + '.visibility')
     mc.parent(PoleCtrlGRP, self.IKSystemGRP)
     mc.parent(annotateName, self.IKSystemGRP)
     mc.addAttr(PoleCtrl,
                ln='Follow',
                at='float',
                hnv=1,
                hxv=1,
                min=0,
                max=1,
                dv=1,
                k=1)
     mc.connectAttr(
         PoleCtrl + '.Follow', PoleCtrl + '_GRP_parentConstraint.' +
         hand.replace('|', '_') + '_IKCtrlW0')
     mc.setAttr(PoleCtrl + '.rx',
                lock=True,
                keyable=False,
                channelBox=False)
     mc.setAttr(PoleCtrl + '.ry',
                lock=True,
                keyable=False,
                channelBox=False)
     mc.setAttr(PoleCtrl + '.rz',
                lock=True,
                keyable=False,
                channelBox=False)
     mc.setAttr(PoleCtrl + '.sx',
                lock=True,
                keyable=False,
                channelBox=False)
     mc.setAttr(PoleCtrl + '.sy',
                lock=True,
                keyable=False,
                channelBox=False)
     mc.setAttr(PoleCtrl + '.sz',
                lock=True,
                keyable=False,
                channelBox=False)
     mc.setAttr(PoleCtrl + '.v', lock=True, keyable=False, channelBox=False)
     mc.select(cl=1)
    def createCamera(self, *args):
        if not cmds.objExists('shotMaster'):
            cmds.confirmDialog( icon='warning',title='Message', message='No Shot master within the file!',\
                                button=['Ok'] ,defaultButton='Ok' )
            cmds.error('error: no shot master within the scene')

        if cmds.objExists('cam'):
            cmds.confirmDialog( icon='warning',title='Error', message='There is already a camera master in scene \
            file.', button=['Ok'] ,defaultButton='Ok' )
            cmds.error('error: no shot master within the scene')

        #CREATE CAMERA==============================================================================================
        shotCamera=cmds.camera(dfg=False,dr=True,ncp=1,dsa=True,dst=False,ff='horizontal',hfa=1.68,vfa=0.945,fs=5.6,\
                              fl=50,sa=144)
        shotCamera=shotCamera[0]
        cmds.rename(shotCamera,'shotCAM')
        #CREATE CAMERA==============================================================================================

        self.lockStandard('shotCAM')
        cmds.setAttr('shotCAM.visibility',l=True)
        cmds.group(n='CAMGRP', em=True)
        self.lockStandard('CAMGRP')
        cmds.setAttr('CAMGRP.visibility',k=False,l=True)
        cmds.group('CAMGRP',n='CAMTILT')
        cmds.setAttr('CAMTILT.scaleX',k=False,l=True)
        cmds.setAttr('CAMTILT.scaleY',k=False,l=True)
        cmds.setAttr('CAMTILT.scaleZ',k=False,l=True)
        cmds.setAttr('CAMTILT.visibility',k=False,l=True)
        cmds.group('CAMTILT',n='CAMPOS')
        cmds.setAttr('CAMPOS.scaleX',k=False,l=True)
        cmds.setAttr('CAMPOS.scaleY',k=False,l=True)
        cmds.setAttr('CAMPOS.scaleZ',k=False,l=True)
        cmds.setAttr('CAMPOS.visibility',k=False,l=True)
        cmds.group('CAMPOS',n='cam')
        self.lockStandard('cam')

        prjCode = cmds.getAttr('sceneInfo.projCode', asString=True)
        episode = cmds.getAttr('sceneInfo.episodeName', asString=True)
        shot = cmds.getAttr('sceneInfo.shotName', asString=True)
        cmds.annotate('shotCAM', p=(0.800, 0.511, -2.514))
        cmds.setAttr('annotationShape1.overrideEnabled',1)
        cmds.setAttr('annotationShape1.overrideColor',7)
        cmds.setAttr('annotationShape1.displayArrow', 0, l=True)
        cmds.setAttr('annotationShape1.overrideEnabled',1)
        cmds.setAttr('annotationShape1.overrideColor',7)
        cmds.rename('annotation1','anShotInformation')
        cmds.expression(n='cameraex2',o='anShotInformation',s='setAttr -type\
         "string" "anShotInformation.text" ("Scene: "+"'+prjCode+'_'+episode+'_'+shot+'");')
        cmds.parent('anShotInformation', 'CAMGRP')

        #CAM SETTING================================================================================================
        cmds.group(em=True,n='CAMSET')
        cmds.parent('CAMSET','CAMGRP')

        cmds.setAttr('CAMSET.translateX',k=False,l=True)
        cmds.setAttr('CAMSET.translateY',k=False,l=True)
        cmds.setAttr('CAMSET.translateZ',k=False,l=True)
        cmds.setAttr('CAMSET.rotateX',k=False,l=True)
        cmds.setAttr('CAMSET.rotateY',k=False,l=True)
        cmds.setAttr('CAMSET.rotateZ',k=False,l=True)
        cmds.setAttr('CAMSET.scaleX',k=False,l=True)
        cmds.setAttr('CAMSET.scaleY',k=False,l=True)
        cmds.setAttr('CAMSET.scaleZ',k=False,l=True)
        cmds.setAttr('CAMSET.visibility',k=False,l=True)

        #Custom Attribute
        cmds.addAttr( 'CAMSET',ln='FOV_alg_35', defaultValue=35,k=True )
        cmds.addAttr( 'CAMSET',ln='Far_Clip', defaultValue=100000.0,k=True )
        cmds.addAttr( 'CAMSET',ln='Near_Clip', defaultValue=1.0,k=True )

        #Connection
        cmds.connectAttr('CAMSET.FOV_alg_35','shotCAMShape.focalLength')
        cmds.setAttr('CAMSET.FOV_alg_35',50)

        MULTIDIVvar=cmds.createNode('multiplyDivide',n='cammultiply')
        cmds.setAttr(MULTIDIVvar+'.operation',2)
        cmds.setAttr(MULTIDIVvar+'.input2X',50)
        cmds.connectAttr('CAMSET.FOV_alg_35',MULTIDIVvar+'.input1X')
        #CAM SETTING================================================================================================

        #CELAN-UP===================================================================================================
        cmds.move(0,0,0,'CAMPOS.scalePivot')
        cmds.move(0,0,0,'CAMPOS.rotatePivot')

        cmds.move(0,0,0,'CAMTILT.scalePivot')
        cmds.move(0,0,0,'CAMTILT.rotatePivot')

        cmds.setAttr('shotCAM.translateX',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.translateY',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.translateZ',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.rotateX',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.rotateY',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.rotateZ',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.scaleX',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.scaleY',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.scaleZ',e=True,l=True,k=False)
        cmds.setAttr('shotCAM.visibility',e=True,l=True,k=False)

        cmds.parent('shotCAM', 'CAMGRP')
        #CELAN-UP===================================================================================================

        #Parenting
        cmds.parent('cam','shotMaster')

        cmds.select(cl=True)
        return
Exemplo n.º 24
0
    def drawLine(self):
        """
        draw line between two position
        """
        
        if self.position0 == None or self.position1 == None:
            om.MGlobal.displayError("please specify the two position")
            return
        
        #create curve
        CRV = cmds.curve( d=1, p=[self.position0, self.position1], k=[0, 1], n= self.side + "_"+ self.moduleName + "_" + "CRV")
        
        #create cone and move pivot
        cone = cmds.polyCone(ch=False, o=True, r=0.05, h=0.1, cuv=3, n= self.side + "_"+ self.moduleName + "_" + "GEO")
        cmds.move(0, 0.05, 0, cone[0] + ".scalePivot", r=True )
        cmds.move(0, 0.05, 0, cone[0] + ".rotatePivot", r=True )
        
        objs = [CRV, cone]
        for obj in objs:    
            shapeNodes = cmds.listRelatives(obj, shapes=True)
            for shape in shapeNodes:
                try:
                    cmds.setAttr("{0}.overrideEnabled".format(shape), True)
                    cmds.setAttr("{0}.overrideColor".format(shape), self.colorIndex)
                except:
                    om.MGlobal.displayWarning("Failed to override color: {0}".format(shape))    
    
        #create cluster both end
        for i in range(2):
            clusterName = name.uniqueName(self.side + "_"+ self.moduleName + "_" + "CLT")
            clusters = cmds.cluster("%s.cv[%d]" % (CRV,i), n= self.side + "_"+ clusterName + "_" + "CLT" )
            print clusters
            cmds.setAttr("%s.visibility" % clusters[1], 0)
            self.cluster.append(clusters[1])
      
        #create locator
        startLoc = cmds.spaceLocator(p=(0, 0, 0), n= self.side + "_"+ self.moduleName + "_" + "LOC")
        cmds.move(self.position0[0], self.position0[1], self.position0[2], startLoc)
        endLoc = cmds.spaceLocator(p=(0, 0, 0), n= self.side + "_"+ self.moduleName + "_" + "LOC")
        cmds.move(self.position1[0], self.position1[1], self.position1[2], endLoc)
    
        #create annotation
        annotation = cmds.annotate( endLoc, tx='position:%s' % `self.position1`, p=self.position1)
        annotation = cmds.listRelatives(annotation, p=True)
        annotation = cmds.rename(annotation, self.side + "_"+ self.moduleName + "_" + "ANT")
        shape = cmds.listRelatives(annotation, shapes=True)
        cmds.setAttr("{0}.overrideEnabled".format(shape[0]), True)
        cmds.setAttr("{0}.overrideColor".format(shape[0]), self.colorIndex) 
               
        #create point locator
        cmds.pointConstraint(startLoc, self.cluster[0], offset=(0, 0, 0), weight=1, mo=False)
        cmds.pointConstraint(endLoc, self.cluster[1], offset=(0, 0, 0), weight=1, mo=False)
        cmds.pointConstraint(endLoc, annotation, offset=(0, 0, 0), weight=1, mo=False)
       
        cmds.pointConstraint(self.cluster[1], cone, offset=(0, 0, 0), weight=1, mo=False)
        cmds.aimConstraint(self.cluster[0], cone, offset=(0, 0, 0), weight=1, aimVector=(0, -1, 0),  upVector=(0, 1, 0), worldUpType="vector", worldUpVector=(0, 1, 0))
        
        #parenting
        cmds.parent(endLoc, startLoc)
        cmds.parent(annotation, startLoc)
        cmds.parent(self.cluster[0], startLoc)
        cmds.parent(self.cluster[1], startLoc)
        cmds.parent(cone, startLoc)
        cmds.parent(startLoc, self.groupNode)
        cmds.parent(CRV, self.groupNode)
        
        #cleanup
        attribute.lockAndHide(CRV, ['t', 'r', 's', 'v'], False)
        cmds.setAttr("RIG_GRP.overrideDisplayType", 0)
        cmds.setAttr(endLoc[0] + ".visibility", 0)

        return startLoc, endLoc 
Exemplo n.º 25
0
def genLocators(*args):
    print("Locaators")
    cmds.spaceLocator(n="rootLocator", p=[0, 0, 0])
    cmds.annotate("rootLocator", tx="root_Loc", p=[2, 2, 0])
    cmds.parent(cmds.ls(sl=True), "rootLocator")
    cmds.select("rootLocator")
Exemplo n.º 26
0
    def drawLine(self):
        """
        draw line between two position
        """

        if self.position0 == None or self.position1 == None:
            om.MGlobal.displayError("please specify the two position")
            return

        #create curve
        CRV = cmds.curve(d=1,
                         p=[self.position0, self.position1],
                         k=[0, 1],
                         n=self.side + "_" + self.moduleName + "_" + "CRV")

        #create cone and move pivot
        cone = cmds.polyCone(ch=False,
                             o=True,
                             r=0.05,
                             h=0.1,
                             cuv=3,
                             n=self.side + "_" + self.moduleName + "_" + "GEO")
        cmds.move(0, 0.05, 0, cone[0] + ".scalePivot", r=True)
        cmds.move(0, 0.05, 0, cone[0] + ".rotatePivot", r=True)

        objs = [CRV, cone]
        for obj in objs:
            shapeNodes = cmds.listRelatives(obj, shapes=True)
            for shape in shapeNodes:
                try:
                    cmds.setAttr("{0}.overrideEnabled".format(shape), True)
                    cmds.setAttr("{0}.overrideColor".format(shape),
                                 self.colorIndex)
                except:
                    om.MGlobal.displayWarning(
                        "Failed to override color: {0}".format(shape))

        #create cluster both end
        for i in range(2):
            clusterName = name.uniqueName(self.side + "_" + self.moduleName +
                                          "_" + "CLT")
            clusters = cmds.cluster("%s.cv[%d]" % (CRV, i),
                                    n=self.side + "_" + clusterName + "_" +
                                    "CLT")
            print clusters
            cmds.setAttr("%s.visibility" % clusters[1], 0)
            self.cluster.append(clusters[1])

        #create locator
        startLoc = cmds.spaceLocator(p=(0, 0, 0),
                                     n=self.side + "_" + self.moduleName +
                                     "_" + "LOC")
        cmds.move(self.position0[0], self.position0[1], self.position0[2],
                  startLoc)
        endLoc = cmds.spaceLocator(p=(0, 0, 0),
                                   n=self.side + "_" + self.moduleName + "_" +
                                   "LOC")
        cmds.move(self.position1[0], self.position1[1], self.position1[2],
                  endLoc)

        #create annotation
        annotation = cmds.annotate(endLoc,
                                   tx='position:%s' % ` self.position1 `,
                                   p=self.position1)
        annotation = cmds.listRelatives(annotation, p=True)
        annotation = cmds.rename(
            annotation, self.side + "_" + self.moduleName + "_" + "ANT")
        shape = cmds.listRelatives(annotation, shapes=True)
        cmds.setAttr("{0}.overrideEnabled".format(shape[0]), True)
        cmds.setAttr("{0}.overrideColor".format(shape[0]), self.colorIndex)

        #create point locator
        cmds.pointConstraint(startLoc,
                             self.cluster[0],
                             offset=(0, 0, 0),
                             weight=1,
                             mo=False)
        cmds.pointConstraint(endLoc,
                             self.cluster[1],
                             offset=(0, 0, 0),
                             weight=1,
                             mo=False)
        cmds.pointConstraint(endLoc,
                             annotation,
                             offset=(0, 0, 0),
                             weight=1,
                             mo=False)

        cmds.pointConstraint(self.cluster[1],
                             cone,
                             offset=(0, 0, 0),
                             weight=1,
                             mo=False)
        cmds.aimConstraint(self.cluster[0],
                           cone,
                           offset=(0, 0, 0),
                           weight=1,
                           aimVector=(0, -1, 0),
                           upVector=(0, 1, 0),
                           worldUpType="vector",
                           worldUpVector=(0, 1, 0))

        #parenting
        cmds.parent(endLoc, startLoc)
        cmds.parent(annotation, startLoc)
        cmds.parent(self.cluster[0], startLoc)
        cmds.parent(self.cluster[1], startLoc)
        cmds.parent(cone, startLoc)
        cmds.parent(startLoc, self.groupNode)
        cmds.parent(CRV, self.groupNode)

        #cleanup
        attribute.lockAndHide(CRV, ['t', 'r', 's', 'v'], False)
        cmds.setAttr("RIG_GRP.overrideDisplayType", 0)
        cmds.setAttr(endLoc[0] + ".visibility", 0)

        return startLoc, endLoc
Exemplo n.º 27
0
	def createGroups (self):
		# Setup object names
		body			= self.name + '_body'
		exterior		= self.name + '_exterior'
		interior		= self.name + '_interior'
		headLights		= self.name + '_headLights'
		tailLights		= self.name + '_tailLights'
		fogLights		= self.name + '_fogLights'
		sideLights		= self.name + '_sideLights'
		
		wheels			= self.name + '_wheels'
		wheelFL			= self.name + '_wheelFL'
		wheelFR			= self.name + '_wheelFR'
		wheelBL			= self.name + '_wheelBL'
		wheelBR			= self.name + '_wheelBR'
		brakeFL			= self.name + '_brakeFL'
		brakeFR			= self.name + '_brakeFR'
		brakeBL			= self.name + '_brakeBL'
		brakeBR			= self.name + '_brakeBR'
		
		headLightL		= 'null_' + self.name + '_headLightL1'
		headLightR		= 'null_' + self.name + '_headLightR1'
		fogLightL		= 'null_' + self.name + '_fogLightL1'
		fogLightR		= 'null_' + self.name + '_fogLightR1'
		tailLightL		= 'null_' + self.name + '_tailLightL1'
		tailLightR		= 'null_' + self.name + '_tailLightR1'
		contactFL		= 'null_' + self.name + '_contactFL'
		contactFR		= 'null_' + self.name + '_contactFR'
		contactBL		= 'null_' + self.name + '_contactBL'
		contactBR		= 'null_' + self.name + '_contactBR'
		
		# Setup Nulls
		locatorArray = []
		
		locatorArray.append (cmds.spaceLocator ( name = headLightL 	, position = ( 50 , 45 , 150 )))
		locatorArray.append (cmds.spaceLocator ( name = headLightR 	, position = ( -50 , 45 , 150 )))
		locatorArray.append (cmds.spaceLocator ( name = fogLightL 	, position = ( 50 , 30 , 150 )))
		locatorArray.append (cmds.spaceLocator ( name = fogLightR 	, position = ( -50 , 30 , 150 )))
		locatorArray.append (cmds.spaceLocator ( name = tailLightL 	, position = ( 50 , 65 , -170 )))
		locatorArray.append (cmds.spaceLocator ( name = tailLightR 	, position = ( -50 , 65 , -170 )))
		locatorArray.append (cmds.spaceLocator ( name = contactFL 	, position = ( 70 , 0 , 100 )))
		locatorArray.append (cmds.spaceLocator ( name = contactFR 	, position = ( -70 , 0 , 100 )))
		locatorArray.append (cmds.spaceLocator ( name = contactBL 	, position = ( 70 , 0 , -120 )))
		locatorArray.append (cmds.spaceLocator ( name = contactBR 	, position = ( -70 , 0 , -120 )))
		
		# Scale Nulls and set axis correctly		
		for locator in locatorArray:
			cmds.select ( locator[0] )
			locatorShape = cmds.pickWalk ( direction = 'down' )
			cmds.setAttr ( locator[0]+'.translateX' , cmds.getAttr ( locatorShape[0]+'.localPositionX' ))
			cmds.setAttr ( locator[0]+'.translateY' , cmds.getAttr ( locatorShape[0]+'.localPositionY' ))
			cmds.setAttr ( locator[0]+'.translateZ' , cmds.getAttr ( locatorShape[0]+'.localPositionZ' ))
			cmds.setAttr ( locatorShape[0]+'.localPositionX' , 0 )
			cmds.setAttr ( locatorShape[0]+'.localPositionY' , 0 )
			cmds.setAttr ( locatorShape[0]+'.localPositionZ' , 0 )
			cmds.xform ( locator[0] , centerPivots = True )
			cmds.setAttr ( locator[0]+'.localScaleX' , 10 )
			cmds.setAttr ( locator[0]+'.localScaleY' , 10 )
			cmds.setAttr ( locator[0]+'.localScaleZ' , 10 )

		# Annotate Wheel positions
		annotation = cmds.annotate( contactFL , point= (150,0,150) , text='FL' )
		cmds.select (annotation)
		cmds.pickWalk ( direction = 'up')
		cmds.rename ( self.name+'annotationFL' )
		cmds.parent ( self.name+'annotationFL' , contactFL )
		
		annotation = cmds.annotate( contactFR , point= (-150,0,150) , text='FR' )
		cmds.select (annotation)
		cmds.pickWalk ( direction = 'up')
		cmds.rename ( self.name+'annotationFR' )
		cmds.parent ( self.name+'annotationFR' , contactFR )


		annotation = cmds.annotate( contactBL , point= (150,0,-150) , text='BL' )
		cmds.select (annotation)
		cmds.pickWalk ( direction = 'up')
		cmds.rename ( self.name+'annotationBL' )
		cmds.parent ( self.name+'annotationBL' , contactBL )


		annotation = cmds.annotate( contactBR , point= (-150,0,-150) , text='BR' )
		cmds.select (annotation)
		cmds.pickWalk ( direction = 'up')
		cmds.rename ( self.name+'annotationBR' )
		cmds.parent ( self.name+'annotationBR' , contactBR )


		
		# Group Structure
		alloy = '_alloy'
		tyre = '_tyre'
		
		
		cmds.group ( em=True, name = wheelFL+alloy )
		cmds.group ( em=True, name = wheelFL+tyre )
		cmds.group ( em=True, name = wheelFR+alloy )
		cmds.group ( em=True, name = wheelFR+tyre )
		cmds.group ( em=True, name = wheelBL+alloy )
		cmds.group ( em=True, name = wheelBL+tyre )
		cmds.group ( em=True, name = wheelBR+alloy )
		cmds.group ( em=True, name = wheelBR+tyre )
		cmds.group ( wheelFL+alloy , wheelFL+tyre , name = wheelFL )
		cmds.group ( wheelFR+alloy , wheelFR+tyre , name = wheelFR )
		cmds.group ( wheelBL+alloy , wheelBL+tyre , name = wheelBL )
		cmds.group ( wheelBR+alloy , wheelBR+tyre , name = wheelBR )
		cmds.group ( contactFL , name = brakeFL )
		cmds.group ( contactFR , name = brakeFR )
		cmds.group ( contactBL , name = brakeBL )
		cmds.group ( contactBR , name = brakeBR )
		cmds.group ( em=True, name = exterior )
		cmds.group ( em=True, name = interior )
		cmds.group ( headLightL , headLightR , name = headLights )
		cmds.group ( tailLightL , tailLightR , name = tailLights )
		cmds.group ( fogLightL , fogLightR , name = fogLights )
		cmds.group ( em=True, name = sideLights )
		
		cmds.group ( wheelFL , wheelFR , wheelBL , wheelBR , brakeFL , brakeFR , brakeBL , brakeBR , name = wheels )
		cmds.group ( headLights , tailLights , fogLights , sideLights , exterior , interior , name = body )
		cmds.group ( wheels , body , name = self.name )
		
		# Set object IDs on wheels and Lights
		
		mel.eval('vrayAddAttr ' + tailLights + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + fogLights + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + sideLights + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + headLights + ' vrayObjectID')

		mel.eval('vrayAddAttr ' + wheelFL+alloy + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + wheelFL+tyre + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + wheelFR+alloy + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + wheelFR+tyre + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + wheelBL+alloy + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + wheelBL+tyre + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + wheelBR+alloy + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + wheelBR+tyre + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + brakeFL + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + brakeFR + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + brakeBL + ' vrayObjectID')
		mel.eval('vrayAddAttr ' + brakeBR + ' vrayObjectID')
		
		cmds.setAttr ( tailLights+'.vrayObjectID' , 4 )
		cmds.setAttr ( fogLights+'.vrayObjectID' , 5 )
		cmds.setAttr ( sideLights+'.vrayObjectID' , 5 )
		cmds.setAttr ( headLights+'.vrayObjectID' , 6 )

		cmds.setAttr ( brakeFL+'.vrayObjectID' , 10 )
		cmds.setAttr ( brakeFR+'.vrayObjectID' , 10 )
		cmds.setAttr ( brakeBL+'.vrayObjectID' , 10 )
		cmds.setAttr ( brakeBR+'.vrayObjectID' , 10 )
		cmds.setAttr ( wheelFL+tyre+'.vrayObjectID' , 11 )
		cmds.setAttr ( wheelFL+alloy+'.vrayObjectID' , 12 )
		cmds.setAttr ( wheelFR+tyre+'.vrayObjectID' , 11 )
		cmds.setAttr ( wheelFR+alloy+'.vrayObjectID' , 12 )
		cmds.setAttr ( wheelBL+tyre+'.vrayObjectID' , 11 )
		cmds.setAttr ( wheelBL+alloy+'.vrayObjectID' , 12 )
		cmds.setAttr ( wheelBR+tyre+'.vrayObjectID' , 11 )
		cmds.setAttr ( wheelBR+alloy+'.vrayObjectID' , 12 )
		
		cmds.select ( self.name , replace = True )
		cmds.addAttr ( longName='isCar', attributeType='message' )			
Exemplo n.º 28
0
    def createGroups(self):
        # Setup object names
        body = self.name + '_body'
        exterior = self.name + '_exterior'
        interior = self.name + '_interior'
        headLights = self.name + '_headLights'
        tailLights = self.name + '_tailLights'
        fogLights = self.name + '_fogLights'
        sideLights = self.name + '_sideLights'

        wheels = self.name + '_wheels'
        wheelFL = self.name + '_wheelFL'
        wheelFR = self.name + '_wheelFR'
        wheelBL = self.name + '_wheelBL'
        wheelBR = self.name + '_wheelBR'
        brakeFL = self.name + '_brakeFL'
        brakeFR = self.name + '_brakeFR'
        brakeBL = self.name + '_brakeBL'
        brakeBR = self.name + '_brakeBR'

        headLightL = 'null_' + self.name + '_headLightL1'
        headLightR = 'null_' + self.name + '_headLightR1'
        fogLightL = 'null_' + self.name + '_fogLightL1'
        fogLightR = 'null_' + self.name + '_fogLightR1'
        tailLightL = 'null_' + self.name + '_tailLightL1'
        tailLightR = 'null_' + self.name + '_tailLightR1'
        contactFL = 'null_' + self.name + '_contactFL'
        contactFR = 'null_' + self.name + '_contactFR'
        contactBL = 'null_' + self.name + '_contactBL'
        contactBR = 'null_' + self.name + '_contactBR'

        # Setup Nulls
        locatorArray = []

        locatorArray.append(
            cmds.spaceLocator(name=headLightL, position=(50, 45, 150)))
        locatorArray.append(
            cmds.spaceLocator(name=headLightR, position=(-50, 45, 150)))
        locatorArray.append(
            cmds.spaceLocator(name=fogLightL, position=(50, 30, 150)))
        locatorArray.append(
            cmds.spaceLocator(name=fogLightR, position=(-50, 30, 150)))
        locatorArray.append(
            cmds.spaceLocator(name=tailLightL, position=(50, 65, -170)))
        locatorArray.append(
            cmds.spaceLocator(name=tailLightR, position=(-50, 65, -170)))
        locatorArray.append(
            cmds.spaceLocator(name=contactFL, position=(70, 0, 100)))
        locatorArray.append(
            cmds.spaceLocator(name=contactFR, position=(-70, 0, 100)))
        locatorArray.append(
            cmds.spaceLocator(name=contactBL, position=(70, 0, -120)))
        locatorArray.append(
            cmds.spaceLocator(name=contactBR, position=(-70, 0, -120)))

        # Scale Nulls and set axis correctly
        for locator in locatorArray:
            cmds.select(locator[0])
            locatorShape = cmds.pickWalk(direction='down')
            cmds.setAttr(locator[0] + '.translateX',
                         cmds.getAttr(locatorShape[0] + '.localPositionX'))
            cmds.setAttr(locator[0] + '.translateY',
                         cmds.getAttr(locatorShape[0] + '.localPositionY'))
            cmds.setAttr(locator[0] + '.translateZ',
                         cmds.getAttr(locatorShape[0] + '.localPositionZ'))
            cmds.setAttr(locatorShape[0] + '.localPositionX', 0)
            cmds.setAttr(locatorShape[0] + '.localPositionY', 0)
            cmds.setAttr(locatorShape[0] + '.localPositionZ', 0)
            cmds.xform(locator[0], centerPivots=True)
            cmds.setAttr(locator[0] + '.localScaleX', 10)
            cmds.setAttr(locator[0] + '.localScaleY', 10)
            cmds.setAttr(locator[0] + '.localScaleZ', 10)

        # Annotate Wheel positions
        annotation = cmds.annotate(contactFL, point=(150, 0, 150), text='FL')
        cmds.select(annotation)
        cmds.pickWalk(direction='up')
        cmds.rename(self.name + 'annotationFL')
        cmds.parent(self.name + 'annotationFL', contactFL)

        annotation = cmds.annotate(contactFR, point=(-150, 0, 150), text='FR')
        cmds.select(annotation)
        cmds.pickWalk(direction='up')
        cmds.rename(self.name + 'annotationFR')
        cmds.parent(self.name + 'annotationFR', contactFR)

        annotation = cmds.annotate(contactBL, point=(150, 0, -150), text='BL')
        cmds.select(annotation)
        cmds.pickWalk(direction='up')
        cmds.rename(self.name + 'annotationBL')
        cmds.parent(self.name + 'annotationBL', contactBL)

        annotation = cmds.annotate(contactBR, point=(-150, 0, -150), text='BR')
        cmds.select(annotation)
        cmds.pickWalk(direction='up')
        cmds.rename(self.name + 'annotationBR')
        cmds.parent(self.name + 'annotationBR', contactBR)

        # Group Structure
        alloy = '_alloy'
        tyre = '_tyre'

        cmds.group(em=True, name=wheelFL + alloy)
        cmds.group(em=True, name=wheelFL + tyre)
        cmds.group(em=True, name=wheelFR + alloy)
        cmds.group(em=True, name=wheelFR + tyre)
        cmds.group(em=True, name=wheelBL + alloy)
        cmds.group(em=True, name=wheelBL + tyre)
        cmds.group(em=True, name=wheelBR + alloy)
        cmds.group(em=True, name=wheelBR + tyre)
        cmds.group(wheelFL + alloy, wheelFL + tyre, name=wheelFL)
        cmds.group(wheelFR + alloy, wheelFR + tyre, name=wheelFR)
        cmds.group(wheelBL + alloy, wheelBL + tyre, name=wheelBL)
        cmds.group(wheelBR + alloy, wheelBR + tyre, name=wheelBR)
        cmds.group(contactFL, name=brakeFL)
        cmds.group(contactFR, name=brakeFR)
        cmds.group(contactBL, name=brakeBL)
        cmds.group(contactBR, name=brakeBR)
        cmds.group(em=True, name=exterior)
        cmds.group(em=True, name=interior)
        cmds.group(headLightL, headLightR, name=headLights)
        cmds.group(tailLightL, tailLightR, name=tailLights)
        cmds.group(fogLightL, fogLightR, name=fogLights)
        cmds.group(em=True, name=sideLights)

        cmds.group(wheelFL,
                   wheelFR,
                   wheelBL,
                   wheelBR,
                   brakeFL,
                   brakeFR,
                   brakeBL,
                   brakeBR,
                   name=wheels)
        cmds.group(headLights,
                   tailLights,
                   fogLights,
                   sideLights,
                   exterior,
                   interior,
                   name=body)
        cmds.group(wheels, body, name=self.name)

        # Set object IDs on wheels and Lights

        mel.eval('vrayAddAttr ' + tailLights + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + fogLights + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + sideLights + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + headLights + ' vrayObjectID')

        mel.eval('vrayAddAttr ' + wheelFL + alloy + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + wheelFL + tyre + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + wheelFR + alloy + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + wheelFR + tyre + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + wheelBL + alloy + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + wheelBL + tyre + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + wheelBR + alloy + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + wheelBR + tyre + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + brakeFL + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + brakeFR + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + brakeBL + ' vrayObjectID')
        mel.eval('vrayAddAttr ' + brakeBR + ' vrayObjectID')

        cmds.setAttr(tailLights + '.vrayObjectID', 4)
        cmds.setAttr(fogLights + '.vrayObjectID', 5)
        cmds.setAttr(sideLights + '.vrayObjectID', 5)
        cmds.setAttr(headLights + '.vrayObjectID', 6)

        cmds.setAttr(brakeFL + '.vrayObjectID', 10)
        cmds.setAttr(brakeFR + '.vrayObjectID', 10)
        cmds.setAttr(brakeBL + '.vrayObjectID', 10)
        cmds.setAttr(brakeBR + '.vrayObjectID', 10)
        cmds.setAttr(wheelFL + tyre + '.vrayObjectID', 11)
        cmds.setAttr(wheelFL + alloy + '.vrayObjectID', 12)
        cmds.setAttr(wheelFR + tyre + '.vrayObjectID', 11)
        cmds.setAttr(wheelFR + alloy + '.vrayObjectID', 12)
        cmds.setAttr(wheelBL + tyre + '.vrayObjectID', 11)
        cmds.setAttr(wheelBL + alloy + '.vrayObjectID', 12)
        cmds.setAttr(wheelBR + tyre + '.vrayObjectID', 11)
        cmds.setAttr(wheelBR + alloy + '.vrayObjectID', 12)

        cmds.select(self.name, replace=True)
        cmds.addAttr(longName='isCar', attributeType='message')
Exemplo n.º 29
0
def createAnnotationForBS():

    sel = cmds.ls(sl=True, l=True)

    if len(sel) < 1:
        cmds.warning('Nothing is selected.')

    if len(sel) > 1:
        cmds.warning("Select Only 1 object with a blendShape deformer.")

    if len(sel) == 1:

        bbox = cmds.exactWorldBoundingBox(sel[0])

        history = cmds.listHistory(sel[0])
        blendShapeNode = cmds.ls(history, type="blendShape", l=True)[0]

        blendAttrSize = cmds.getAttr(blendShapeNode + ".weight")

        groupName = sel[0].split('|')[-1] + "_annotations_GRP"

        if not cmds.objExists(groupName):
            cmds.group(em=True, name=groupName)

        for i in range(len(blendAttrSize[0])):

            attrName = blendShapeNode + ".weight[" + str(i) + "]"
            attrValue = float(int(cmds.getAttr(attrName) * 1000)) / 1000

            targetName = str(cmds.aliasAttr(attrName, q=True))

            annotationName = targetName + "_annotation"

            if not cmds.objExists(annotationName):

                annotation = cmds.annotate(
                    sel[0],
                    tx=targetName + " : " + str(attrValue),
                    p=(bbox[0] * 2, bbox[4] - i, (bbox[2] + bbox[5]) / 2))
                tempAnnotationName = cmds.listRelatives(annotation, p=True)[0]

                cmds.rename(tempAnnotationName, annotationName)
                cmds.setAttr(annotationName + ".displayArrow", 0)
                cmds.setAttr(annotationName + "Shape.overrideEnabled", 1)
                cmds.setAttr(annotationName + "Shape.overrideRGBColors", 1)
                cmds.setAttr(annotationName + "Shape.overrideColorR", 1)
                cmds.setAttr(annotationName + "Shape.overrideColorG", 1)
                cmds.setAttr(annotationName + "Shape.overrideColorB", 0)

                cmds.parent(annotationName, groupName)

            cmds.setAttr(annotationName + ".text",
                         targetName + " : " + str(attrValue),
                         type="string")
            '''
			Create Expression to refresh value
			'''
        expressionNodeName = blendShapeNode + "_expression"
        expressionSTR = 'string $cmd = "displayBlendShapeWeight.updateBSAnnotations();";\npython($cmd);'

        if cmds.objExists(expressionNodeName):
            pass
        else:
            cmds.expression(n=expressionNodeName, s=expressionSTR)
Exemplo n.º 30
0
    def CreatePVControl(self, Prefix, Suffix, PVPush, ControlSize):
        #create polygon at hip knee ankle
        #set pivot to average of hip ankle
        hipPos = cmds.xform(self.hipJnt, q=1, ws=1, rp=1)
        kneePos = cmds.xform(self.kneeJnt, q=1, ws=1, rp=1)
        anklePos = cmds.xform(self.ankleJnt, q=1, ws=1, rp=1)

        point_list = [hipPos, kneePos, anklePos]
        point_list_2 = [hipPos, anklePos]

        legPVCurve = cmds.curve(degree=1, point=point_list)
        kneePivotCurve = cmds.curve(degree=1, point=point_list_2)

        #create node
        nearestPOCNode = cmds.createNode("nearestPointOnCurve")
        cmds.connectAttr(kneePivotCurve + ".worldSpace",
                         nearestPOCNode + ".inputCurve")
        cmds.setAttr(nearestPOCNode + ".inPosition",
                     kneePos[0],
                     kneePos[1],
                     kneePos[2],
                     type="double3")

        halfwayPos = cmds.getAttr(nearestPOCNode + ".position")[0]

        #adjust the pivot so that it gives us a nice approximation of the knee
        cmds.move(halfwayPos[0],
                  halfwayPos[1],
                  halfwayPos[2],
                  legPVCurve + ".scalePivot",
                  legPVCurve + ".rotatePivot",
                  absolute=True)

        #scale the curve to project our knee pv point forward
        cmds.select(legPVCurve)
        cmds.scale(PVPush, PVPush, PVPush)

        #get position of knee from curve (hip = 0, knee = 1, ankle = 2)
        controlPos = cmds.pointPosition(legPVCurve + '.cv[1]')
        controlPoint = (controlPos[0], controlPos[1], controlPos[2])
        #create diamond shape at pos
        #name with assigned prefix and suffix, size will match joint radius as a base
        control = cmds.curve(name=Prefix + self.LEG_JNT_NAMES[1] + Suffix,
                             degree=1,
                             point=ShapeUtils.diamondControlPath())
        cmds.select(control)
        cmds.move(controlPos[0], controlPos[1], controlPos[2])
        cmds.scale(ControlSize, ControlSize, ControlSize)
        cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)

        #create null annotation at diamond pointing to child locator
        cmds.select(clear=True)
        locator = cmds.spaceLocator(n=Prefix + self.LEG_JNT_NAMES[1] +
                                    "PVGuide_LOC")[0]
        group = cmds.group(em=True,
                           name=Prefix + self.LEG_JNT_NAMES[1] +
                           "PVOffset_GRP")
        annotation = cmds.annotate(locator, tx='')
        anno_transfrom = cmds.listRelatives(annotation, allParents=True)[0]
        anno_transfrom = cmds.rename(
            anno_transfrom, Prefix + self.LEG_JNT_NAMES[1] + "PVGuide_ANT")
        annotation = cmds.listRelatives(anno_transfrom)[0]

        #point constrain the annotation to the knee
        cmds.pointConstraint(self.kneeJnt, anno_transfrom)
        #move locator to position and parent
        cmds.parent(locator, control)
        cmds.move(controlPos[0],
                  controlPos[1],
                  controlPos[2],
                  locator,
                  absolute=True)
        cmds.parent(anno_transfrom, locator)

        cmds.move(controlPos[0],
                  controlPos[1],
                  controlPos[2],
                  group,
                  absolute=True)
        cmds.parent(control, group)

        #pole vector the ikh and the diamond
        cmds.poleVectorConstraint(control, self.legIKHandle)

        #cleanup
        cmds.delete(nearestPOCNode)
        cmds.delete(legPVCurve)
        cmds.delete(kneePivotCurve)
        cmds.setAttr(locator + ".localScaleX", 0)
        cmds.setAttr(locator + ".localScaleY", 0)
        cmds.setAttr(locator + ".localScaleZ", 0)
        cmds.select(annotation)
        cmds.toggle(template=True)
Exemplo n.º 31
0
    def createCamHUD_Fn(self):

        cmds.setAttr('%s.v' % self.selCam[0], lock=False)
        cmds.setAttr('%s.v' % self.selCam[0], 1)
        self.camShape = cmds.listRelatives(self.selCam, s=1)

        # Create HUD Annotation
        cmds.select(cl=1)
        self.sceneInfoLoc = cmds.spaceLocator(n='%s.sceneInfoLocator' %
                                              self.selCam[0])
        cmds.setAttr('%sShape.lodVisibility' % self.sceneInfoLoc[0], 0)
        labelList = [('%s_sceneName' % self.selCam[0]),
                     ('%s_userInfo' % self.selCam[0]),
                     ('%s_cameraName' % self.selCam[0]),
                     ('%s_sceneInfo' % self.selCam[0])]
        anntList = []
        anntGrpList = []
        for i, each in enumerate(range(1, 5)):
            ant = cmds.annotate(self.sceneInfoLoc)
            annt = cmds.rename('annotation1', labelList[i])
            cmds.setAttr('%s.tx' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.ty' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.tz' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.rx' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.ry' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.rz' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.sx' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.sy' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.sz' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.displayArrow' % annt, 0)
            anntGrp = cmds.group(n='label_%s' % labelList[i], em=0)
            anntGrpList.append(anntGrp)
            cmds.parent(anntGrp, self.sceneInfoLoc)
            anntList.append(annt)
        # Create Expression for each Annotation
        if cmds.objExists('CAM_Ex_displayFrameCount'):
            cmds.select(cl=1)
            cmds.select('%sShape' % anntList[3])
            newSceneInfoAnnt = cmds.ls(sl=1)
            cmds.select(cl=1)
            cmds.select('*_sceneInfoShape', add=1)
            sceneInfoAnntList = cmds.ls(sl=1)
            sceneInfoAnntList.remove(newSceneInfoAnnt[0])
            cmds.connectAttr('%s.text' % sceneInfoAnntList[0],
                             '%s.text' % newSceneInfoAnnt[0])
            cmds.select(cl=1)
        else:
            cmds.expression(
                s=
                "//-------set timecode seconds padding--------- \nglobal proc string secondsPadding(int $num)\n{\nstring $tmp;\nint $pad;\n\n$tmp = $num;\n$pad = size($tmp);\n\nif($pad == 1)\n{\nreturn (\"0\" + $tmp);\n}\nelse\n{\nreturn $tmp;\n}\n}\n\n//-------set timecode frames padding\nglobal proc string framesPadding(int $num)\n{\nstring $tmp;\nint $pad;\n\n$tmp = $num;\n$pad = size($tmp);\n\nif($pad == 1)\n{\nreturn (\"0\" + $tmp);\n}\nelse\n{\nreturn $tmp;\n}\n}\n\n$ct = `currentTime -q`;\n$fps = `currentTimeUnitToFPS`;\n$s = ($ct % (60 * $fps)) / $fps;\n$f = ($ct % $fps);\nif ($f == 0)\n{ \n$f = 25;\n$s = $s - 1;\n}\n$ss = secondsPadding($s);\n$ff = framesPadding($f);\n\nstring $sequence = .I[0];\nstring $seqpad = substring(\"-0000\",1,4-size($sequence));\nstring $sq = $seqpad + $sequence;\n\nstring $scene = .I[1];\nstring $scpad = substring(\"-0000\",1,4-size($scene));\nstring $sc = $scpad + $scene;\n\nint $sceneindex = .I[2];\nstring $sceneletter = \"\";\nif ($sceneindex > 0)\n{\n$sceneletter = substring(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", $sceneindex, $sceneindex);\n}\nstring $sclabel = $sc + $sceneletter;\n\nstring $cTxt = \"sq\" + $sq + \" sc\" + $sclabel + \" | fr-\";\n\n// get the global frame number as a string\n//string $annotation1Text = `file -q -sn -shn` + \" | \" + frame + (\" / \" + `playbackOptions -q -maxTime`) + \" | \" + ($ss + \":\" + $ff);\nstring $annotation1Text = frame + (\" / \" + `playbackOptions -q -maxTime`) + \" | \" + ($ss + \":\" + $ff);\n\n// set it to annotationShape1.text attribute \nstring $prefix[] = `ls -s \"*sceneInfoShape\"`;\nstring $frameLabel = $prefix[0] +  \".text\" ;\nsetAttr -type \"string\"  $frameLabel $annotation1Text;",
                o='%sShape' % str(anntList[0]),
                n='CAM_Ex_displayFrameCount',
                ae=1,
                uc='none')
        # Modify Annotions Location
        cmds.xform(anntGrpList[0], t=[1.724, 0.01, 0])
        cmds.xform(anntGrpList[1], t=[4.014, 0.01, 0])
        cmds.xform(anntGrpList[2], t=[1.724, -1.268, 0])
        cmds.xform(anntGrpList[3], t=[3.974, -1.268, 0])
        cmds.xform(self.sceneInfoLoc,
                   t=[-0.250, 0.205, -0.005],
                   s=[0.146, 0.336, 0.336])
        # Lock Attributes
        for each in anntGrpList:
            cmds.setAttr('%s.tx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ty' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.tz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ry' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sy' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.overrideEnabled' % each, 1)
        # Set Labels Color
        cmds.setAttr('%s.overrideColor' % anntGrpList[0], 18)
        cmds.setAttr('%s.overrideColor' % anntGrpList[1], 18)
        cmds.setAttr('%s.overrideColor' % anntGrpList[2], 18)
        cmds.setAttr('%s.overrideColor' % anntGrpList[3], 17)
        # Set Label Name
        fileName = cmds.file(q=1, sn=1, shn=1)
        userName = os.getenv("user")
        cmds.setAttr('%sShape.text' % anntList[0], fileName, type="string")
        cmds.setAttr('%sShape.text' % anntList[1], userName, type="string")
        cmds.setAttr('%sShape.text' % anntList[2],
                     self.selCam[0],
                     type="string")

        # Create Film Gates and Fulcrum
        self.prism = cmds.polyPyramid(n='%s_fulcrum' % self.selCam[0], ch=0)
        cmds.xform(self.prism,
                   ro=[90, 0, 45],
                   sp=[0, 0.353553, 0],
                   rp=[0, 0.353553, 0])
        tmpCnst = cmds.pointConstraint(self.selCam, self.prism, mo=0)
        cmds.delete(tmpCnst)
        cmds.makeIdentity(self.prism, a=1, t=1, r=1, s=1)
        cmds.xform(self.prism, t=[0, 0, 0.662], s=[0.86, 0.49, 1])
        cmds.makeIdentity(self.prism, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.prism[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.prism[0], 1)
        self.TVsafe = cmds.polyPlane(n='%s_TVsafe_4x3' % self.selCam[0],
                                     sx=1,
                                     sy=1,
                                     ch=0)
        cmds.xform(self.TVsafe, ro=[90, 0, 0], s=[0.554, 0.410, 0.410])
        cmds.makeIdentity(self.TVsafe, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.TVsafe[0], 1)
        cmds.setAttr('%sShape.overrideLevelOfDetail' % self.TVsafe[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.TVsafe[0], 1)
        self.filmGateA = cmds.polyPlane(n='%s_Filmgate_4x3' % self.selCam[0],
                                        sx=1,
                                        sy=1,
                                        ch=0)
        cmds.xform(self.filmGateA, ro=[90, 0, 0], s=[0.613, 0.4, 0.454])
        cmds.makeIdentity(self.filmGateA, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.filmGateA[0], 1)
        cmds.setAttr('%sShape.overrideLevelOfDetail' % self.filmGateA[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.filmGateA[0], 1)
        self.tvGateGrp = cmds.group(n='%s_TV_4x3_adjust' % self.selCam[0],
                                    em=0)
        cmds.parent(self.TVsafe, self.tvGateGrp)
        self.filmGateB = cmds.polyPlane(n='%s_Filmgate_16x9' % self.selCam[0],
                                        sx=1,
                                        sy=1,
                                        ch=0)
        cmds.xform(self.filmGateB, ro=[90, 0, 0], s=[0.806, 0.453, 0.453])
        cmds.makeIdentity(self.filmGateB, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.filmGateB[0], 1)
        cmds.setAttr('%sShape.overrideLevelOfDetail' % self.filmGateB[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.filmGateB[0], 1)
        self.clipGrp = cmds.group(n='%s_lock_to_clipping' % self.selCam[0],
                                  em=0)
        cmds.parent(self.sceneInfoLoc, self.tvGateGrp, self.filmGateB)
        cmds.xform(self.clipGrp, t=[0, 0, -0.345], s=[6.1, 4.56, 4.56])
        self.guideGrp = cmds.group(n='%s_GUIDES' % self.selCam[0], em=1)
        cmds.parent(self.clipGrp, self.guideGrp)
        cmds.xform(self.guideGrp, t=[0, 0, -0.662], s=[0.875, 0.875, 1])
        gates = [
            '%s_TVsafe_4x3' % self.selCam[0],
            '%s_Filmgate_4x3' % self.selCam[0]
        ]
        for each in gates:
            cmds.setAttr('%s.tx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ty' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.tz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ry' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sy' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sz' % each, l=1, k=0, cb=0)

        # Setup Camera
        cmds.modelEditor('modelPanel4', e=1, dim=1)
        cmds.setAttr('%s.nearClipPlane' % self.camShape[0], lock=False)
        cmds.setAttr('%s.nearClipPlane' % self.camShape[0], 1)
        cmds.setAttr('%s.farClipPlane' % self.camShape[0], lock=False)
        cmds.setAttr('%s.farClipPlane' % self.camShape[0], 100000)
        cmds.setAttr('%s.filmFit' % self.camShape[0], lock=False)
        cmds.setAttr('%s.filmFit' % self.camShape[0], 3)
        self.guideSdk = cmds.group(n='%s_GUIDE_sdk' % self.selCam[0], em=1)
        self.guideAlign = cmds.group(n='%s_GUIDE_align' % self.selCam[0], em=0)
        self.guideSpace = cmds.group(n='%s_GUIDE_space' % self.selCam[0], em=0)
        cmds.parent(self.guideGrp, self.guideSdk)
        tmpScale = cmds.scaleConstraint(self.selCam, self.guideSpace, mo=0)
        tmpCnst = cmds.parentConstraint(self.selCam, self.guideSpace, mo=0)
        cmds.delete(tmpCnst, tmpScale)
        tmpScale = cmds.scaleConstraint(self.selCam, self.prism, mo=0)
        tmpCnst = cmds.parentConstraint(self.selCam, self.prism, mo=0)
        cmds.delete(tmpCnst, tmpScale)
        cmds.parent(self.prism, self.guideGrp)
        cmds.parentConstraint(self.selCam, self.guideSpace, mo=0)
        cmds.scaleConstraint(self.selCam, self.guideSpace, mo=0)
        # Hide All Default Maya HUD
        defaultHUD = cmds.headsUpDisplay(lv=0)
        # setUp Camera Attributes
        cmds.addAttr(self.selCam[0], ln='EXTRA', at='enum', en='-')
        cmds.setAttr('%s.EXTRA' % self.selCam[0],
                     e=1,
                     l=False,
                     k=False,
                     cb=True)
        cmds.addAttr(self.camShape[0], ln='type', dt='string')
        cmds.setAttr('%s.type' % self.camShape[0], e=1, k=True)
        cmds.setAttr('%s.type' % self.camShape[0], 'shotCam', type="string")
        # TV Adjust Attributes
        cmds.addAttr(self.selCam[0], ln='TVGateVis', at='enum', en='Off:On:')
        cmds.setAttr('%s.TVGateVis' % self.selCam[0], e=1, k=True)
        cmds.connectAttr('%s.TVGateVis' % self.selCam[0],
                         '%s.v' % self.tvGateGrp)
        cmds.addAttr(self.selCam[0],
                     ln='TVsafeActionAdjust',
                     at='float',
                     hnv=1,
                     hxv=1,
                     max=1,
                     min=-1)
        cmds.setAttr('%s.TVsafeActionAdjust' % self.selCam[0], e=1, k=True)
        self.tvAdjustMD = cmds.createNode('multiplyDivide',
                                          n='CAM_tvAdjust_multiplier')
        cmds.connectAttr('%s.TVsafeActionAdjust' % self.selCam[0],
                         '%s.input1X' % self.tvAdjustMD)
        cmds.setAttr('%s.input2X' % self.tvAdjustMD, 0.025)
        cmds.connectAttr('%s.outputX' % self.tvAdjustMD,
                         '%s.translateX' % self.tvGateGrp)
        # fulcrum Attributes
        cmds.addAttr(self.selCam[0], ln='fulcrumVis', at='enum', en='Off:On:')
        cmds.setAttr('%s.fulcrumVis' % self.selCam[0], e=1, k=True)
        cmds.connectAttr('%s.fulcrumVis' % self.selCam[0],
                         '%s.v' % self.prism[0])
        cmds.addAttr(self.selCam[0],
                     ln='fulcrumSize',
                     at='float',
                     hnv=1,
                     min=1)
        cmds.setAttr('%s.fulcrumSize' % self.selCam[0], 3)
        cmds.setAttr('%s.fulcrumSize' % self.selCam[0], e=1, k=True)
        self.prismScalerMD = cmds.createNode('multiplyDivide',
                                             n='CAM_fulcrumScaler')
        cmds.connectAttr('%s.fulcrumSize' % self.selCam[0],
                         '%s.input1X' % self.prismScalerMD)
        cmds.connectAttr('%s.fulcrumSize' % self.selCam[0],
                         '%s.input1Y' % self.prismScalerMD)
        cmds.connectAttr('%s.fulcrumSize' % self.selCam[0],
                         '%s.input1Z' % self.prismScalerMD)
        cmds.setAttr('%s.input2X' % self.prismScalerMD, 10)
        cmds.setAttr('%s.input2Y' % self.prismScalerMD, 10)
        cmds.setAttr('%s.input2Z' % self.prismScalerMD, 10)
        cmds.connectAttr('%s.outputX' % self.prismScalerMD,
                         '%s.sx' % self.prism[0])
        cmds.connectAttr('%s.outputY' % self.prismScalerMD,
                         '%s.sy' % self.prism[0])
        cmds.connectAttr('%s.outputZ' % self.prismScalerMD,
                         '%s.sz' % self.prism[0])
        # FOV Setup
        self.focalMD = cmds.createNode('multiplyDivide', n='CAM_guides_to_FOV')
        cmds.setAttr('%s.operation' % self.focalMD, 2)
        cmds.setAttr('%s.input1X' % self.focalMD, 35)
        cmds.connectAttr('%s.focalLength' % self.camShape[0],
                         '%s.input2X' % self.focalMD)
        cmds.connectAttr('%s.outputX' % self.focalMD, '%s.sx' % self.guideGrp)
        cmds.connectAttr('%s.outputX' % self.focalMD, '%s.sy' % self.guideGrp)
        # clipping Setup
        cmds.addAttr(self.selCam[0], ln='nearClip', at='float', hnv=1, min=0)
        cmds.setAttr('%s.nearClip' % self.selCam[0], e=1, k=True)
        cmds.setAttr('%s.nearClip' % self.selCam[0], 1)
        cmds.addAttr(self.selCam[0], ln='farClip', at='float')
        cmds.setAttr('%s.farClip' % self.selCam[0], e=1, k=True)
        cmds.setAttr('%s.farClip' % self.selCam[0], 1000000)
        cmds.connectAttr('%s.nearClip' % self.selCam[0],
                         '%s.nearClipPlane' % self.camShape[0])
        cmds.connectAttr('%s.farClip' % self.selCam[0],
                         '%s.farClipPlane' % self.camShape[0])
        self.nearClipMD = cmds.createNode('multiplyDivide',
                                          n='CAM_clippingControl01')
        cmds.setAttr('%s.input2X' % self.nearClipMD, -1)
        cmds.setAttr('%s.input2Y' % self.nearClipMD, 1.51)
        cmds.setAttr('%s.input1Z' % self.nearClipMD, 1)
        cmds.connectAttr('%s.nearClip' % self.selCam[0],
                         '%s.input1X' % self.nearClipMD)
        cmds.connectAttr('%s.nearClip' % self.selCam[0],
                         '%s.input1Y' % self.nearClipMD)
        cmds.connectAttr('%s.outputX' % self.nearClipMD,
                         '%s.tz' % self.clipGrp)
        self.nearClipPMA = cmds.createNode('plusMinusAverage',
                                           n='CAM_clippingControl02')
        cmds.connectAttr('%s.outputY' % self.nearClipMD,
                         '%s.input1D[1]' % self.nearClipPMA)
        cmds.connectAttr('%s.outputZ' % self.nearClipMD,
                         '%s.input1D[0]' % self.nearClipPMA)
        cmds.connectAttr('%s.output1D' % self.nearClipPMA,
                         '%s.sx' % self.clipGrp)
        cmds.connectAttr('%s.output1D' % self.nearClipPMA,
                         '%s.sy' % self.clipGrp)
        cmds.connectAttr('%s.output1D' % self.nearClipPMA,
                         '%s.sz' % self.clipGrp)
        # AperTure Setup
        self.honMD01 = cmds.createNode('multiplyDivide',
                                       n='horizontalApperture_MD01')
        cmds.setAttr('%s.operation' % self.honMD01, 2)
        cmds.setAttr('%s.input2X' % self.honMD01, 2)
        self.honMD02 = cmds.createNode('multiplyDivide',
                                       n='horizontalApperture_MD02')
        cmds.setAttr('%s.operation' % self.honMD02, 2)
        cmds.setAttr('%s.input2X' % self.honMD02, 0.843)
        cmds.connectAttr('%s.horizontalFilmAperture' % self.camShape[0],
                         '%s.input1X' % self.honMD01)
        cmds.connectAttr('%s.outputX' % self.honMD01,
                         '%s.input1X' % self.honMD02)
        cmds.connectAttr('%s.outputX' % self.honMD02,
                         '%s.sx' % self.guideAlign)
        self.vertMD01 = cmds.createNode('multiplyDivide',
                                        n='verticalApperture_MD01')
        cmds.setAttr('%s.operation' % self.vertMD01, 2)
        cmds.setAttr('%s.input2X' % self.vertMD01, 0.945)
        self.vertMD02 = cmds.createNode('multiplyDivide',
                                        n='verticalApperture_MD02')
        cmds.setAttr('%s.operation' % self.vertMD02, 2)
        cmds.setAttr('%s.operation' % self.vertMD02, 1)
        cmds.connectAttr('%s.verticalFilmAperture' % self.camShape[0],
                         '%s.input1X' % self.vertMD01)
        cmds.connectAttr('%s.outputX' % self.vertMD01,
                         '%s.input1X' % self.vertMD02)
        cmds.connectAttr('%s.outputX' % self.vertMD02,
                         '%s.sy' % self.guideAlign)
        # Counter Resolution Setup
        darMD = cmds.createNode('multiplyDivide', n='deviceAspectRatio_MD01')
        cmds.setAttr('%s.operation' % darMD, 2)
        cmds.setAttr('%s.input1X' % darMD, 1.5)
        cmds.connectAttr('defaultResolution.deviceAspectRatio',
                         '%s.input2X' % darMD)
        darCon = cmds.createNode('condition', n='deviceAspectRatio_CON01')
        cmds.setAttr('%s.operation' % darCon, 4)
        cmds.setAttr('%s.secondTerm' % darCon, 1.7)
        cmds.setAttr('%s.colorIfTrueG' % darCon, 1)
        cmds.setAttr('%s.colorIfFalseG' % darCon, 1.19)
        cmds.setAttr('%s.colorIfTrueR' % darCon, 1)
        cmds.connectAttr('%s.input2X' % darMD, '%s.firstTerm' % darCon)
        cmds.connectAttr('%s.outputX' % darMD, '%s.colorIfTrueR' % darCon)
        cmds.connectAttr('%s.outColorG' % darCon, '%s.sx' % self.filmGateB[0])
        cmds.connectAttr('%s.outColorR' % darCon, '%s.sy' % self.filmGateB[0])
        #  Camera Scale Setup
        cmds.addAttr(self.selCam[0],
                     ln='matchGuide',
                     at='float',
                     hnv=1,
                     min=-10,
                     hxv=1,
                     max=10)
        cmds.setAttr('%s.matchGuide' % self.selCam[0], e=1, k=True)
        camScaleMD = cmds.createNode('multiplyDivide',
                                     n='cameraScaleCounter_MD01')
        cmds.connectAttr('%s.matchGuide' % self.selCam[0],
                         '%s.input1X' % camScaleMD)
        cmds.setAttr('%s.input2X' % camScaleMD, 1)
        cmds.connectAttr('%s.outputX' % camScaleMD, '%s.tz' % self.guideSdk)
        # Lock Attributes
        lockList = [
            self.sceneInfoLoc[0], self.prism[0], self.tvGateGrp, self.clipGrp,
            self.guideGrp, self.guideAlign
        ]
        for each in lockList:
            cmds.setAttr('%s.tx' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.ty' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.tz' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.rx' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.ry' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.rz' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.sx' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.sy' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.sz' % each, l=1, k=1, cb=1)
        # Camera Label Group
        cmds.select(cl=1)
        if cmds.objExists('CameraLabel_grp'):
            cmds.select('CameraLabel_grp')
            self.mainCamGrp = cmds.ls(sl=1)
            cmds.parent(self.guideSpace, self.mainCamGrp)
        else:
            self.mainCamGrp = cmds.group(n='CameraLabel_grp', em=1)
            cmds.parent(self.guideSpace, self.mainCamGrp)
        cmds.select(cl=1)
        cmds.select(self.selCam)

        # Help Window
        cHelpWin = 'CamHUD Help Window'

        if cmds.window(cHelpWin, q=1, ex=True):
            cmds.deleteUI(cHelpWin)

        if cmds.windowPref(cHelpWin, ex=True):
            cmds.windowPref(cHelpWin, remove=True)

        cHelpWin = cmds.window(title='CamHUD v.1.0 Help', s=0, w=400, h=150)
        cmds.frameLayout('User Guide',
                         borderStyle='etchedOut',
                         collapsable=1,
                         collapse=0)
        form = cmds.formLayout()
        content = (
            'CamHUD is Setup when this window pop-up. ' + '\n\n' +
            'If CamHUD not showing up/matching with grey gate on playblast panel.Try the following steps.'
            + '\n\n' +
            '1. Change view port from Film Gate to Resolution Gate.' + '\n\n' +
            '2. Select playblast camera.' + '\n\n' +
            '3. Tweak the value of the Match Guide attribute until the CamHUD show up and match with the Resolution Gate.'
            + '\n\n' +
            '4. Call for help from rigger if the CamHUD still not showing up.'
            + '\n\n' +
            'The Match Guide attributes is corresponding with value of Camera Scale( under cameraShape node. Open Attribute Editor to locate it. Under Focal Length. Default value is 1. )'
            + '\n\n' + 'Camera Scale= 0.5, Match Guide= -6' + '\n\n' +
            'Camera Scale= 1, Match Guide= 0' + '\n\n' +
            'Camera Scale= 2, Match Guide= 3' + '\n\n' +
            'Camera Scale= 3, Match Guide= 4' + '\n\n' +
            'Close This window if CamHUD is Set up properly. Thanks.')

        cmds.scrollField(wordWrap=True,
                         editable=False,
                         text=content,
                         w=400,
                         h=460)
        cmds.showWindow(cHelpWin)
Exemplo n.º 32
0
 def debugVec(self, point, vector, annotation='', length=100):
     locator = cmds.spaceLocator(p=[0, 0, 0])
     cmds.xform(locator, ws=True, t=point)
     vp = self.add(point, self.mult(vector, length))
     ar = cmds.annotate(locator, p=vp, tx=annotation)
Exemplo n.º 33
0
def rigBackLegIK(side, hip1, hip2, knee1, knee2, foot, footShellJnt, heel, heelTip, \
					frontToeIn1, frontToeIn2, frontToeIn3,\
					frontToe1, frontToe2, frontToe3,\
					frontToeBack1, frontToeBack2, frontToeBack3,\
					heelToe1, heelToe2):
	"""
	mech.rigBackLegIK("right", "R_hip2_J", "R_hip3_J", "R_knee1", "R_shin", "R_foot", "R_footShell_J", "R_backAnkle","R_backAnkleTip",
						"R_footInToe1", "R_footInToe2", "R_footInToe3","R_footMainToe1", "R_footMainToe2", "R_footMainToe3",\
						"R_footBackToe1", "R_footBackToe2", "R_footBackToe3", "R_backAnkleFoot", "R_backAnkleToe")
	"""
	extraCon = checkForExtraControl()
	worldCon = checkForWorldControl()
		
	#create foot control
	footControlNodes = createControl(side, "foot_ik", "circleY", sdk=1, con=1)
	footControl = footControlNodes[-1]
	footSDK = footControlNodes[2]
	footCON = footControlNodes[1]
	footPOS = footControlNodes[0]
	
	alignNodes(footPOS, [foot])
	cmds.setAttr(footPOS+".rx", 0)
	cmds.setAttr(footPOS+".ry", 0)
	cmds.setAttr(footPOS+".rz", 0)
	
	#create the hip control
	hipControlNodes = createControl(side, "hip_ik", "cross", sdk=1, con=1)
	hipControl = hipControlNodes[-1]
	hipSDK = hipControlNodes[2]
	hipCON = hipControlNodes[1]
	hipPOS = hipControlNodes[0]
	
	alignNodes(hipPOS, [hip1])
	cmds.setAttr(hipPOS+".rx", 0)
	cmds.setAttr(hipPOS+".ry", 0)
	cmds.setAttr(hipPOS+".rz", 0)
	
	cmds.pointConstraint(hipControl, hip1)
		
	#create heel roll control and parent it to the foot control
	heelRollNodes = createControl(side, "heelRoll", "null", sdk=1, con=0)
	heelRollControl = heelRollNodes[-1]
	heelRollSDK = heelRollNodes[2]
	heelRollPOS = heelRollNodes[0]
	
	alignNodes(heelRollPOS, [heelTip])
	cmds.parent(heelRollPOS, footControl)
	
	#create foot roll control and parent it under the heel roll control
	footRollNodes = createControl(side, "footRoll", "null",sdk=1, con=0)
	footRollControl = footRollNodes[-1]
	footRollSDK = footRollNodes[2]
	footRollPOS = footRollNodes[0]
	
	
	alignNodes(footRollPOS, [footControl])
	cmds.parent(footRollPOS, heelRollControl)

	#Create ikHandleHelper node align it to knee2 and parent it under foot roll control
	legIKHelperNodes = createControl(side, "legIKHelper", "null" ,sdk=1, con=1)
	legIKHelperControl = legIKHelperNodes[-1]
	legIKHelperSDK = legIKHelperNodes[2]
	legIKHelperCON = legIKHelperNodes[1]
	legIKHelperPOS = legIKHelperNodes[0]
	
	alignNodes(legIKHelperPOS, [knee2])
	cmds.parent(legIKHelperPOS, footRollControl)

	#create pushOnOff_SDK and pushOnOff_POS groups
	#align push nodes to the knee2 and parent pushOnOff_POS under ikHandleHelper
	pushOnOffNodes = createControl(side, "pushOnOff","null", sdk=1, con=1)
	pushOnOffControl = pushOnOffNodes[-1]
	pushOnOffSDK = pushOnOffNodes[2]
	pushOnOffCON = pushOnOffNodes[1]
	pushOnOffPOS = pushOnOffNodes[0]
	
	alignNodes(pushOnOffPOS, [knee2])
	cmds.parent(pushOnOffPOS, legIKHelperControl)

	#add footAttributes
	attributesToAdd = {"footRoll":[-10, 10], \
						"sideRoll": [-10, 10],\
						"legPress":[0, 10],\
						"footPress":[0, 10],\
						"legTwist":None,\
						"thighTwist": None,\
						"footRigidity":[0, 10],\
						"footShellShinSpace":[0, 10]}
	
	for attr in attributesToAdd:
		if attributesToAdd[attr] is not None:
			minValue = attributesToAdd[attr][0]
			maxValue = attributesToAdd[attr][1]
			cmds.addAttr(footControl, shortName=attr, attributeType="double", minValue=minValue, maxValue=maxValue, defaultValue=0)
			cmds.setAttr(footControl+"."+attr, k=1)
		else:
			cmds.addAttr(footControl, shortName=attr, attributeType="double", defaultValue=0)
			cmds.setAttr(footControl+"."+attr, k=1)
			
	cmds.addAttr(footControl, shortName="lasersVis", attributeType="bool", defaultValue=1)
	cmds.setAttr(footControl+".lasersVis", k=1, cb=1)
	

	
	
	#create pole vector control and laser
	thighIKPVNodes = createControl(side, "thighPV", "cross",sdk=1, con=1)
	thighIKPVControl = thighIKPVNodes[-1]
	thighIKPVSDK = thighIKPVNodes[2]
	thighIKPVCON = thighIKPVNodes[1]
	thighIKPVPOS = thighIKPVNodes[0]
	
	positionPoleVectorControl(hip1, knee1, thighIKPVPOS, 100)
	midIKJCoord = tuple(cmds.xform(hip2, q=1, ws=1, rp=1))
	
	thighIKLaser = cmds.annotate(thighIKPVControl, p=midIKJCoord)
	cmds.parent(thighIKLaser, hip2)
	
	#create thigh IK and parent it under pushOnOff control
	thighIKHandleNodes = cmds.ikHandle(solver="ikRPsolver", sj=hip1, ee=knee1, n=nameNode("thigh", "left", "IK"))
	thighIKHandle = thighIKHandleNodes[0]
	cmds.parent(thighIKHandle, pushOnOffControl)
	cmds.parent(thighIKPVPOS, heelRollControl)
	

	#connect the pole vector control and laser
	cmds.poleVectorConstraint(thighIKPVControl, thighIKHandle)
	cmds.connectAttr(footControl+".lasersVis", thighIKLaser+".v")

	#--------create the leg ik
	#create the helper joints joint1 at the hip, joint 2 between knee1 and knee1 and joint 2 at the foot
	helperIKJnt1 = cmds.createNode("joint", n=nameNode("helperJoint1", side, "J"))
	helperIKJnt2 = cmds.createNode("joint", n=nameNode("helperJoint2", side, "J"))
	helperIKJnt3 = cmds.createNode("joint", n=nameNode("helperJoint3", side, "J"))
	
	cmds.delete(cmds.parentConstraint(hip2, helperIKJnt1, mo=0, st="none", sr="none"))
	cmds.delete(cmds.parentConstraint(knee1, knee2, helperIKJnt2, mo=0, st="none", sr="none"))
	cmds.delete(cmds.parentConstraint(foot, helperIKJnt3, mo=0, st="none", sr="none"))
	
	cmds.parent(helperIKJnt3, helperIKJnt2)
	cmds.parent(helperIKJnt2, helperIKJnt1)
	cmds.parent(helperIKJnt1, extraCon)
	
	cmds.makeIdentity(helperIKJnt1, a=1, t=1, r=1, jo=1)
	cmds.makeIdentity(helperIKJnt2, a=1, t=1, r=1, jo=1)
	cmds.joint(helperIKJnt1, e=1, orientJoint="xzy", secondaryAxisOrient="zup")
	cmds.joint(helperIKJnt2, e=1, orientJoint="xyz", secondaryAxisOrient="yup")
	cmds.makeIdentity(helperIKJnt3, a=1, t=1, r=1, jo=1)
	
	#setup pole vector
	legIKPVNodes = createControl(side, "legPV", "cross",sdk=1, con=1)
	legIKPVControl = legIKPVNodes[-1]
	legIKPVSDK = legIKPVNodes[2]
	legIKPVCON = legIKPVNodes[1]
	legIKPVPOS = legIKPVNodes[0]
	
	positionPoleVectorControl(helperIKJnt1, helperIKJnt3, legIKPVPOS, 500)
	midIKJCoord = tuple(cmds.xform(helperIKJnt2, q=1, ws=1, rp=1))
	
	legIKLaser = cmds.annotate(legIKPVControl, p=midIKJCoord)
	cmds.parent(legIKLaser, helperIKJnt3)
	
	#create Leg IK and parent under footRoll control
	legIKHandleNodes = cmds.ikHandle(solver="ikRPsolver", sj=helperIKJnt1, ee=helperIKJnt3, n=nameNode("leg", "left", "IK"))
	legIKHandle = legIKHandleNodes[0]
	cmds.setAttr(legIKHandle+".v", 0, l=1)
	cmds.parent(legIKHandle, footRollControl)
	
	#connect pole vector
	cmds.poleVectorConstraint(legIKPVControl, legIKHandle)
	cmds.connectAttr(footControl+".lasersVis", legIKLaser+".v")
	
	#create a piston group node
	pistonNodes = createControl(side, "piston", "null",sdk=1, con=1)
	pistonFeetControl = pistonNodes[-1]
	pistonFeetSDK = pistonNodes[2]
	pistonFeetCON = pistonNodes[1]
	pistonFeetPOS = pistonNodes[0]
	
	alignNodes(pistonFeetPOS, knee2)
	cmds.delete(cmds.pointConstraint(foot, pistonFeetPOS, skip="none", mo=0))
	cmds.parent(pistonFeetPOS, heelRollControl)
	
	#create world up node for the shin aim constraint
	shinWorldUpNodes = createControl(side, "shinWorldUp", "null", sdk=0, con=0)
	shinWorldUpControl = shinWorldUpNodes[-1]
	shinWorldUpPOS = shinWorldUpNodes[0]
	alignNodes(shinWorldUpPOS, footControl)
	cmds.setAttr(shinWorldUpPOS+".tz", 100)
	cmds.parent(shinWorldUpPOS, heelRollControl)
	
	aimVec = [1, 0, 0]
	worldUpVec = [0, 1, 0]
	if side=="right":
		aimVec = [-1, 0, 0]
	cmds.aimConstraint(pistonFeetControl, knee2, aimVector=aimVec, upVector=worldUpVec, worldUpObject=shinWorldUpControl, worldUpType="object", mo=1)
	cmds.aimConstraint(pistonFeetControl, knee1, aimVector=aimVec, upVector=worldUpVec, worldUpObject=shinWorldUpControl, worldUpType="object", mo=1)
	cmds.parentConstraint(pistonFeetControl, foot, mo=1, st="none", sr="none")
	#-------- setup foot rigidity
	#duplicate the second joint in the leg IK helper chain and parent it under footRoll control kneeRigidNode
	kneeRigidNode = cmds.duplicate(helperIKJnt2, parentOnly=1)[0]
	cmds.parent(kneeRigidNode, footRollControl)
	
	ikHelperConNodes = createControl(side, "ikHelper", "sphere",sdk=1, con=1)
	ikHelperControl = ikHelperConNodes[-1]
	ikHelperSDK = ikHelperConNodes[2]
	ikHelperCON = ikHelperConNodes[1]
	ikHelperPOS = ikHelperConNodes[0]
	
	alignNodes(ikHelperPOS, helperIKJnt2)
	
	cmds.parent(ikHelperPOS, footRollControl)
	cmds.parent(pushOnOffPOS, ikHelperControl)
	
	#point constraint the ikHelper control to the kneeRigidNode and the second joint in the ikHelper chain
	footRigPointCon = cmds.pointConstraint(kneeRigidNode, helperIKJnt2, ikHelperCON, mo=1, skip="none")[0]
	
	#connect the footRigidity attribute to the point constraint
	footRigidMD = cmds.createNode("multiplyDivide", n=nameNode("footRigidity", side, "MD"))
	footRigidREV = cmds.createNode("reverse", n=nameNode("footRigidity", side, "REV"))
	
	cmds.connectAttr(footControl+".footRigidity", footRigidMD+".input1X", f=1)
	cmds.connectAttr(footRigidMD+".outputX", footRigidREV+".inputX", f=1)
	cmds.connectAttr(footRigidMD+".outputX", footRigPointCon+"."+kneeRigidNode+"W0")
	cmds.connectAttr(footRigidREV+".outputX", footRigPointCon+"."+helperIKJnt2+"W1")
	cmds.setAttr(footRigidMD+".input2X", 0.1)

	#connect all fot attributes: footRoll, thighTwist, LegTwist, sideRoll, legPress, footPress
	#footRoll
	cmds.setDrivenKeyframe(footRollSDK, at="rx", currentDriver=footControl+".footRoll", driverValue=0, value=0)
	cmds.setDrivenKeyframe(footRollSDK, at="rx", currentDriver=footControl+".footRoll", driverValue=10, value=30)
	cmds.setDrivenKeyframe(footRollSDK, at="rx", currentDriver=footControl+".footRoll", driverValue=-10, value=-15)
	
	#sideRoll
	cmds.setDrivenKeyframe(footRollSDK, at="rz", currentDriver=footControl+".sideRoll", driverValue=0, value=0)
	cmds.setDrivenKeyframe(footRollSDK, at="rz", currentDriver=footControl+".sideRoll", driverValue=10, value=30)
	cmds.setDrivenKeyframe(footRollSDK, at="rz", currentDriver=footControl+".sideRoll", driverValue=-10, value=-15)
	
	#thighTwist and leg Twist
	cmds.connectAttr(footControl+".thighTwist", thighIKHandle+".twist", f=1)
	cmds.connectAttr(footControl+".legTwist", legIKHandle+".twist", f=1)
	
	#--------press attributes
	pushDirection = 1
	if side=="right":
		pushDirection = -1
	cmds.setDrivenKeyframe(pushOnOffSDK, at="tx", currentDriver=footControl+".legPress", driverValue=0, value=0)
	cmds.setDrivenKeyframe(pushOnOffSDK, at="tx", currentDriver=footControl+".legPress", driverValue=10, value=30*pushDirection)
	#foot push
	cmds.setDrivenKeyframe(pistonFeetSDK, at="tx", currentDriver=footControl+".footPress", driverValue=0, value=0)
	cmds.setDrivenKeyframe(pistonFeetSDK, at="tx", currentDriver=footControl+".footPress", driverValue=10, value=30*pushDirection)
	
	
	
	

	#-------- foot shell
	#create footShell control set
	footShellNodes = createControl(side, "footShell","cube", sdk=1, con=1)
	footShellControl = footShellNodes[-1]
	footShellSDK = footShellNodes[2]
	footShellCON = footShellNodes[1]
	footShellPOS = footShellNodes[0]
	
	alignNodes(footShellPOS, [footShellJnt])
	cmds.parent(footShellPOS, footControl)
	cmds.parentConstraint(footShellControl, footShellJnt, mo=0, st="none", sr="none")

	#set driven key footControl.footRoll 0 -> footShellSDK 0, footControl.footRoll 10 -> footShellSDK -3.5
	cmds.setDrivenKeyframe(footShellSDK, at="rx", currentDriver=footControl+".footRoll", driverValue=0, value=0)
	cmds.setDrivenKeyframe(footShellSDK, at="rx", currentDriver=footControl+".footRoll", driverValue=10, value=-3.5)
	
	#blend shell between foot and shin
	parentCon = cmds.parentConstraint(knee2, foot, footShellCON, mo=1, st="none", sr="none")[0]
	cmds.setDrivenKeyframe(parentCon, at=knee2+"W0", currentDriver=footControl+".footShellShinSpace", driverValue=0, value=0)
	cmds.setDrivenKeyframe(parentCon, at=foot+"W1", currentDriver=footControl+".footShellShinSpace", driverValue=0, value=1)
	
	cmds.setDrivenKeyframe(parentCon, at=knee2+"W0", currentDriver=footControl+".footShellShinSpace", driverValue=10, value=1)
	cmds.setDrivenKeyframe(parentCon, at=foot+"W1", currentDriver=footControl+".footShellShinSpace", driverValue=10, value=0)
	
	#--------- back claw
	#create backClaw control set and parent it under heel Roll control
	backClawNodes = createControl(side, "ankleClaw","cube", sdk=1, con=1)
	backClawControl = backClawNodes[-1]
	backClawSDK = backClawNodes[2]
	backClawCON = backClawNodes[1]
	backClawPOS = backClawNodes[0]
	
	alignNodes(backClawPOS, [heel])
	cmds.parentConstraint(backClawControl, heel, mo=0, st="none", sr="none")

	#point contraint the back claw CON to the shin joint
	
	#blend between shin and world by creating 2 helper nodes to blend between
	ankleLocal = cmds.createNode("transform", n=backClawControl+"_Local")
	ankleWorld = cmds.createNode("transform", n=backClawControl+"_World")
	
	alignNodes(ankleLocal, [backClawControl])
	alignNodes(ankleWorld, [backClawControl])
	
	cmds.parent(ankleLocal, extraCon)
	cmds.parent(ankleWorld, extraCon)
	cmds.parent(backClawPOS, heelRollControl)
	
	cmds.parentConstraint(worldCon, ankleWorld, mo=1, st="none", sr="none")
	cmds.parentConstraint(knee2, ankleLocal, mo=1, st="none", sr="none")
	
	#local world blend of the back claw
	cmds.addAttr(backClawControl, shortName="worldSpace", attributeType="double", minValue=0, maxValue=10, defaultValue=0)
	cmds.setAttr(backClawControl+".worldSpace", k=1, cb=1)
	
	parentCon = cmds.orientConstraint(ankleLocal, ankleWorld, backClawCON, mo=1, skip="none")[0]
	cmds.setDrivenKeyframe(parentCon, at=ankleLocal+"W0", currentDriver=backClawControl+".worldSpace", driverValue=0, value=1)
	cmds.setDrivenKeyframe(parentCon, at=ankleWorld+"W1", currentDriver=backClawControl+".worldSpace", driverValue=0, value=0)
	
	cmds.setDrivenKeyframe(parentCon, at=ankleLocal+"W0", currentDriver=backClawControl+".worldSpace", driverValue=10, value=0)
	cmds.setDrivenKeyframe(parentCon, at=ankleWorld+"W1", currentDriver=backClawControl+".worldSpace", driverValue=10, value=1)
	
	cmds.parentConstraint(knee2, backClawPOS, mo=1, st="none", sr="none")
	
	#---------rig toes
	toesDict = {"inToe_ik":[frontToeIn1, frontToeIn2, frontToeIn3],\
				"midToe_ik": [frontToe1, frontToe2, frontToe3],\
				"backToe_ik":[frontToeBack1, frontToeBack2, frontToeBack3]}
	for toe in toesDict.keys():
		toe1 = toesDict[toe][0]
		toe2 = toesDict[toe][1]
		toe3 = toesDict[toe][2]
		
		toeIKHandleNodes = cmds.ikHandle(solver="ikSCsolver", sj=toe1, ee=toe3, n=nameNode(toe, "left", "IK"))
		toeIKHandle = toeIKHandleNodes[0]
		
		toeNodes = createControl(side, toe,"orient", sdk=1, con=1)
		toeControl = toeNodes[-1]
		toeSDK = toeNodes[2]
		toeCON = toeNodes[1]
		toePOS = toeNodes[0]
		
		alignNodes(toePOS, [toe3])
		#align toe control so Y is perpentucular to the ground
		helperNode = cmds.createNode("transform", n="__TO_DELETE__")
		cmds.delete(cmds.pointConstraint(toe3, helperNode, mo=0, skip="none"))
		cmds.setAttr(helperNode+".ty", 1000)
		
		tipToeJoint = cmds.listRelatives(toe3)[0]
		
		cmds.delete(cmds.aimConstraint(helperNode, toePOS, aimVector=[0, 1, 0], upVector=[0,0,1], worldUpType="object",worldUpObject=tipToeJoint, mo=0))
		
		cmds.parent(toeIKHandle, toeControl)
		cmds.orientConstraint(toeControl, toe3, mo=1, skip="none")
		
		cmds.parent(toePOS, heelRollControl)
		cmds.delete(helperNode)
		
	#------rig back toe on the ankle claw
	backTCons1 = rigFKJoint(heelToe1, side, heelToe1, "cube", sdk=1, con=1)
	backTCons2 = rigFKJoint(heelToe2, side, heelToe2, "cube", sdk=1, con=1)
	
	cmds.parent(backTCons2[0], backTCons1[-1])
	cmds.parent(backTCons1[0], backClawControl)
	
	cmds.select(footControl, r=1)
	print "done"