• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.referenceQuery函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.referenceQuery函数的典型用法代码示例。如果您正苦于以下问题:Python referenceQuery函数的具体用法?Python referenceQuery怎么用?Python referenceQuery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了referenceQuery函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_invalid

    def get_invalid(instance):
        """Return invalid reference nodes in the instance

        Terminology:
            reference node: The node that is the actual reference containing
                the nodes (type: reference)
            referenced nodes: The nodes contained within the reference
                (type: any type of nodes)

        """
        referenced_nodes = cmds.ls(instance, referencedNodes=True, long=True)
        if not referenced_nodes:
            return list()

        # Get reference nodes from referenced nodes
        # (note that reference_nodes != referenced_nodes)
        reference_nodes = set()
        for node in referenced_nodes:
            reference_node = cmds.referenceQuery(node, referenceNode=True)
            if reference_node:
                reference_nodes.add(reference_node)

        # Check for failed edits on each reference node.
        invalid = []
        for reference_node in reference_nodes:
            failed_edits = cmds.referenceQuery(reference_node,
                                               editNodes=True,
                                               failedEdits=True,
                                               successfulEdits=False)
            if failed_edits:
                invalid.append(reference_node)

        return invalid
开发者ID:BigRoy,项目名称:pyblish-magenta,代码行数:33,代码来源:validate_references_no_failed_edits.py


示例2: doNameObject

def doNameObject(obj,sceneUnique = False,fastIterate = True):
    """ 
    Names an object

    ARGUMENTS:
    obj(string) - the object we'd like to name
    sceneUnique(bool)- whether to do a full scene check or just the faster check

    RETURNS:
    newName(string) on success
    
    """
    ### input check
    assert mc.objExists(obj) is True, "'%s' doesn't exist" %obj
    assert mc.referenceQuery(obj, isNodeReferenced=True) is not True, "'%s' is referenced, can't name!" %obj
    
    name = returnUniqueGeneratedName(obj,sceneUnique, fastIterate)
    nameFactory = NameFactory(obj)
    
    if nameFactory.amIMe(name):
        guiFactory.warning("'%s' is already named correctly."%nameFactory.nameBase)
        return name
    else:
        objLong = mc.ls(obj,long=True)
        renameBuffer = mc.rename(objLong,name)

        shapes = mc.listRelatives(renameBuffer,shapes=True,fullPath=True)
        if shapes:
            for shape in shapes:
                if not mc.referenceQuery(shape, isNodeReferenced=True):
                    name = returnUniqueGeneratedName(shape,sceneUnique, fastIterate)
                    mc.rename(shape,name)
    
        return renameBuffer
开发者ID:smdharris,项目名称:config,代码行数:34,代码来源:NameFactory.py


示例3: exportShaders

	def exportShaders(self):
		"""export custom shaders from scene, ex: shaders for masks etc..."""
		lays = rlayer.renderlayers()
		finalExport = []
		for l in lays:
			if l.name == 'defaultRenderLayer':
				continue
			if l.overridedShader:
				finalExport.append( l.overridedShader )
			else:
				if l.overridesWithConnections[1]:
					finalExport.extend( l.overridesWithConnections[1] )
		if finalExport:
			shadersToExport = []
			for i in finalExport:
				if mc.referenceQuery( i, inr = True ) or i in shadersToExport: #is a referenced node
					continue
				if mc.referenceQuery( i.a.surfaceShader.input, inr = True ): #check if shader is a reference
					continue
				if i.a.displacementShader.input:
					if mc.referenceQuery( i.a.displacementShader.input, inr = True ): #check if displacement is a reference
						continue
				shadersToExport.append( i )
			mc.select( shadersToExport, r = 1, ne = 1 )
			mc.file( self.shaderPath.path, op = "v=0", typ = "mayaAscii", pr = 1, es = 1 )
开发者ID:skarone,项目名称:PipeL,代码行数:25,代码来源:renderLayerExporter.py


