Esempio n. 1
0
def form_label(sel):
    """IF transform has shape returns string with 
    its type in parentesis: transform(mesh)
    ELSE: transform will be shown as group
    ELSEIF transform is constrained or connected: transform(constrained)
    ELSE: nondag
    """
    
    sel, typ = pm.ls(sel, st=1)
    # inh_types = sel.type(i=1)
    # class_typ = "dagNode" if pm.objectType(sel, isa="dagNode") else "nondag"
    node_cls = "dagNode"
    if  not pm.objectType(sel, isa="dagNode"):
        node_cls = "nondag"
    if pm.objectType(sel, isa="shape"):
        node_cls = "shape"
            

    # if class_typ == "dagNode":
    #     node_typ = sel.type(i=1)[3]
    #     if sel.getShape():
    #         typ = sel.getShape().type()
    sel_data = "{}\t[{}]\t({})".format(sel, node_cls, typ)    
    print sel_data
    return sel_data
def sortBy_unsupported(lightList):
	unsup_lights = []
	for each in lightList:
		if pm.objectType(each) == 'ambientLight' or pm.objectType(each) == 'volumeLight':
			unsup_lights.append(each)

	return unsup_lights
Esempio n. 3
0
def select_polys_under_top_node(top_node):
    result = []
    for transform in top_node.listRelatives(ad=True, type="transform"):
        if transform.getShape():
            pm.objectType(transform.getShape()) == "mesh"
            result.append(transform)
    return result
Esempio n. 4
0
    def AddCTRL(self, CTRL_name, qList, qCtrlBox):

        global main_CTRL

        if len(CTRL_name) > 0:
            shapes = cmds.listRelatives(str(CTRL_name))

            if len(shapes) > 0:

                if pm.objectType(shapes[0], isType='locator'):
                    space_CTRL = ''
                    splitString = CTRL_name.split('|', 3)

                    space_CTRL = splitString[1]

                    if str(space_CTRL) != str(main_CTRL):
                        findItem = qList.findItems(space_CTRL, 8)
                        if len(findItem) <= 0:
                            qList.addItem(space_CTRL)

                if pm.objectType(shapes[0], isType='nurbsCurve'):

                    space_CTRL = ''
                    splitString = CTRL_name.split('|', 5)

                    length = len(splitString)
                    space_CTRL = splitString[length - 1]

                    if str(space_CTRL) != str(main_CTRL):
                        findItem = qList.findItems(space_CTRL, 8)
                        if len(findItem) <= 0:
                            qList.addItem(space_CTRL)
        qCtrlBox.clear()
Esempio n. 5
0
 def validate_for_split_joint(sl):
     if not sl:
         pm.windows.confirmDialog(
             message=JointSplitter.error_messages["emptySelection"],
             button=["Okay"])
         return False
     elif len(sl) > 2:
         pm.windows.confirmDialog(
             message=JointSplitter.error_messages["exceedSelection"],
             button=["Okay"])
         return False
     elif len(sl) == 1:
         pm.windows.confirmDialog(
             message=JointSplitter.error_messages["notEnoughJoint"],
             button=["Okay"])
         return False
     elif pm.objectType(sl[0], isType="joint") and pm.objectType(
             sl[1], isType="joint"):
         return True
     else:
         pm.windows.confirmDialog(
             message=JointSplitter.
             error_messages["incorrectObjectSelection"],
             button=["Okay"])
         return False
Esempio n. 6
0
    def iterateHistory(self, plugs=False, node_type=None):
        """
        A generator that parses the history of the shape based on connections. As a result
        you get a depth-only history, without nodes that are connected as blendShape targets or
        other clutter.
        :param str node: deformable shape (or its transform)
        :param bool plugs: list tuples of (input, output) attributes instead of nodes
        :param str node_type: filter the history based on the node type
        :return generator: generator that iterates over history

        ex: skin_clusters = list(adbTransform.Transform(pm.selected()[0]).iterateHistory( node_type='skinCluster'))
        """
        history_plug = (pm.listHistory(
            self.transform, q=True, historyAttr=True) or [None])[0]
        future_plug = None

        while True:
            if node_type is None or pm.objectType(self.transform,
                                                  isAType=node_type):
                if plugs:
                    yield history_plug, future_plug
                else:
                    yield self.transform

            if history_plug is None:
                break

            future_plug = (pm.listConnections(history_plug,
                                              source=True,
                                              destination=False,
                                              shapes=True,
                                              skipConversionNodes=False,
                                              plugs=True) or [None])[0]
            if future_plug is None:
                break

            self.transform = future_plug.split('.')[0]
            future_attr = '.'.join(future_plug.split('.')[1:])
            history_plug = None
            if pm.objectType(self.transform, isAType='geometryFilter'):
                if future_attr.startswith('outputGeometry['):
                    history_plug = '{0}.{1}.inputGeometry'.format(
                        self.transform,
                        future_attr.replace('outputGeometry', 'input'))
            elif pm.objectType(self.transform, isAType='polyModifier'):
                if future_attr == 'output':
                    history_plug = '{0}.inputPolymesh'.format(self.transform)
            elif pm.objectType(self.transform, isAType='deformableShape'):
                if future_plug in (pm.listHistory(self.transform,
                                                  q=True,
                                                  futureLocalAttr=True)[0],
                                   pm.listHistory(self.transform,
                                                  q=True,
                                                  futureWorldAttr=True)[0]):
                    history_plug = pm.listHistory(self.transform,
                                                  q=True,
                                                  historyAttr=True)[0]
            elif future_attr == 'outputGeometry':
                if pm.objExists('{0}.inputGeometry'.format(self.transform)):
                    history_plug = '{0}.inputGeometry'.format(self.transform)
def alMoveACsegment(startFrame, endFrame):
    lastFrame = 0.0
    preRange = "0:" + str((startFrame - 1))
    allaCurves = pm.ls(type="animCurve")
    refCurves = pm.ls(type="animCurve", referencedNodes=1)
    animCurves = [x for x in allaCurves if x not in refCurves]
    for aCurve in animCurves:
        if (pm.objectType(aCurve) == "animCurveTU") or (
                pm.objectType(aCurve)
                == "animCurveTA") or (pm.objectType(aCurve) == "animCurveTL"):
            pm.setAttr((str(aCurve) + ".ktv"), l=1)
            pm.setAttr((str(aCurve) + ".ktv"), l=0)
            lastFrame = float(pm.findKeyframe(aCurve, which="last"))
            if lastFrame <= endFrame:
                lastFrame = float(endFrame + 2)

            postRange = str((endFrame + 1)) + ":" + str(lastFrame)
            if (pm.getAttr(str(aCurve) + ".pre")
                    == 0) and (pm.getAttr(str(aCurve) + ".pst") == 0):
                pm.setKeyframe(aCurve, insert=1, time=startFrame)
                pm.setKeyframe(aCurve, insert=1, time=endFrame)
                pm.cutKey(aCurve, time=preRange)
                pm.cutKey(aCurve, time=postRange)

