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

Python cmds.deleteAttr函数代码示例

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

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



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

示例1: delmesh

def delmesh(nodename):
    for attr in [nodename+"."+ext for ext in getnames()]:
        try:
            cmds.getAttr(attr)
            cmds.deleteAttr(attr)
        except:
            pass
开发者ID:highfestiva,项目名称:life,代码行数:7,代码来源:maya_export_script.py


示例2: assetCheckAndTag

def assetCheckAndTag(type = '', customTag = False):
    """
    Look for root level groups that have meshes as children and add a a type flag to it with the type as its value
    @param type: The type of asset, eg PROP, BLD, CHAR
    @type type: String
    @param customTag: If you want to use a custom tag that differs from the type name.
    @type customTag: String
    """

    for grp in cmds.ls(assemblies = True, long = True):
        if cmds.ls(grp, dag = True, type = "mesh"):
            if '|ROOT_ARCHIVES_DNT_%s' % configCONST.GROUP_SUFFIX not in grp and '|CORE_ARCHIVES_%s' % configCONST.GROUP_SUFFIX not in grp:
                if not grp.endswith('_%s' % configCONST.GROUP_SUFFIX):
                    return False
                if configCONST.INSIST_PREFIX_IN_ROOT:
                    if type not in grp:
                        raise TankError("ROOT NODE MISSING PREFIX \"%s" % type)
                        return -1
                if '_%s' % configCONST.GROUP_SUFFIX in grp:
                    if cmds.objExists('%s.type' % grp):
                        cmds.deleteAttr('%s.type' % grp)
                    try:
                        cmds.addAttr(grp, ln = 'type', dt = 'string')
                    except:
                        pass
                    if customTag:
                        cmds.setAttr('%s.type' % grp, customTag, type = 'string')
                    else:
                        cmds.setAttr('%s.type' % grp, type.lower(), type = 'string')
                else:
                    raise TankError("This does not appear to be a valid %s asset" % type)
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:31,代码来源:sg_asset_lib.py


示例3: assetCheckAndTag

def assetCheckAndTag(type = '', customTag = False):
	"""
	Look for root level groups that have meshes as children and add a a type flag to it with the type as its value
	@param type: The type of asset, eg PROP, BLD, CHAR
	@type type: String
	"""

	for grp in cmds.ls(assemblies=True, long= True):
		if cmds.ls(grp, dag=True, type="mesh"):
			if '|ROOT_ARCHIVES_DNT_hrc' not in grp and '|CORE_ARCHIVES_hrc' not in grp:
				debug(app = None, method = 'assetCheckAndTag', message = 'grp: %s' % grp, verbose = False)
				if not grp.endswith('_hrc'):
					return False
				if type not in grp:
					raise TankError("ROOT NODE MISSING PREFIX \"%s_\"\nPlease visit http://www.anim83d.com/bbb/dokuwiki/doku.php?id=bubblebathbay:pipeline:pipeline:modelling:namingconventions" % type)
				if '_hrc' in grp and type in grp:
					if cmds.objExists('%s.type' % grp):
						cmds.deleteAttr('%s.type' % grp)
					try:
						cmds.addAttr(grp, ln = 'type', dt = 'string')
					except:
						pass
					if customTag:
						cmds.setAttr('%s.type' % grp, customTag, type = 'string')
					else:
						cmds.setAttr('%s.type' % grp, type.lower(), type = 'string')
				else:
					 raise TankError("This does not appear to be a valid %s asset" % type)
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:28,代码来源:maya_asset_MASTERCLEANUPCODE.py


示例4: updateOrigNamesFormat

	def updateOrigNamesFormat(self,objectList=[]):
		'''
		Update a combined meshes origNames attribute to the newest format.
		@param objectList: list of mesh objects to update origNames attribute on.
		@type objectList: list
		'''
		# Confirm list
		if type(objectList) == str:
			objectList = [objectList]
		
		# Iterate through object list
		for obj in objectList:
			
			# Check origNames attribute
			if not mc.objExists(obj+'.origNames'):
				raise Exception('Object '+obj+' does not have a "origNames" attribute!')
			if mc.addAttr(obj+'.origNames',q=True,multi=True):
				print(obj+'.origNames is already in the correct format.')
				continue
			
			# Extract original names list from old format
			origNamesList = []
			index = 0
			while True:
				if mc.objExists(obj+'.origNames.origNames_'+str(index)):
					origNamesList.append(mc.getAttr(obj+'.origNames.origNames_'+str(index)))
					index+=1
				else: break
			
			# Re-create the origNames attribute in the new format
			mc.deleteAttr(obj+'.origNames')
			mc.addAttr(obj,ln='origNames',dt='string',multi=True)
			for i in range(len(origNamesList)):
				mc.setAttr( obj+'.origNames['+str(i)+']', origNamesList[i], type='string')