示例4: deformCharacterShapeSel

 def deformCharacterShapeSel(self, value):
     RN = mc.referenceQuery(self.core.skCharacter[int(value)-1], referenceNode=1)
     Nodes = mc.referenceQuery(RN, nodes=1)
     self.characterdeformShape = []
     self.allCharacterRightdeformShape = []
     for item in Nodes:
         if self.nodeTypeSelf(item) in self.shapeType:
             self.characterdeformShape.append(item)
     for each in self.characterdeformShape:
         itemP = mc.listRelatives(each, p=1)[0]
         itemPP = mc.listRelatives(itemP, p=1)
         if itemPP != None and mc.getAttr('%s.v'%itemP) != 0 and mc.getAttr('%s.v'%itemPP[0]) != 0:
             self.allCharacterRightdeformShape.append(each)
             self.allCharacterRightdeformShape.reverse()
     for item in self.allCharacterRightdeformShape:
         if mc.filterExpand( item, sm=(10,12)) == None:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     for item in self.allCharacterRightdeformShape:
         if item.endswith('Orig') == True:
             self.allCharacterRightdeformShape.remove(item)
     return self.allCharacterRightdeformShape
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:33,代码来源:mulitBatchExportCache_08.py


示例5: defineAsset

 def defineAsset(self):
     self.assetType, self.topGrp, self.astRes = None, None, None
     self.refObjs = []
     if not mc.referenceQuery(self.refNode,il=1):
         utils.msgWin("Warning", "Reference not loaded for %s"%self.refNode, self.silent)
         self.refLoaded = False
     else:
         self.refLoaded = True
     self.assetPath = mc.referenceQuery(self.refNode, f = True, wcn = True)
     self.assetPathCopyNum = mc.referenceQuery(self.refNode, f = True, wcn = False)
     self.namespace = mc.file(self.assetPathCopyNum, q = 1, ns = 1)
     if "/char/" in self.assetPath: self.assetType = "char" 
     if "/prop/" in self.assetPath: self.assetType = "prop"
     if "/sets/" in self.assetPath: self.assetType = "sets"
     if not self.assetType:
         utils.msgWin("Error", "Error identifying asset type from asset path for %s"%self.refNode, self.silent)
         self.validAsset = False
     if self.refLoaded:
         self.refObjs = mc.referenceQuery(self.refNode,n=1)
         if not self.refObjs:
             utils.msgWin("Error", "Couldn't find any referenced objects", self.silent)
             self.validAsset = False
         self.topGrp = self.refObjs[0]
         if self.assetType == "prop":
             topGrpAttrs = mc.listAttr(self.topGrp,ud=1)
             if topGrpAttrs:
                 if ('Elements' in topGrpAttrs):
                     self.assetType = 'elms'
         self.astRes = str(utils.findObjRes(self.topGrp))
开发者ID:sid2364,项目名称:Maya_Python,代码行数:29,代码来源:pipeClasses.py


示例6: cleanupReference

def cleanupReference( rfn ):
    #Get reference node.
    if cmds.nodeType( rfn ) == "reference":
        rfn = rfn
    elif os.path.isfile( rfn ):
        rfn = cmds.referenceQuery( rfn, rfn=True )
    else:
        print "%s is not reference" % rfn
        return None
    references = []
    pm = cmds.listConnections( rfn, type="proxyManager" )
    if pm:
        references = cmds.listConnections( "%s.proxyList" % pm[0], type="reference" )
    if not references:
        references = [ rfn ]
        m_words = "|".join( references )
    else:
        references = [ rfn ]
        m_words = rfn
    edits = []
    if references:
        for i in range( 0, len( references )):
            strings = cmds.referenceQuery( references[i], failedEdits=True, successfulEdits=True, editStrings=True )
            if strings:
                for i in range( 0, len( strings )):
                    if strings[i] not in edits:
                        if not re.findall( m_words, strings[i] ):
                            edits.append( strings[i] )
    if edits:
        removeEdits( rfn, edits )