#print "\nanimCurve: " + str(aCurve)
            pm.keyframe(aCurve,
                        e=1,
                        iub=True,
                        o='over',
                        r=1,
                        time=(str(startFrame) + ":" + str(endFrame)),
                        tc=(-(startFrame - 1)))
Esempio n. 8
0
def rename():
    selection = pm.ls(selection=True)
    if len(selection) == 0:
        selection = pm.ls(dag=True, long=True)
    # selection.sort(key=len, reverse=True)
    for obj in selection:
        short_name = obj.split("|")[-1]

        children = pm.listRelatives(obj, children=True, fullPath=True) or []

        if len(children) == 1:
            child = children[0]
            obj_type = pm.objectType(child)
        else:
            obj_type = pm.objectType(obj)

        suffix = SUFFIXES.get(obj_type, DEFAULT_SUFFIX)

        if not suffix:
            continue

        if obj.endswith(suffix):
            continue

        new_name = short_name + '_' + suffix
        pm.rename(obj, new_name)
Esempio n. 9
0
def select_polys_under_top_node():
	select = []
	for transform in pm.ls(sl=True)[0].listRelatives(ad=True, type='transform'):
		if transform.getShape():
			pm.objectType( transform.getShape() ) == 'mesh'
			select.append( transform )
	pm.select(select, r=True)
Esempio n. 10
0
 def connect(self, *nodes):
     for each_node in nodes:
         if pm.objectType(each_node) == 'time':
             self._connect_time(each_node)
         elif pm.objectType(each_node) == 'hairSystem':
             self._connect_hair_system(each_node)
         elif pm.objectType(each_node) == 'nRigid':
             self._connect_nRigid(each_node)
Esempio n. 11
0
def RMRemoveChildren(Node):
    Children = pm.listRelatives(Node, children=True)
    returnArray = []
    for eachChildren in Children:
        if pm.objectType(eachChildren) != "mesh" and pm.objectType(eachChildren) != "nurbsCurve":
            pm.parent(eachChildren, world=True)
            returnArray.append(eachChildren)
    return returnArray
Esempio n. 12
0
    def connect(self, *nodes):
        for each_node in nodes:
            if pm.objectType(each_node) == 'follicle':
                self._connect_follicle(each_node)

            elif pm.objectType(each_node) == 'time':
                self._connect_time(each_node)
            else:
                print 'connection with type {} not defined'.format()
Esempio n. 13
0
 def getType(subject):
     """Print selection Type """
     all_types = []
     try:
         _type = (pm.objectType(pm.PyNode(subject).getShape()))
     except:
         _type = _type = (pm.objectType(pm.PyNode(subject)))
     all_types.append(_type)
     return _type
Esempio n. 14
0
 def connect(self, *nodes):
     for each_node in nodes:
         if pm.objectType(each_node) == 'transform':
             evaluation_node = each_node.getShapes()[0]
         else:
             evaluation_node = each_node
         if pm.objectType(evaluation_node) == 'time':
             self._connect_time(evaluation_node)
         if pm.objectType(evaluation_node) == 'mesh':
             self._connect_mesh(evaluation_node)
Esempio n. 15
0
def Interpolate2Jnts(firstJnt=None, secondJnt=None, numOfNewJnts=4):

    if firstJnt == None or secondJnt == None:
        firstJnt, secondJnt = pm.ls(sl=True)

    newJnts = []

    if numOfNewJnts <= 0:
        pm.warning("number of new joints must be bigger than zero.")
        return newJnts

    else:
        if (pm.objectType(firstJnt) == 'joint'
                and pm.objectType(secondJnt) == 'joint'):
            firstChildJnt = firstJnt.getChildren()[0]
            secondChildJnt = secondJnt.getChildren()[0]
            # find start and end pose of 2 curves
            crv1CV1Pos = dt.Vector(pm.xform(firstJnt, q=True, ws=True, t=True))
            crv1CV2Pos = dt.Vector(
                pm.xform(firstChildJnt, q=True, ws=True, t=True))
            crv2CV1Pos = dt.Vector(pm.xform(secondJnt, q=True, ws=True,
                                            t=True))
            crv2CV2Pos = dt.Vector(
                pm.xform(secondChildJnt, q=True, ws=True, t=True))

            # create a vector representing each curve
            crv1Vec = crv1CV2Pos - crv1CV1Pos
            crv2Vec = crv2CV2Pos - crv2CV1Pos
            start1ToStart2 = crv2CV1Pos - crv1CV1Pos
            end1ToEnd1 = crv2CV2Pos - crv1CV2Pos
            # find segment's length
            startSegLen = start1ToStart2.length() / (numOfNewJnts + 1)
            endSegLen = end1ToEnd1.length() / (numOfNewJnts + 1)

            # find start and end points for new curves and creating them
            for i in range(1, numOfNewJnts + 1):
                tmpStart = crv1CV1Pos + (start1ToStart2.normal() *
                                         startSegLen * i)
                tmpEnd = crv1CV2Pos + (end1ToEnd1.normal() * endSegLen * i)
                pm.select(clear=True)
                newJnts.append(pm.joint(p=tmpStart))
                newJnts.append(pm.joint(p=tmpEnd))
                pm.joint(newJnts,
                         e=True,
                         zso=True,
                         oj="xzy",
                         sao="yup",
                         ch=True)
            return newJnts

        else:
            pm.error("interpolate2Jnts command needs 2 sets of joints.")
Esempio n. 16
0
def get_next(child, light_type_list):
    for child_next in pm.listRelatives(child, children=True, fullPath=True):
        child_next_type = pm.objectType(child_next)
        print pm.objectType(child_next)
        if child_next_type in light_type_list:
            # print child_next
            return child_next
        elif child_next_type == "transform":
            # print child_next
            return get_next(child_next, light_type_list)
        else:
            # print child_next
            return None
Esempio n. 17
0
 def type(self):
     """
     Print selection Type
     """
     all_types = []
     try:
         _type = [(pm.objectType(pm.PyNode(x).getShape()))
                  for x in self.transform]
     except:
         _type = _type = [(pm.objectType(pm.PyNode(x)))
                          for x in self.transform]
     all_types.append(_type)
     return _type
Esempio n. 18
0
    def __init__(self, hdriNode, plateR, plateG, plateB, renderR, renderG,
                 renderB):
        self.hdriNode = pm.ls(hdriNode)[0].getShape()

        r, g, b = self.compensationFormula(plateR, plateG, plateB, renderR,
                                           renderG, renderB)

        if pm.objectType(self.hdriNode, isType='aiSkyDomeLight'):
            self.createStandardColorCorrect()
            self.setStandarGain(r, g, b)
        elif pm.objectType(self.hdriNode, isType='PxrDomeLight'):
            self.setPxrGain(r, g, b)
        else:
            print 'invalid node'