开发者ID:auqeyjf,项目名称:glTools,代码行数:34,代码来源:meshCombine.py


示例5: on_remove

	def on_remove( self, *a ):
		for item in cmd.ls( sl=True ):
			for attrName in listAttr( item, ud=True ):
				if attrName.startswith( '_skeletonPart' ) or attrName.startswith( '_skeletonFinalize' ):
					cmd.deleteAttr( '%s.%s' % (item, attrName) )

		self.populate()
开发者ID:BGCX261,项目名称:zootoolbox-git,代码行数:7,代码来源:skeletonBuilderUI.py


示例6: deleteColorAttr

 def deleteColorAttr(self, nodes):
     nodeList = nodes
     # add attribute to selected meshes
     for node in nodeList:
         for i in range(1,100):
             if mc.objExists(node + '.' + self.idColorAttr + str(i)):
                 mc.deleteAttr(node + '.' + self.idColorAttr + str(i))
开发者ID:jackieliao67,项目名称:mtoaSetManager,代码行数:7,代码来源:matteGroupManager.py


示例7: removeCloneAttributes

def removeCloneAttributes():
    
    import sgBModel_dag
    targetAttrs = cmds.ls( '*.'+sgBModel_dag.cloneTargetAttrName )
    
    for targetAttr in targetAttrs:
        cmds.deleteAttr( targetAttr )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:7,代码来源:sgBFunction_rigObject.py


示例8: delete

    def delete(self):
        '''
        Delete all dynamic nodes
        '''
        # check if mNode still exists
        if self.mNode:
            if cmds.objExists(self.mNode):
                # nodes not to delete
                startJoint = self.startJoint
                endJoint = self.endJoint
                joints = self.joints
                # to store nodes to keep
                nodes = []
                for node in [startJoint, endJoint, joints]:
                    nodes.extend(node)
                # get all the connections
                connections = self.listConnections()
                # delete all custom attributes - if any node connected to it is deleted the node is deleted
                # so delete attributes first, then delete nodes to avoid runtime errors
                attrs = cmds.listAttr(self.mNode, ud=True, u=True)
                 
                for attr in attrs:
                    cmds.deleteAttr(self.mNode + "." + attr)
 
                # now lets delete the nodes 
                for conn in connections:
                    if conn not in nodes:
                        # check if node exists to avoid errors
                        if cmds.objExists(conn):
                            cmds.delete(conn)
                 
                # finally delete the mNode
                cmds.delete(self.mNode)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:33,代码来源:lpDynamicChains.py


示例9: fixResolution

def fixResolution():
    log(app = None, method = 'fixResolution', message = 'Fixing Resolutions now...', printToLog = False, verbose = configCONST.DEBUGGING)
    allLambert = cmds.ls(type = 'lambert')
    
    for eachLambert in allLambert:
        log(app = None, method = 'fixResolution', message = 'Processing: %s now...' % eachLambert, printToLog = False, verbose = configCONST.DEBUGGING)
        if cmds.ls('%s.message' % eachLambert):
            
            matInfo = findMaterialInfo('%s.message' % eachLambert)
            log(app = None, method = 'fixResolution', message = 'matInfo: %s' % matInfo, printToLog = False, verbose = configCONST.DEBUGGING)
            
            if matInfo:
                texture = ''
                try:
                    texture = cmds.listConnections("%s.texture[0]" % matInfo)[0]
                except TypeError:
                    pass
                
                if texture:            
                    try:
                        resolution = cmds.listAttr(texture, string = 'resolution')
                    except ValueError:
                        pass
        
                    if resolution:
                        cmds.deleteAttr(texture, at = 'resolution')
                        disconnectTextureInfo(matInfo)
                        cmds.addAttr(texture, ln = "resolution", at = 'long', dv = 32)
                        cmds.connectAttr("%s.message" % texture, "%s.texture[0]" % matInfo)
                        cmds.setAttr("%s.resolution" % texture, 256)
                    else:
                        cmds.addAttr(texture, ln = "resolution", at = 'long', dv = 32)
                        cmds.setAttr("%s.resolution" % texture, 256)
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:33,代码来源:sg_shd_lib.py