开发者ID:k0k0c,项目名称:scripts,代码行数:30,代码来源:ml_reference.py


示例7: _removeNativeModels

	def _removeNativeModels(self, models):
		""" Deletes provided native models.
			:param models: list of native models
			:return: <bool> success
		"""
		ret = True
		for model in models:
			nameInfo = cross3d.SceneWrapper._namespace(model)
			fullName = cross3d.SceneWrapper._mObjName(model)
			if cmds.referenceQuery(fullName, isNodeReferenced=True):
				# The model is referenced and we need to unload it.
				refNode = cmds.referenceQuery(fullName, referenceNode=True)
				filename = cmds.referenceQuery(refNode, filename=True)
				# If all nodes in the namespace are referenced, the namespace will be removed, otherwise
				# the namespace will still exist and contain all of those unreferenced nodes.
				cmds.file(filename, removeReference=True)
				# Remove nodes that were parented to referneced nodes
				leftovers = self.objects(wildcard='{refNode}fosterParent*'.format(refNode=refNode))
				if leftovers:
					self.removeObjects(leftovers)
			# Local node processing: check for unreferenced items in the namespace and remove them.
			namespace = nameInfo['namespace']
			if cmds.namespace(exists=namespace):
				cmds.namespace(removeNamespace=namespace, deleteNamespaceContent=True)
			if cmds.namespace(exists=namespace):
				print 'The namespace {ns} still exists the model {model} was not entirely removed.'.format(namespace, model=fullName)
				ret = False
		return ret
开发者ID:blurstudio,项目名称:cross3d,代码行数:28,代码来源:mayascene.py


示例8: addReferences

def addReferences():
    cmds.select("dsMetaData")
    shotList = cmds.ls(type = "shot")
    refList = cmds.ls(rf=True)
    for shot in shotList:
        
        """ skips namespaces"""
        if re.search(":",shot):
            sSplit = shot.split(":")
            shot = sSplit[-1]
        
        for ref in refList:
            if cmds.referenceQuery(ref,n=True,dp=True) != None:
                refNs = cmds.referenceQuery(ref,ns=True,shn=True)
                refN = cmds.referenceQuery(ref,f=True,shn=True)
                
                print refNs
                print refN
                
                if not cmds.objExists("dsMetaData." + str(shot) + "_" + refNs):
                    cmds.addAttr(ln= str(shot) + "_" + refNs, at="message", h=False,r=True)
                    cmds.addAttr(ln= str(shot) + "_" + refNs + "_viz", at='bool', h=False,r=True)
                    cmds.addAttr(ln= str(shot) + "_" + refNs + "_assetID",at="long",h=False,r=True)
                    cmds.addAttr(ln= str(shot) + "_" + refNs + "_version",dt="string",h=False,r=True)
                    connectReferences(str(shot)+ "_" + refNs,refNs,refN)
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:25,代码来源:dsMetaDataTools.py


示例9: _modifiedAttrs

	def _modifiedAttrs(self):
		""" Returns a dictionary of modifications made to this referenced model.
		
		For referneced models return info describing the modifications made by the referencing
		system.
		"""
		modified = {}
		if self.isReferenced():
			fullName = self.path()
			refNode = cmds.referenceQuery(fullName, referenceNode=True)
			# Build the setAttr pattern
			pattern = r'setAttr {node}.(?P<attr>[^ ]+)'.format(node = fullName.replace('|', r'\|'))
			setAttrRegex = re.compile(pattern)
			# TODO: Add patterns for other mel commands like addAttr, etc
			for s in cmds.referenceQuery(refNode, editStrings=True):
				# Process setAttr
				match = setAttrRegex.match(s)
				if match:
					key = match.groupdict()['attr']
					if s.endswith('"'):
						# Found a string. Note, this does not include escaped quotes.
						openingQuote = s[::-1].find('"', 1)
						value = s[-openingQuote:-1]
					else:
						# its not a string
						value = s.split(' ')[-1]
					modified.setdefault(key, {}).setdefault('setAttr', {}).update(value=value, command=s)
		return modified