Esempio n. 19
0
def rigCheck(obj):
    print 'チェック開始'
    if pm.objectType(
            obj
    ) == 'nurbsCurve':  #obj.getChildren()の場合、transformじゃなくてshapeが取れるっぽい?よくわからない。getparentの場合、この処理は必要ない。なぜ?
        return True
    if pm.objectType(obj) == 'transform' and obj.getShape(
    ):  #オブジェクトタイプがtransform かつシェイプを持っている場合。'transform'の条件式付け足すと上手くいくっぽい理由がわからない。
        shape = obj.getShape()
        if pm.objectType(shape) == 'nurbsCurve':
            return True
        else:
            return False
    else:
        return False
Esempio n. 20
0
def list_history(object, type):
    hist = pymel.listHistory(object, lv=1)
    nodes = []
    for h in hist:
        if pymel.objectType(h) == type:
            nodes.append(h) 
    return nodes   
Esempio n. 21
0
def parentShape(parent, child, deleteChildXform=True):
    """
    Parent the shape nodes of the children to the transform of the parent.
    Return all shapes of the new parent
    """
    #todo: support this
    # if child in MC.listRelatives(parent, ad=1):
    #     raise NotImplementedError("Cannot parent shapes of a child to its parent")

    #snap a temp
    shapes = [shape for shape in pm.listRelatives(child, pa=1) if pm.objectType(shape, isAType='geometryShape')]

    tmp = MC.createNode('transform', n='TMP')
    snap(child, tmp)
    # MC.parent(tmp, child)
    # MC.makeIdentity(tmp, t=1, r=1, s=1)
    # MC.parent(tmp, world=1)

    for shape in shapes:
        pm.parent(shape, tmp, r=True, s=True)

    MC.parent(tmp, parent)
    MC.makeIdentity(tmp, apply=True, t=1, r=1, s=1, n=0)
    MC.parent(tmp, w=1)

    for shape in shapes:
        pm.parent(shape, parent, r=True, s=True)
    MC.delete(tmp)

    if deleteChildXform:
        MC.delete(child)

    fixShapeNames(parent)

    return parent
Esempio n. 22
0
    def colordefault(self):
        """ Reset default color """
        try:
            ctrlSet = pm.selected()

            for ctrl in ctrlSet:
                if pm.objectType(ctrl) == "joint":
                    for each in  ctrlSet:
                        ctrl = pm.PyNode(each)
                        ctrl.overrideEnabled.set(1)
                        ctrl.overrideRGBColors.set(0)
                        ctrl.overrideColor.set(0)
                        ctrl.overrideEnabled.set(0)
                        pm.select(None)
                else:
                    ctrls = pm.selected()
                    shapes = [x.getShapes() for x in ctrls]
                    all_shapes = [x for i in shapes for x in i]

                    for ctrl in all_shapes:
                        pm.PyNode(ctrl).overrideEnabled.set(1)
                        pm.PyNode(ctrl).overrideRGBColors.set(0)
                        pm.PyNode(ctrl).overrideColor.set(0)
        except:
            pass
Esempio n. 23
0
    def batch_connect(self):

        # connect grd obj
        if self.groundObjList.item(0) is None:
            return None
        else:
            grd_mesh = pm.PyNode(self.groundObjList.item(0).text())

        if pm.objectType(grd_mesh) == "mesh":
            pass
        else:
            return None

        ctrl_list = []

        if self.controlList.item(0) is None:
            return None
        else:

            for count in range(self.controlList.count()):
                ctrl_list.append(self.controlList.item(count))

            ctrl_list = [item.text() for item in ctrl_list if item is not None]

        for item in ctrl_list:
            self.connect_attrs(grd_mesh, item)
Esempio n. 24
0
def constraint_store():
	filepath = os.path.basename( cmds.file(q=True, sn=True) )
	constraints_folder = os.path.join( pm.workspace( q=True, rd=True ), 'data/constraints/')
	if not os.path.exists(os.path.dirname(constraints_folder)):
		os.makedirs(os.path.dirname(constraints_folder))
	sel = pm.ls(sl=True)
	constraintFile=None
	if len(sel)==0:
		pm.error('Select something numbnuts!')
	for obj in sel:
		for child in obj.getChildren():
			type = pm.objectType(child)
			constraintString = None
			if 'Constraint' in type:
				constrainer = child.getWeightAliasList()[0].split('.')[1][:-2]
				#print 'Constraint found of type = %s on object: %s from object: %s' % (type, obj, constrainer)
				#print child.connections(p=True,c=True,d=True)
				if constraintString == None:
					constraintString = type+':'+constrainer+':'+obj
				else:
					constraintString = constraintString + ',' + type+':'+constrainer+':'+obj
				#print constraintString
			if constraintString:
				if constraintFile:
					constraintFile=constraintFile+'\n'+constraintString
				else:
					constraintFile=constraintString
	constraints_file = os.path.join(constraints_folder, gp.getuser(), (filepath[:-3]+'_'+time.strftime("%Y%m%dT%H%M%S")+'.constraints'))
	if not os.path.exists(os.path.dirname(constraints_file)):
		os.makedirs(os.path.dirname(constraints_file))
	with open(constraints_file, 'w') as f:
		f.write(constraintFile)
		print 'Successfully wrote constraints file:\n\t%s' % (constraints_file)
Esempio n. 25
0
 def _connectMaps(self, maps, shader, arg):
     #COL, SPC, BMP, NRM, TID, DSP, VSP, MSK
     shader_type = pm.objectType(shader)
     for map in maps:
         outAttr = '.outColor'
         texture_type = self._detectTextureType(shader)
         self.shaderOp[shaderType]()
    def saveLights(self):
        properties = {}

        for lightWidget in self.findChildren(LightWidget):
            light = lightWidget.light
            transform = light.getTransform()

            # add it to the dictionary.
            properties[str(transform)] = {
                'translate': list(transform.translate.get()),
                'rotation': list(transform.rotate.get()),
                'lightType': pm.objectType(light),
                'intensity': light.intensity.get(),
                'color': light.color.get()
            }

        # fetch the light manager directory to save in
        directory = self.getDirectory()

        # construct name of the lightFile to save
        # %m%d%S = (month/day/secounds)
        lightFile = os.path.join(directory,
                                 'lightFile_%s.json' % time.strftime('%m%d%S'))

        # open file to write
        with open(lightFile, 'w') as f:
            json.dump(properties, f, indent=4)

        logger.info('Saving file to %s' % lightFile)