示例10: _WriteExportedAttributesToNode

    def _WriteExportedAttributesToNode(nodeName, exportedAttrs):
        """
        Given a Maya node name, this method records the given list of
        ExportedAttribute objects in exportedAttrs in the Maya attribute. the
        passed in list replaces any previous data.

        NOTE: This method will likely only ever be called by the Remove and
        Update methods above since multiple nodes may be selected and only the
        common attributes between them will be displayed.
        """
        jsonDict = {}
        for exportedAttr in exportedAttrs:
            jsonDict.update(exportedAttr.GetJsonDict())

        exportAttrExists = cmds.attributeQuery(EXPORTED_ATTRS_MAYA_ATTR_NAME,
            node=nodeName, exists=True)

        if not jsonDict:
            if exportAttrExists:
                # The export attribute exists but we'd be emptying it, so just
                # remove the attribute instead.
                cmds.deleteAttr('%s.%s' % (nodeName, EXPORTED_ATTRS_MAYA_ATTR_NAME))
            return

        if not exportAttrExists:
            cmds.addAttr(nodeName, ln=EXPORTED_ATTRS_MAYA_ATTR_NAME, dt='string')

        jsonString = json.dumps(jsonDict)
        cmds.setAttr('%s.%s' % (nodeName, EXPORTED_ATTRS_MAYA_ATTR_NAME),
            jsonString, type='string')
开发者ID:400dama,项目名称:USD,代码行数:30,代码来源:userExportedAttributesUI.py


示例11: group

def group(joint,indexStr='A'):
	'''
	Create a joint buffer transform (joint).
	@param joint: Joint to create buffer group for
	@type joint: str
	@param indexStr: Name index string
	@type indexStr: str
	'''
	# Check joint
	if not mc.objExists(joint):
		raise Exception('Joint "'+joint+'" does not exist!')
	
	# Get name prefix
	prefix = glTools.utils.stringUtils.stripSuffix(joint)
	
	# Create joint group
	grp = mc.duplicate(joint,po=True,n=prefix+'Con'+indexStr+'_jnt')[0]
	mc.parent(joint,grp)
	
	# Delete user attrs
	udAttrList = mc.listAttr(grp,ud=True)
	if udAttrList:
		for attr in udAttrList: mc.deleteAttr(grp+'.'+attr)
	
	# Set display overrides
	mc.setAttr(joint+'.overrideEnabled',1)
	mc.setAttr(joint+'.overrideLevelOfDetail',0)
	mc.setAttr(grp+'.overrideEnabled',1)
	mc.setAttr(grp+'.overrideLevelOfDetail',0)
	
	# Return result
	return grp
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:32,代码来源:joint.py


示例12: deleteUserAttrs

def deleteUserAttrs(obj,attrList=[]):
	'''
	Delete user defined attrs from a specified object
	@param obj: The source objects to copy the attributes from 
	@type obj: str
	@param attrList: A list of attributes to delete. If empty, defaults to all. 
	@type attrList: list
	'''
	# Check object
	if not mc.objExists(obj):
		raise Exception('Object "'+obj+'" does not exist!!')
	
	# Get attribute list
	if not attrList: attrList = mc.listAttr(obj,ud=True)
	if not attrList: attrList = []
	
	# Delete attributes
	for attr in attrList:
		try:
			mc.setAttr(obj+'.'+attr,l=False)
			mc.deleteAttr(obj,at=attr)
		except:
			print('Problem removing attribute "'+obj+'.'+attr+'". Continuing onto next arttribute.')
	
	# Return result
	return attrList
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:26,代码来源:attribute.py


示例13: rsReAtt

def rsReAtt():
    l_oSels = rsObjList()
    l_AttributeList = (cmds.textScrollList("rsAttributeScroll", query=True, allItems=True))
    for s_Att in l_AttributeList:
        s_orig = l_oSels[0] + "." + s_Att
        i_LockState = cmds.getAttr(s_orig, lock=True)
        if i_LockState:
            cmds.setAttr(s_orig, lock=False)
        l_paramDest = cmds.listConnections(s_orig, plugs=True, destination=True, source=True)
        l_paramDestLock = []
        if l_paramDest:
            for z in range(len(l_paramDest)):
                l_paramDestLock.append(cmds.getAttr(l_paramDest[z], lock=True))
                if l_paramDestLock[z]:
                    cmds.setAttr(l_paramDest[z], lock=False)
        cmds.deleteAttr(l_oSels[0], at=s_Att)
        cmds.undo()
        if l_paramDest:
            for z in range(len(l_paramDest)):
                l_paramDestLock.append(cmds.getAttr(l_paramDest[z], lock=True))
                if l_paramDestLock[z]:
                    cmds.setAttr(l_paramDest[z], lock=True)
        if i_LockState:
            cmds.setAttr(s_orig, lock=True)
    cmds.select(cl=True)
    cmds.select(l_oSels[0], r=True)
    return True