开发者ID:blurstudio,项目名称:cross3d,代码行数:28,代码来源:mayascenemodel.py


示例10: listReferenceEdits

def listReferenceEdits( rfn ):
    """
    List all edits for current reference node.
    """
    result = []
    successfull = []
    if cmds.nodeType( rfn ) == "reference":
        rfn = rfn
    else:
        rfn = cmds.referenceQuery( rfn, rfn=True ) 
    edits = cmds.referenceQuery( rfn, failedEdits=True, successfulEdits=True, editStrings=True )
    if edits:
        edits = [ "".join( [ m_part for m_part in re.split( "\|:[A-z0-9:]+", edits[i] ) if m_part != "" ] ) for i in range( 0, len( edits )) ]
        m_content = cmds.ls( cmds.referenceQuery( rfn, nodes=True, dagPath=True ), long=True )
        for c in range( 0, len( m_content )):
            m_levels = listReferenceLevels( m_content[c] )
            for l in range( 0, len( m_levels )):
                m_expr = re.compile( "(\A|\s|\||\")+([A-z0-9_|]+|){0}(\Z|\s|\$|\"|\.)+".format( "(\||)".join( m_levels[l][0].split( "|" ))))
                for e in range( 0, len( edits )):
                    if edits[e] not in successfull:
                        if m_expr.findall( edits[e] ):
                            m_temp = [ rfn, m_content[c], m_levels[l][-1], m_levels[l][0], edits[e].split( " " )[0], edits[e] ]
                            result.append( m_temp )
                            successfull.append( edits[e] )
        for e in range( 0, len( edits )):
            if edits[e] not in successfull:
                m_temp = [ rfn, "unknown", "unknown", "unknown", edits[e].split( " " )[0], edits[e] ]
                result.append( m_temp )
    return result
开发者ID:k0k0c,项目名称:scripts,代码行数:29,代码来源:ml_reference.py


示例11: getAssetSelection

    def getAssetSelection(self): 
        objs = mc.ls(sl=True)
        assets = []
        namespaces = []
        if objs: 
            for obj in objs: 
                if mc.referenceQuery(obj, inr=True): 
                    path = mc.referenceQuery(obj, f=True)
                    asset = entityInfo.info(path)
                    if not asset.name() in assets: 
                        assets.append(asset.name())

                else: 
                    namespace = obj.split(':')[0]
                    if not namespace in namespaces: 
                        namespaces.append(namespace)

            for namespace in namespaces: 
                attr = '%s:Geo_Grp.assetName' % namespace 
                if mc.objExists(attr): 
                    assetName = mc.getAttr(attr)
                    if not assetName in assets: 
                        assets.append(assetName)


        return assets
开发者ID:myCodeTD,项目名称:matteTools,代码行数:26,代码来源:matteImport_app.py


示例12: dupReferenceForSelectedObjects

def dupReferenceForSelectedObjects():
	"""
	Duplicate reference of the selected objects, only one time, and copy their edits
	"""
	allreadyDup = []
	for a in mc.ls( sl = True ):
		ap = mc.referenceQuery( a, referenceNode=True, topReference=True )
		if any( ap == r for r in allreadyDup ):
			print 'skipping',a
			continue
		allreadyDup.append( ap )
		edits = mc.referenceQuery( ap , editStrings = True )
		mc.select( a )
		try:
			mm.eval( 'duplicateReference 0 ""' )
		except:
			print 'maya de mierda'
		baseOldName = edits[0][edits[0].find( '|' )+1:edits[0].find( ':' )]
		baseNewName = mc.ls( sl = True )[0].split( ':' )[0]
		for e in edits:
			print '"""""""'
			print e
			print baseOldName,baseNewName
			try:
				mm.eval( e.replace( baseOldName, baseNewName, 1 ) )
			except:
				continue