Esempio n. 27
0
def find_connectionDownstream( obj, type, result=None ):
    '''Searches a connection hierarchy backwards to find a node type
    Args:
        obj (pm.PyNode): object to be sorted through (usually you need to have a shape)
        type (string): object type we're looking for from pm.objectType
        result (list): shouldn't change this, starting list
    Returns:
        [pm.PyNode]: list of whatever type specified
    Usage:
        find_connectionDownstream(pm.ls(sl=True)[0].getShape(), 'blendShape')
        find_connectionDownstream(pm.ls(sl=True)[0].getShape(), 'tweak')
    '''
    # initialization for pythonic list storage ex:
    # http://tinyurl.com/pvfvept
    if result==None:
        result=[]
    # for all connected objects search to see if they're the right type and add them
    for connected in obj.listConnections(d=False):
        if pm.objectType(connected) == type:
            result.append(connected)
            search_inConnections(connected, type, result)
        else:
            search_inConnections(connected, type, result)
    # list->set->list to remove duplicates then sort
    result = list(set(result))
    result.sort()
    return result
Esempio n. 28
0
	def _finalize(self, type):
		nparticles = pm.ls(sl=True)
		for nparticle in nparticles:
			if pm.objectType(nparticle.getShape()) != 'nParticle':
				nparticles.remove(nparticle)
		print nparticles[0].getShape()
		nparticle=[nparticles[0], nparticles[0].getShape()]
		emitterCons = nparticle[1].listConnections(type='pointEmitter')
		if emitterCons:
			emitter = nparticle[1].listConnections(type='pointEmitter')[0]
		else: 
			pm.error('The particle doesn\'t have an emitter connected')
		if type==0:
			#set the max particles + emitter to max
			nparticle[1].maxCount.set(nparticle[1].getCount())
			emitter.rate.set(20000) #arbitrary high value
			print 'Setting max particle count for %s to %s' % (nparticle[1].name(), nparticle[1].getCount())
			mm.eval("setNClothStartState")
			mm.eval("performSetNClothStartState(1)")
		if type==1:
			#reset the max particles + emitter rate
			mm.eval("clearNClothStartState")
			mm.eval("performSetNClothStartState 0")
			nparticle[1].maxCount.set(-1)
			emitter.rate.set(5000)
Esempio n. 29
0
def connectAttr(attribute_source, attribute_destination, name = 'additiveConnection' ):
    attribute_source = validate_pymel_nodes(attribute_source)
    attribute_destination = validate_pymel_nodes(attribute_destination)
    value = pm.listConnections(attribute_destination, destination = False, plugs=True, skipConversionNodes = True)
    if value:
        print value[0].node()
        if pm.objectType(value[0].node()) == 'plusMinusAverage':
            plusMinus = value[0].node()
            if attribute_source.get(type=True) in ['float','doubleLinear', 'doubleAngle']:
                attribute_source >> plusMinus.input1D[len(plusMinus.input1D.elements())]
            #elif attribute_source.get(type=True) in [vector]:
            #    print 'connecting vector'
            elif attribute_source.get(type=True) in ['double3']:
                attribute_source >> plusMinus.input3D[len(plusMinus.input3D.elements()) % 3]
            else:

                print 'could not add data type: %s' % attribute_source.get(type=True)
        else:
            if attribute_source.get(type=True) in ['float', 'doubleLinear', 'doubleAngle']:
                plusMinus = pm.shadingNode("plusMinusAverage", asUtility=True, name="additiveConnection")
                value[0] // attribute_destination
                value[0] >> plusMinus.input1D[0]
                attribute_source >> plusMinus.input1D[1]
                plusMinus.output1D >> attribute_destination

            elif attribute_source.get(type=True) in ['double3']:
                plusMinus = pm.shadingNode("plusMinusAverage", asUtility=True, name="additiveConnection")
                value[0] // attribute_destination
                value[0] >> plusMinus.input3D[0]
                attribute_source >> plusMinus.input3D[1]
                plusMinus.output3D >> attribute_destination
            else:
                print 'could not add data type: %s' % attribute_source.get(type=True)
    else:
        pm.connectAttr(attribute_source, attribute_destination)
Esempio n. 30
0
    def saveLights(self):
        # save lights in a json
        # properties dictionary will save all the parameters
        properties = {}

        # first get all the light widgets in our manager
        for lightWidget in self.findChildren(LightWidget):
            # lightWidget class light variable
            light = lightWidget.light
            transform = light.getTransform()

            # add to dictionary
            properties[str(transform)] = {
                'translate': list(transform.translate.get()),
                'rotation': list(transform.rotate.get()),
                'lightType': pm.objectType(light),
                'intensity': light.intensity.get(),
                'color': light.color.get()
            }
        directory = self.getDirectory()

        # %m%d will give 0701 for July 1st (month and day)
        # lightFile = os.path.join(directory, 'lightFile_%s.json' % time.strftime('%m%d'))
        # open a filebrowser qfileFialog
        lightFile = QtWidgets.QFileDialog.getSaveFileName(
            self, "Light Browser", directory, '*.json')
        # open file to write
        with open(lightFile[0], 'w') as f:
            # use json to write our file
            json.dump(properties, f, indent=4)

        logger.info('Saving file to %s' % lightFile)
Esempio n. 31
0
def transferMat():
    sel = pm.ls(sl=1)
    if sel == [] or len(sel) != 2:
        MGlobal.displayInfo('请选择2个物体(源+目标)不要多选或者少选!')
        return
    if pm.objectType(sel[0]) == 'mesh':
        sourceShape = sel[0]
    else:
        sourceShape = sel[0].getShapes()[0]
    if pm.objectType(sel[1]) == 'mesh':
        targetShape = sel[1]
    else:
        targetShape = sel[1].getShapes()[0]
    mel.eval('deformerAfterObjectSetMod %s %s' %
             (sourceShape.name(), targetShape.name()))
    MGlobal.displayInfo('完成!请检查结果!!!')
Esempio n. 32
0
def attachObj(obj, mesh, u, v, follOn, mode=1):
    rivetGrpName = follOn
    if not pm.objExists(rivetGrpName):
        pm.group(n=rivetGrpName, em=1)

    foll = pm.createNode('follicle')
    follDag = foll.firstParent()
    follDag.setParent(rivetGrpName)

    mesh.worldMatrix[0] >> foll.inputWorldMatrix
    meshShape = pm.listRelatives(mesh, s=True)[0]
    if pm.objectType(meshShape) == 'mesh':
        mesh.outMesh >> foll.inputMesh
    else:
        mesh.local >> foll.inputSurface

    foll.outTranslate >> follDag.translate
    foll.outRotate >> follDag.rotate
    follDag.translate.lock()
    follDag.rotate.lock()
    follDag.parameterU.set(u)
    follDag.parameterV.set(v)
    if mode == 1:
        pm.parent(obj, follDag)
    elif mode == 2:
        pm.parentConstraint(follDag, obj, mo=True)
    elif mode == 3:
        pm.pointConstraint(follDag, obj, mo=True)
    elif mode == 4:
        pm.parentConstraint(follDag, obj, mo=False)
    return follDag