开发者ID:RigStudio,项目名称:rsEditAttributes,代码行数:27,代码来源:rsEditAttributes.py


示例14: setAttr

	def setAttr(self,target,intersectList=[],evalOrderList=[]):
		'''
		Store the calculated evaluation order list as a string array attribute to a specified control.
		@param target: The maya node that will hold the evaluation order array attribute.
		@type target: str
		@param intersectList: Perform a list intersection between the calculated evaluation order with this list. If empty, no intersection is performed.
		@type intersectList: list
		@param evalOrderList: You can override the calculated evaluation order with a custom ordered list. If empty, use calculated evaluation order.
		@type evalOrderList: list
		'''
		# Check object exists
		if not mc.objExists(target):
			raise UserInputError('Target object '+target+' does not exist!')
		# Create attribute
		if mc.objExists(target+'.'+self.attribute):
			mc.deleteAttr(target,at=self.attribute)
		self.addAttribute(target)
		# Get calculated evaluation order list
		if not evalOrderList: evalOrderList = self.hierarchy.generationList()
		# Perform list intersection
		if intersectList: evalOrderList = [i for i in evalOrderList if intersectList.count(i)]
		# Set evaluation order array attribute
		for i in range(len(evalOrderList)):
			mc.setAttr(target+'.'+self.attribute+'['+str(i)+']',evalOrderList[i],type='string')
		# Return evaluation order list
		return evalOrderList
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:26,代码来源:evaluationOrder.py


示例15: removeBindMarker

def removeBindMarker(ctrls=None, *args):
    '''
    remove the bind markers from nodes, these dictate what gets baked
    '''
    if not ctrls:
        ctrls = cmds.ls(sl=True, l=True)
    for ctr in ctrls:
        cmds.deleteAttr('%s.%s' % (ctr, BAKE_MARKER))
开发者ID:markj3d,项目名称:Red9_StudioPack,代码行数:8,代码来源:AnimationBinder.py


示例16: deleteFollowWeightAttrs

 def deleteFollowWeightAttrs( tr ):
     udAttrs = cmds.listAttr( tr, k=1, ud=1 )
     
     if not udAttrs: return None
     
     for attr in udAttrs:
         if attr[-5:] == 'CTL_w':
             cmds.deleteAttr( tr+'.'+attr )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:8,代码来源:retargeting.py


示例17: _addVersionTag

def _addVersionTag(assetName, versionNumber):
    if cmds.objExists('%s.%sversion' % (assetName, configCONST.SURFACE_SHORTNAME)):
        cmds.deleteAttr('%s.%sversion' % (assetName, configCONST.SURFACE_SHORTNAME))
    try:
        cmds.addAttr(assetName, ln = '%sversion' % configCONST.SURFACE_SHORTNAME, at = 'long', min = 0, max  = 50000, dv = 0)
    except:
        pass
    cmds.setAttr('%s.%sversion' % (assetName, configCONST.SURFACE_SHORTNAME), int(versionNumber))
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:8,代码来源:sg_shd_lib.py


示例18: setCmd

	def setCmd( self, cmdStr ):
		cmdAttr = "zooTrigCmd0"
		if not objExists( "%s.%s" % ( self.obj, cmdAttr ) ): cmd.addAttr(self.obj, ln=cmdAttr, dt="string")
		if cmdStr is None or cmdStr == '':
			cmd.deleteAttr(self.obj, at=cmdAttr)
			return

		cmd.setAttr('%s.%s' % ( self.obj, cmdAttr ), cmdStr, type='string')
开发者ID:BGCX261,项目名称:zootoolbox-svn-to-git,代码行数:8,代码来源:triggered.py


示例19: _addVersionTag

	def _addVersionTag(self, assetName, versionNumber):
		if cmds.objExists('%s.version' % assetName):
			cmds.deleteAttr('%s.version' % assetName)
		try:
			cmds.addAttr(assetName, ln = 'version', at = 'long', min = 0, max  = 50000, dv = 0)
		except:
			pass
		cmds.setAttr('%s.version' % assetName, int(versionNumber))
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:8,代码来源:app.py


示例20: btnDel

def btnDel(opt): #deletes all sets and locators
	if opt=='all':
		for each in mc.ls():
			if mc.objExists(each+'.FuriosoFlag'): mc.deleteAttr(each+'.FuriosoFlag')
	if opt=='sel':
		for each in mc.ls(sl=1):
			if mc.objExists(each+'.FuriosoFlag'): mc.deleteAttr(each+'.FuriosoFlag')
	buildUILists()
开发者ID:RobRuckus,项目名称:rcTools,代码行数:8,代码来源:rcFurioso.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python cmds.deleteUI函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.delete函数代码示例发布时间: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