开发者ID:skarone,项目名称:PipeL,代码行数:27,代码来源:reference.py


示例13: clearHeadPart

    def clearHeadPart(self, *args):

        #find the current character
        try:
            character = cmds.optionMenu(self.widgets["characterList"], q = True, v = True)

        except:
            cmds.warning("No valid character selected")

        #find any body part references
        refs = cmds.ls(type = "reference")
        headPartRefs = []
        for ref in refs:
            namespace = cmds.referenceQuery(ref, namespace = True)

            if namespace.find("_headPart") != -1:
                headPartRefs.append([ref, namespace])


        #find out which, if any, are tied to this character and remove
        for ref in headPartRefs:
            joint = ref[1] + ":root"
            constraint = cmds.listConnections(joint, type = "parentConstraint")[0]
            target = cmds.listConnections(constraint + ".target")[0].partition(":")[0]

            if target == character:
                filename = cmds.referenceQuery(ref[0], filename = True)
                cmds.file(filename, rr = True)

            #unhide the original geometry
            if cmds.objExists(character + ":Geo_Layer"):
                cmds.setAttr(character + ":Geo_Layer.v", 1)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:32,代码来源:fortniteCharacterEditor.py


示例14: unloadReference

def unloadReference( rfn ):
    #Get reference node.
    result = []
    if cmds.nodeType( rfn ) == "reference":
        rfn = rfn
    elif os.path.isfile( rfn ):
        rfn = cmds.referenceQuery( rfn, rfn=True )
    else:
        print "%s is not reference" % rfn
        return None
    relatives = referenceRelatives( rfn, onlyLoaded=True, parents=False )
    if cmds.referenceQuery( rfn, isLoaded=True ):
        if relatives:
            for i in range( len( relatives )-1, -1, -1 ):
                parent = cmds.referenceQuery( relatives[i], parent=True, filename=True )
                parent = parent and parent or "untitled"
                pm = cmds.listConnections( relatives[i], type="proxyManager" )
                if pm:
                    mcache = cmds.listConnections( "%s.proxyList" % pm[0], type="reference" )
                else:
                    mcache = [ relatives[i] ]
                for n in range( 0, len( mcache )):
                    if mcache[n] not in result:
                        result.append( mcache[n] )
                        pcache = cmds.referenceQuery( mcache[n], parent=True, filename=True )
                        pcache = pcache and pcache or "untitled"
                        if parent != pcache:
                            print "//Warning:\n//\treference is not valid:\n//\t{0} has parent {1}\n//\t{2} has parent {3}\n//\tplease check reference nodes connections.\n".format( relatives[i], parent, mcache[n], pcache )
                        if cmds.referenceQuery( mcache[n], isLoaded=True ):
                            print "unload reference: %s" % mcache[n]
                            cmds.file( unloadReference=mcache[n] )
    return result
开发者ID:k0k0c,项目名称:scripts,代码行数:32,代码来源:ml_reference.py