Esempio n. 33
0
    def saveLights(self):
        """
		Save lights into JSON file so that it can be shared as a preset
			
		"""
        # Create dictionary to save our light properties
        properties = {}

        # For each light, get their properties
        for lightWidget in self.findChildren(LightWidget):
            light = lightWidget.light
            transform = light.getTransform()

            properties[str(transform)] = {
                'translate': list(transform.translate.get()),
                'rotation': list(transform.rotate.get()),
                'lightType': pm.objectType(light),
                'intensity': light.intensity.get(),
                'color': light.color.get()
            }

# Get directory of where to save to
        directory = self.getDirectory()
        # Save it to file each time with unique month/day identifier
        lightFile = os.path.join(directory,
                                 'lightFile_%s.json' % time.strftime('%m%d'))
        # Write it out to JSON
        with open(lightFile, 'w') as f:
            json.dump(properties, f, indent=4)
            logger.info('Saving file to %s' % lightFile)
Esempio n. 34
0
    def rotate(self, dir, angle):
        rot = [0, 0, 0]
        rot[ord(dir) - ord('x')] = angle

        trans = [
            PyNode(obj) for obj in selectedNodes()
            if objectType(obj) == 'transform'
        ]
        trans += [
            PyNode(obj).getParent() for obj in selectedNodes()
            if objectType(obj).startswith('nurbs')
        ]

        for obj in set(trans):
            for shape in core.shape.getShapes(obj):
                rotate(shape.cv, rot, r=True, os=True)
Esempio n. 35
0
    def NodeType(self):
        """ Get the type of all connected nodes """
        oColl = pm.selected()
        Nodes = [
            x for x in pm.listConnections(
                oColl,
                et=True,
                skipConversionNodes=True,
            )
        ]
        NodeType = list(set([pm.objectType(x) for x in Nodes]))

        try:
            NodeType.remove("nodeGraphEditorInfo")
        except:
            pass

        if NodeType != []:
            print('// Result: //')
            for types in NodeType:
                print("     " + types)
                pm.textScrollList(self.outputWin, edit=True, removeAll=True)
                pm.textScrollList(self.outputWin,
                                  edit=True,
                                  append=["Node Type : " + types])

        else:
            print('// Result: No Nodes //')
            pm.textScrollList(self.outputWin, edit=True, removeAll=True)
            pm.textScrollList(self.outputWin,
                              edit=True,
                              append=['Result: No Nodes'])
Esempio n. 36
0
 def _checkType(self, obj, typ):
     '''
     Return true if obj is of type typ, false otherwise
     '''
     if not pm.objectType(obj, isType=typ):
         raise Exception(str(obj) + " not of type: " + str(typ))
     return True
Esempio n. 37
0
 def dynamics_control_connect(dynObj, dynCtrl):
     '''Takes a dynamic pm.PyNode connects it to the dynCtrl pm.PyNode.spaceLocator
     Args:
         dynObj (pm.PyNode): the dynamic object to be attached
         dynCtrl (pm.PyNode): the dynamic control to drive
     Returns: (pm.PyNode) - controlled object
     '''
     
     """
     print 'Connecting Dynamic object %s of type %s to control %s'% (dynObj.name(),
                                                                     dynObj.type(),
                                                                     dynCtrl.name())
     """
     
     #[method for method in dir(object) if callable(getattr(object, method))]
     if callable(getattr(dynObj, 'getShape')):
         if dynObj.getShape():
             dynObj = dynObj.getShape()
 
     if pm.objectType(dynObj) == 'follicle':
         dynCtrl.pointLock.connect(dynObj.pointLock)
     else:
         for attr in [attr for attr in dynCtrl.listAttr() if attr.isKeyable()]:
             attr_name = attr.shortName()
             if dynObj.hasAttr(attr_name):
                 attr.connect(dynObj.attr(attr_name), f=True)
         
     return dynObj
Esempio n. 38
0
 def by_name(cls, scene_node):
     if pm.objectType(scene_node):
         new_instance = cls(node=pm.ls(scene_node)[0])
         return new_instance
     else:
         print 'object provided doesnt exists'
         return None
def get_color_or_inputs(slot_material, coat, size, progress_bar):
    mat_type = pm.objectType(slot_material)
    if mat_type == "lambert":
        get_lambert_inputs(slot_material, coat, size, progress_bar)
        return True
    if mat_type == "VRayMtl":
        get_Vray_inputs(slot_material, coat, size, progress_bar)
        return True
    if mat_type == "VRayCarPaintMtl":
        get_carPaint_inputs(slot_material, coat, size, progress_bar)
        return True
    if mat_type == "VRaySwitchMtl":
        get_switch_inputs(slot_material, coat, size, progress_bar)
        return True
    if mat_type == "VRayMtl2Sided":
        get_2sided_inputs(slot_material, coat, size, progress_bar)
        return True
    if mat_type == "VRayFastSSS2":
        get_SSS_inputs(slot_material, coat)
        return True
    if mat_type == "VRayBlendMtl":
        return None  #warn to bake blend material first
    #if slot_material doesn't match any supported type return False (will trigger warning and coat will be skipped)
    else:
        return False
def lights_area():
	global lights_layout
	lights_layout = pm.rowColumnLayout(p=lights_tab)

	global lights
	lights = pm.ls(lights=True)
	ibl_list = pm.ls(type='mentalrayIblShape')
	num_lights.setValue(len(lights))
	num_lights.setAnnotation('There are currently {0} lights in the scene'.format(len(lights)))

	pm.text(l='Lights In Scene', al='center', w=marginWidth)
	pm.text(l='', h=7)
	for each in lightSorting(lights):
		name = pm.listRelatives(each, parent=True, fullPath=True)[0]
		lightType = pm.objectType(each)

		if lightType == 'areaLight': 
			light = AreaLight(name, lightType, each)
		elif lightType == 'spotLight': 
			light = SpotLight(name, lightType, each)
		elif lightType == 'directionalLight': 
			light = DirectionalLight(name, lightType, each)
		elif lightType == 'pointLight': 
			light = PointLight(name, lightType, each)

	if ibl_list != []:
		pm.separator(w=marginWidth, h=14)
		light = IBL_GUI(ibl_list[0])

	unsupported_lights = sortBy_unsupported(lights)
	if unsupported_lights != []:
		pm.separator(w=marginWidth, h=14)
		global unsupportedLights_layout
		unsupportedFrame_layout = pm.frameLayout(l='Unsupported Lights ({0})'.format(len(unsupported_lights)), cl=True, cll=True, w=marginWidth, bgc=frameColor, ann="The lights in this section are not supported by this GUI")
		unsupportedLights_layout = pm.columnLayout()

		for unsupported in unsupported_lights:
			unsup_name = pm.listRelatives(unsupported, parent=True, fullPath=True)[0]
			unsup_lightType = pm.objectType(unsupported)

			light = UnsupportedLight(unsupported, unsup_name, unsup_lightType)

		pm.setParent(lights_layout)

	pm.setParent(main_tabsLayout)
	main_tabsLayout.setTabLabel([lights_tab, 'Lights'])
Esempio n. 41
0
def createVertSphere():
	'''
	create a poly sphere that will be used to determine 
	what verts should be influenced.
	'''
	sel = pm.selected()
	
	for s in sel:
		print pm.objectType(s)
		if pm.objectType(s) == 'joint':
			userPos = pm.xform(s, q = True, t = True, ws = True)
		elif pm.objectType(s) == 'mesh':
			userPos = pm.pointPosition(s, w = True)
		
		vSphere = pm.polySphere(n = '{0}_vtxSphere'.format(s), ch = False)
		pm.move(userPos[0],userPos[1],userPos[2], vSphere)
		
		return vSphere
Esempio n. 42
0
def selectMesh():
    sel = []      
    for sl in pm.ls(sl = True):
        print(sl)
        shps = []
        shps = pm.listRelatives(sl, allDescendents  = True, shapes = True, noIntermediate = True)
        pprint(shps)
        for shp in shps:
            print(pm.objectType(shp))
            if pm.objectType(shp) == 'mesh':
                tr = pm.listRelatives(shp, parent = True, path = True)
                for t in tr:
                    if t not in sel:
                        sel.append(t)
    
    pprint(sel)
#     pm.select(sel)
    return sel
Esempio n. 43
0
 def getControlAttrs(self,ctrl=None):
     if pm.objectType(ctrl) == 'transform':
         return pm.listAttr(ctrl,unlocked=True,k=True)
     else:
         attrs = pm.listAttr(ctrl,connectable=True)
         for attr in attrs:
             if attr == 'distance':
                 return ['distance']
         return None
Esempio n. 44
0
def shapeList(grouplist):
    childs = pm.listRelatives(grouplist,allDescendents= True)
    shapeList = []
    
    for child in childs:
        objType = pm.objectType(child)
        if objType == "mesh":
            shapeList.append(child)
    print shapeList, "is list of shape nodes in the Group"
    return shapeList
Esempio n. 45
0
 def get(
     self,
     node=None,
     side=None,
     name=None,
     space=None,
     purpose=None,
     decorator=None,
     childType=None,
     type=None,
     upper=True,
 ):
     """ gets the properly formatted name from a series of inputs.
     Args:
         node (pm.PyNode): a node to get the type from automatically
         all (string): all these are strings
     Returns (string): the resulting object name
     """
     for label, table_key in zip([side, name, space, purpose, decorator, childType, type], self._table_order):
         if label:
             self._format_table[table_key] = label
     # we need to set the type if the user has specified we do it automatically with the node input
     if node:
         print "getting node name custom"
         if node.getShape():
             type = pm.objectType(node.getShape())
         else:
             type = pm.objectType(node)
         print "got node name: %s" % type
     if not type == None:
         self._format_table["type"] = type
     # first create a temp format string to double check against number of inputs
     format_string = self._get_format()
     # then format based on that
     return format_string.format(
         side=self._format_table["side"],
         name=self._format_table["name"],
         space=self._format_table["space"],
         decorator=self._format_table["decorator"],
         purpose=self._format_table["purpose"],
         childType=self._format_table["childType"],
         type=self._get_suffix(self._format_table["type"]),
     )
Esempio n. 46
0
def findContainerNode(node = None):
    """ finds the container module for any selected node"""

    node = pm.ls(sl = True)[0] or node
    module_container = node

    if pm.objectType(node) != "container":
        module_container = pm.container(q = True, findContainer = node)

    return module_container
Esempio n. 47
0
def setModuleMetaInfo(node, attribute, attrInfo):
    """
    Sets the attribute of the modules meta node.
    If attribute type is message, attribute has to be the same for both meta and node.
    """
    node = pm.PyNode(node)
    # what if node is meta
    meta_node = None
    # find meta node
    if node.hasAttr("MetaNode"):
        meta_node = pm.PyNode(node.MetaNode.get())
    elif node.hasAttr("ModuleNodes"):
        meta_node = pm.PyNode(node)

    if meta_node != None:
        if pm.objectType(node) == "container":
            module_container = node
        else:
            module_container = pm.container(q = True, findContainer = node)

        lock_state = pm.lockNode(module_container, q = True, lock = True)[0]
        pm.lockNode(module_container, lock = False, lockUnpublished = False)

        #  ---------------------------------------------------------------

        # if attribute is a string
        if meta_node.attr(attribute).type() == "string":
            meta_node.attr(attribute).set(lock = False)
            meta_node.attr(attribute).set(attrInfo, lock = True)

        # if attribute is a message
        if meta_node.attr(attribute).type() == "message":
            # meta node and node need to have same attribute
            connected_node = pm.PyNode(attrInfo)
            # find the nodes container
            connectedNode_container = pm.container(q = True, findContainer = connected_node)

            if connectedNode_container != getModuleMetaInfo(node, "ModuleContainer"):
                # need to make sure the input node's container is unlocked
                connectedNode_lockState = pm.lockNode(connectedNode_container, q = True, lock = True)[0]
                pm.lockNode(connectedNode_container, lock = False, lockUnpublished = False)

                # if the input node does not have the same attribute
                if not connected_node.hasAttr(attribute):
                    _logger.warning("{} does not have attribute: {}".format(connected_node, attribute))
                    pm.addAttr(connected_node, longName = attribute, at="message", multi = True)
                try:
                    meta_node.attr(attribute).connect(connected_node.attr(attribute))
                except:
                    _logger.warning("CANNOT CONNECT {} TO {}".format(meta_node.attr(attribute), connected_node.attr(attribute)))

                pm.lockNode(connectedNode_container, lock = connectedNode_lockState, lockUnpublished = lock_state)


        pm.lockNode(module_container, lock = lock_state, lockUnpublished = lock_state)
Esempio n. 48
0
def __mirrorShapes__(elts, across='x', direction='L_'):
    if elts==None:
        # get each element inside CONTROL
        if pmc.objExists('CONTROLS'):
            elts = pmc.sets('CONTROLS', query=True)
            i=0
            while i<len(elts):
                if pmc.objectType(elts[i]) == 'objectSet':
                    elts.extend(pmc.sets(elts[i], query=True))
                    elts.pop(i)
                    i -= 1
                i += 1
            
            # delete element at center meaning without L_ or R_
            
            for i in reversed(range(len(elts))):
                if (elts[i].name().startswith(direction)==False):
                    elts.pop(i)
        else:
            vp.vPrint('No CONTROLS set funded', 1)
            
    else:
        # delete element at center meaning without L_ or R_
        for i in reversed(range(len(elts))):
            if (elts[i].name().startswith('L_')==False) and (elts[i].name().startswith('R_')==False):
                elts.pop(i)
    
    # creating the vector inverse depending on the across variable
    if across=='x':
        vectInverse = [-1,1,1]
    if across=='y':
        vectInverse = [1,-1,1]
    if across=='z':
        vectInverse = [1,1,-1]
    
    # loop into each element
    for elt in elts:
        # finding the opposite transform
        if elt.startswith('L_'):
            eltInv = various.checkObj( elt.name().replace('L_', 'R_'), type=['transform', 'joint'] )
        else:
            eltInv = various.checkObj( elt.name().replace('R_', 'L_'), type=['transform', 'joint'] )
        
        if eltInv:
            # getting atoms from both element
            atoms    = various.getAtoms(elt,    flat=False)
            atomsInv = various.getAtoms(eltInv, flat=False)
            # finding the smallest object just in case one has less atoms than the other
            if len(atoms) > len(atomsInv):
                size = len(atomsInv)
            else:
                size = len(atoms)
            # working on each atoms
            for i in range(size):
                pmc.move(atomsInv[i], atoms[i].getPosition(space='world')*vectInverse, absolute=True)
Esempio n. 49
0
def Interpolate2Jnts( firstJnt=None, secondJnt=None, numOfNewJnts=4 ):

	if firstJnt==None or secondJnt==None:
		firstJnt,secondJnt = pm.ls(sl=True)

	newJnts = []
	
	if numOfNewJnts <= 0:
		pm.warning("number of new joints must be bigger than zero.")
		return newJnts
	
	else:
		if (pm.objectType(firstJnt) == 'joint' and pm.objectType(secondJnt) == 'joint' ):
			firstChildJnt = firstJnt.getChildren()[0]
			secondChildJnt = secondJnt.getChildren()[0]             
			# find start and end pose of 2 curves
			crv1CV1Pos = dt.Vector( pm.xform(firstJnt,q=True, ws=True, t=True) )
			crv1CV2Pos = dt.Vector( pm.xform(firstChildJnt,q=True, ws=True, t=True) )
			crv2CV1Pos = dt.Vector( pm.xform(secondJnt,q=True, ws=True, t=True) )
			crv2CV2Pos = dt.Vector( pm.xform(secondChildJnt,q=True, ws=True, t=True) )

			# create a vector representing each curve
			crv1Vec = crv1CV2Pos - crv1CV1Pos
			crv2Vec = crv2CV2Pos - crv2CV1Pos
			start1ToStart2 = crv2CV1Pos - crv1CV1Pos
			end1ToEnd1 = crv2CV2Pos - crv1CV2Pos
			# find segment's length
			startSegLen = start1ToStart2.length() / (numOfNewJnts+1)
			endSegLen = end1ToEnd1.length() / (numOfNewJnts+1)

			# find start and end points for new curves and creating them
			for i in range(1 ,numOfNewJnts+1):
				tmpStart = crv1CV1Pos + ( start1ToStart2.normal() * startSegLen * i )
				tmpEnd = crv1CV2Pos + ( end1ToEnd1.normal() * endSegLen * i)
				pm.select(clear=True)
				newJnts.append( pm.joint( p = tmpStart ) )
				newJnts.append( pm.joint( p = tmpEnd ) )
				pm.joint(newJnts , e  = True , zso = True , oj = "xzy" , sao = "yup" , ch = True )  
			return newJnts
		
		else:
			pm.error ( "interpolate2Jnts command needs 2 sets of joints."  )
Esempio n. 50
0
    def additem(self):
        
        selectNode = self.nodeFilter(pm.selected())
        
        referenceAttrList = []
        
        for k in selectNode:
            if type(k) == str:
                print k
                break
            else:
                referenceAttrList = referenceAttrList + k.referenceFile().getReferenceEdits()

        referenceAttrListFilter = []
        if len(referenceAttrList) <= 1:
            self.progress.setRange(1, len(referenceAttrList)+1)
            print '?'
        else:
            self.progress.setRange(1, len(referenceAttrList))
        
        self.i = 1
        
        for x in referenceAttrList:
            self.i += 1
            self.progress.setValue(self.i)

            if x[0:7] == 'setAttr' and pm.objExists(x.split(' ')[1]):
                if pm.objectType(x.split(' ')[1].split('.')[0]) == 'transform':
                    if not pm.getAttr(x.split(' ')[1], l=1):
                        referenceAttrListFilter.append(x)
            elif x[0:7] == 'connect' and pm.objExists(x.split(' ')[2].replace('"','')):
                print x.split(' ')[1].split('.')[0].replace('"','')
                print  pm.objExists(x.split(' ')[2].replace('"',''))
                if pm.objectType(x.split(' ')[2].split('.')[0].replace('"','')) == 'transform':
                    referenceAttrListFilter.append(x)
            
        referenceAttrListFilter = self.filterOutStringlist(referenceAttrListFilter, '-k 0 ')
    
        if self.listWg.count() >= 0:
            self.listWg.clear()
            self.listWg.addItems(referenceAttrListFilter)   
Esempio n. 51
0
 def __init__( self, soft_mod ):
     '''Class for manipulating soft mod object members
     @param soft_mod: transform to query or soft mod itself
     @type  soft_mod: pm.nt.Transform or pm.nt.SoftMod
     @usage:
         mod = SoftMod( pm.ls(sl=True)[0] )
         mod.select_members()
         mod.add_sel_verts()
     '''
     if pm.objectType( soft_mod ) == 'transform':
         soft_mod = soft_mod.getShape().listConnections( type = 'softMod' )[0]
     self.soft_mod = soft_mod
     self.set = self.soft_mod.listConnections(d=True,s=False,type='objectSet')[0]
Esempio n. 52
0
 def fetchShotFrameRange_Fn(self, shotName):
     self.shotName = shotName
     if pm.objExists(self.shotName + '_shotCam'):
         self.camName = pm.PyNode(self.shotName + '_shotCam')
         pm.select(self.camName, r=1)
         if pm.objectType(self.camName.getShape()) == 'camera':
             startFrame = pm.findKeyframe(timeSlider=False, which='first')
             endFrame = pm.findKeyframe(timeSlider=False, which='last')
             pm.select(cl=1)
             if startFrame == endFrame:
                 return sys.stderr.write('Please check the keyframes on %s_shotCam\n' % self.shotName)
             else:
                 return {'shotName':self.shotName, 'cameraName':str(self.camName.name()), 'mpStartFrame':startFrame, 'mpEndFrame':endFrame}
Esempio n. 53
0
 def _get_objectHierarchy_transform ( self, object, direction):
     '''This function does matches the transform to args from src from the origTrans attr
     :param name: object, direction
     :type name: str, str
     :type state: bool.
     :returns: string list
     '''
     #listed from lowest child up
     if (direction == 'down'):
         children = pm.listRelatives( object, ad=1 )
         for child in children:
             if pm.objectType(child) != 'transform':
                 children.remove(child)
         return children
     
     #listed from lowest parent up
     if (direction == 'up'):
         parents = pm.PyNode(object).getAllParents()
         for parent in parents:
             if pm.objectType(parent) != 'transform':
                 parents.remove(parent)
         return parents
def populateBsMen(*args):
    
    bs = []
    
    #getting blendshapes
    for i in pm.listHistory(args[-1]):
        if pm.objectType(i, isType='blendShape'):
            bs.append(str(i))
    print bs
    #clearing then re-populating the menu
    args[-2].clear()
    pm.menuItem(l='<Create New>', p=args[-2])
    
    for i in bs:
        pm.menuItem(l=i, p=args[-2])
def gatherInfo(*args):
    base, shape, tweak, skin = args
    
    #weed out any mistakes
    if not base:
        pm.error('No objects are selected')
        
    #gather info
    if not shape: shape = pm.listRelatives(base, s=True)[0]
    
    if not pm.objectType(shape, isType='mesh'):
        pm.error('This script is only approved to work with polygons')
    
    shapeConns = pm.listHistory(shape)
    
    for i in shapeConns:
        if pm.objectType(i, isType='tweak') and not tweak:
            tweak = i
        elif pm.objectType(i, isType='skinCluster') and not skin:
            skin = i
        else:
            continue
    
    return base, shape, tweak, skin
	def FindGeometry(self, _selection):
		_selection = pm.ls(_selection, transforms = True)
		
		nonJointSelection = []
		
		for node in _selection:
			if not pm.objectType(node, isType = "joint"):
				nonJointSelection.append(node)
		
		
		if len(nonJointSelection) > 0:
			return nonJointSelection
		
		else:
			return None
Esempio n. 57
0
def rig_connectDynCtrl(dynObj, dynCtrl):
	'''Takes a dynamic pm.PyNode connects it to the dynCtrl pm.PyNode.spaceLocator
	Args:
		dynObj (pm.PyNode): the dynamic object to be attached
		dynCtrl (pm.PyNode): the dynamic control to drive
	Returns: (pm.PyNode) - controlled object
	'''
	if pm.objectType(dynObj.getShape()) == 'follicle':
		dynCtrl.pointLock.connect(dynObj.pointLock)
	else:
		for attr in ['simulationMethod','collide','selfCollide','drag','damp','friction','iterations',
					 'stiffness','startFrame','turbulenceStrength','turbulenceFrequency','turbulenceSpeed']:
			if pm.objExists(dynObj.name()+'.'+attr) and pm.objExists(dynCtrl.name()+'.'+attr):
				dynCtrl.attr(attr).connect(dynObj.attr(attr))
	return dynObj
Esempio n. 58
0
def setSplit():
	sel = pm.ls(sl=True)
	for obj in sel:
		chipNames=[]
		if obj.getShape():
			sets=obj.getShape().listConnections(d=False,s=True,type='objectSet')
			print sets
			for setM in sets:
				
				faces=[face for face in pm.ls (setM.members(), flatten=True) if pm.objectType(face) == 'mesh']
				chip=pm.polyChipOff(faces,dup=False, ch=True, n=setM+'_CO', xft=True)
				chipNames.append(setM)
		print chipNames
		#chipNames.reverse()

		#separated=
		'''
Esempio n. 59
0
def amcveProfile(cvSrc, trim):
	"""
	"""
	cvSrc = pm.ls(cvSrc)[0]
	tiLen = []

	if trim:
		tiLen.append(pm.playbackOptions(q= 1, min= 1))
		tiLen.append(pm.playbackOptions(q= 1, max= 1))
		pm.undoInfo(ock= 1)
		pm.setKeyframe(cvSrc, insert= 1, t= tiLen, f= tiLen)
		pm.undoInfo(cck= 1)

	cvBaseMod = {
			'cvTyp' : pm.objectType(cvSrc),
			'prInf' : cvSrc.getPreInfinityType().key,
			'poInf' : cvSrc.getPostInfinityType().key,
			'weedT' : pm.keyTangent(cvSrc, q= 1, weightedTangents= 1),
			'breaD' : pm.keyframe(cvSrc, q= 1, breakdown= 1)
	}
	cvPortray = {
			'Frame' : pm.keyframe(cvSrc, q= 1, timeChange= 1),
			'Float' : pm.keyframe(cvSrc, q= 1, floatChange= 1),
			'Value' : pm.keyframe(cvSrc, q= 1, valueChange= 1)
	}
	cvFeature = {
			'TLock' : pm.keyTangent(cvSrc, q= 1, lock= 1),
			'WLock' : pm.keyTangent(cvSrc, q= 1, weightLock= 1),
			'InTyp' : pm.keyTangent(cvSrc, q= 1, inTangentType= 1),
			'OuTyp' : pm.keyTangent(cvSrc, q= 1, outTangentType= 1),
			'InWet' : pm.keyTangent(cvSrc, q= 1, inWeight= 1),
			'OuWet' : pm.keyTangent(cvSrc, q= 1, outWeight= 1),
			'InAng' : pm.keyTangent(cvSrc, q= 1, inAngle= 1),
			'OuAng' : pm.keyTangent(cvSrc, q= 1, outAngle= 1)
	}
	cvSrcProfile = {
			'cvTrimmed' : tiLen,
			'cvBaseMod' : cvBaseMod,
			'cvPortray' : cvPortray,
			'cvFeature' : cvFeature
	}
	if trim:
		pm.undo()

	return cvSrcProfile
	def FindBlueprintJoints(self, _selection):
		
		selectedBlueprintJoints = []
		for obj in _selection:
			
			if pm.objectType(obj, isType = "joint"):
				jointNameInfo = utils.StripAllNamespaces(obj)
				
				if jointNameInfo != None:
					jointName = jointNameInfo[1]
					
					if jointName.find("blueprint_") == 0:
						selectedBlueprintJoints.append(obj)
		
		if len(selectedBlueprintJoints) > 0:
			return selectedBlueprintJoints
		
		else:
			return None