示例15: fixNode

	def fixNode(self, nodeToFix, invert=False):
		print ("\n" + nodeToFix)

		# gets all attributes that need to be fixed
		attrs = cmds.listAttr(nodeToFix, st=["hubElement"])
		for attr in attrs:
			print ("Found Attribute -> '" + attr + "'")
			
			# check if the attribute is empty and if yes, fixs it
			val = cmds.getAttr(nodeToFix + "." + attr)

			condition = (not val or val != "neverBirdA")
			if invert: condition = (val == "neverBirdA")

			if condition:
				msg = ("Attribute '" + attr + "' is empty or incorrect.")
				if invert: msg = ("Attribute '" + attr + "' is OK.")
				print msg

				# if the attribute is locked, unlocks it first
				isLocked = cmds.getAttr((nodeToFix + "." + attr), lock=True)
				if isLocked:
					print ("Attribute '" + attr + "' is locked. Unlocking it.")
					isReferenced = cmds.referenceQuery((nodeToFix + "." + attr), isNodeReferenced=True)
					if isReferenced:
						try:
							cmds.setAttr((nodeToFix + "." + attr), lock=False)
						except:
							print ("Attribute '" + attr + "' could not be unlocked, it is referenced.")
					else:
						cmds.setAttr((nodeToFix + "." + attr), lock=False)

				# if the attribute is now unlocked, fixes the value
				isLocked = cmds.getAttr((nodeToFix + "." + attr), lock=True)
				if not isLocked:
					msg = ("Attribute '" + attr + "'. Setting value to 'neverBirdA'")
					if invert: msg = ("Attribute '" + attr + "'. Setting value to 'empty string'.")
					print msg

					newVal = "neverBirdA"
					if invert: newVal = ""
					
					print (nodeToFix + "." + attr)
					print (cmds.getAttr((nodeToFix + "." + attr), settable=True))

					cmds.setAttr((nodeToFix + "." + attr), newVal, type="string")
					
					isReferenced = cmds.referenceQuery((nodeToFix + "." + attr), isNodeReferenced=True)
					if not isReferenced:
						print ("Attribute '" + attr + "'. Locking again")
						cmds.setAttr((nodeToFix + "." + attr), lock=True)
					else:
						print ("Attribute '" + attr + "'. Is referenced, unable to locl again.")
				else:
					print ("Attribute '" + attr + "' could not be unlocked.")

			else:
				msg = ("Attribute '" + attr + "' is OK -> '" + val + "'")
				if invert: msg = ("Attribute '" + attr + "' is not OK.")
				print msg
开发者ID:esernaalonso,项目名称:dev,代码行数:60,代码来源:fixPanNeverBirdsCurvesNames.py


示例16: buildScene

def buildScene(cameraFile, envFile, charFile):
    '''
    Build the final lighting scene file.
    :param cameraFile: Camera alembic file to import
    :param envFile:  Published layout env file to reference
    :param charFile: Baked char file to reference
    :return:
    '''
    if isValidFile(envFile):
        try:
            # Check if env file is already referenced.
            cmds.referenceQuery(envFile, filename=True)
        except RuntimeError:
            cmds.file(envFile, r=True)

    if isValidFile(charFile):
        try:
            # Check if env file is already referenced.
            cmds.referenceQuery(charFile, filename=True)
        except RuntimeError:
            cmds.file(charFile, r=True)

    if isValidFile(cameraFile):
        # Check if camera exists in scene
        cameraNodes = cmds.ls('renderCam')
        if len(cameraNodes) == 1:
            # Camara exists, delete and re-import alembic
            cameraNode = cameraNodes[0]
            cmds.delete(cameraNode)
        cmds.AbcImport(cameraFile, mode='import')

    cmds.file(save=True, type='mayaBinary', force=True)
开发者ID:afrocircus,项目名称:LVFX-pipeline,代码行数:32,代码来源:lt_build_scene.py


示例17: referenceRelatives

def referenceRelatives( rfn, onlyLoaded=False, parents=False ):
    """
    List all currently loaded references in current scene.
    """
    result = []
    references = [ rfn ]
    if references:
        while references:
            mcache = []
            for i in range( 0, len( references )):
                if references[i] not in result and ( onlyLoaded is True and cmds.referenceQuery( references[i], isLoaded=True ) or onlyLoaded is not True ):
                    result.append( references[i] )
                    if parents is False:
                        relatives = cmds.referenceQuery( references[i], child=True, rfn=True )
                    else:
                        relatives = cmds.referenceQuery( references[i], parent=True, rfn=True )
                    if relatives:
                        relatives = type( relatives ) is not list and [ relatives ] or relatives
                        for n in range( 0, len( relatives )):
                            if relatives[n] not in result:
                                mcache.append( relatives[n] )
            if mcache:
                references = mcache
            else:
                break
    return result
开发者ID:k0k0c,项目名称:scripts,代码行数:26,代码来源:ml_reference.py


示例18: do

 def do(self, *args):
     try:
         sel = mc.ls(sl=1)
         sum = 0.0
         sum = len(sel)
         amount = 0.0
         for item in sel:
             mc.progressWindow(
                 title="Removing References", progress=amount, status="Removing: 0%", isInterruptable=True
             )
             if mc.progressWindow(query=True, isCancelled=True):
                 break
             if mc.progressWindow(query=True, progress=True) >= 100:
                 break
             RN = mc.referenceQuery(item, referenceNode=1)
             Nodes = mc.referenceQuery(RN, referenceNode=True, topReference=True)
             referenceFile = mc.referenceQuery(Nodes, f=1)
             reLoaded = mc.referenceQuery(referenceFile, il=True)
             if reLoaded == 1:
                 mc.file(referenceFile, unloadReference=1)
             amount = float((sel.index(item) + 1)) / float(len(sel)) * 100.0
             mc.progressWindow(edit=True, progress=amount, status=("Removing: " + ` amount ` + "%"))
             # mc.pause( seconds=1 )
         mc.progressWindow(endProgress=1)
     except:
         pass
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:26,代码来源:removeReferences_01.py


示例19: export_mesh

    def export_mesh(self, transform, shape, awd_ctr):
        try:
            mtx = mc.xform(transform, q=True, m=True)
        except:
            print('skipping invalid %s' % transform)
 
        tf_name = self.get_name(transform)
        sh_name = self.get_name(shape)

        tf_is_ref = mc.referenceQuery(transform, inr=True)
        sh_is_ref = mc.referenceQuery(shape, inr=True)
        if (tf_is_ref or sh_is_ref) and self.replace_exrefs:
            # This is an external reference, and it should be
            # replaced with an empty container in the AWD file
            ctr = AWDContainer(name=tf_name, transform=AWDMatrix3x4(mtx))
            self.set_attributes(transform, ctr)
            self.block_cache.add(transform, ctr)
            if awd_ctr is not None:
                awd_ctr.add_child(ctr)
            else:
                self.awd.add_scene_block(ctr)

        else:
            md = self.block_cache.get(sh_name)
            if md is None:
                print('Creating mesh data %s' % sh_name)
                md = AWDTriGeom(sh_name)
                md.bind_matrix = AWDMatrix3x4(mtx)
                self.export_mesh_data(md, shape)
                self.awd.add_tri_geom(md)
                self.block_cache.add(sh_name, md)
 
            inst = AWDMeshInst(md, tf_name, self.mtx_list2awd(mtx))
 
            self.set_attributes(transform, inst)

            # Look for materials
            if self.include_materials:
                self.export_materials(transform, inst)
 
            self.block_cache.add(transform, inst)
            if awd_ctr is not None:
                awd_ctr.add_child(inst)
            else:
                self.awd.add_scene_block(inst)
 
            if self.include_skeletons:
                history = mc.listHistory(transform)
                clusters = mc.ls(history, type='skinCluster')
                if len(clusters) > 0:
                    #TODO: Deal with multiple clusters?
                    sc = clusters[0]
 
                    influences = mc.skinCluster(sc, q=True, inf=True)
                    if len(influences) > 0:
                        skel_path = self.get_skeleton_root(influences[0])
 
                        if self.block_cache.get(skel_path) is None:
                            self.export_skeleton(skel_path)
开发者ID:Alwnikrotikz,项目名称:awd,代码行数:59,代码来源:MayaAWDExporter.py


示例20: deformShapeSel

 def deformShapeSel(self, value):
     RN = mc.referenceQuery(self.core.allPropPath[int(value)-1], referenceNode=1)
     Nodes = mc.referenceQuery(RN, nodes=1)
     self.propdeformShape = []
     for item in Nodes:
         if mc.nodeType(item) in self.shapeType:
             self.propdeformShape.append(item)
     return self.propdeformShape
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:8,代码来源:核心脚本.py



注:本文中的maya.cmds.referenceQuery函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.refresh函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.rebuildCurve函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap