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

Python cmds.objExists函数代码示例

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

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



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

示例1: distributeAttrValue

def distributeAttrValue(targetList,targetAttr,rangeStart=0.0,rangeEnd=1.0,smoothStep=0.0):
	'''
	Distribute a range of attribute values across list of target objects
	@param targetList: List of target objects to distribute the attribute values across
	@type targetList: list
	@param targetAttr: The target attribute that the distributed values will be applied to
	@type targetAttr: str
	@param rangeStart: The distribution range minimum value
	@type rangeStart: float
	@param rangeEnd: The distribution range maximum value
	@type rangeEnd: float
	@param smoothStep: Amount of value smoothing to apply to the distribution
	@type smoothStep: float
	'''
	# Check target list
	for i in range(len(targetList)):
		if not mc.objExists(targetList[i]):
			raise UserInputError('Object "'+targetList[i]+'" does not exist!')
		if not mc.objExists(targetList[i]+'.'+targetAttr):
			raise UserInputError('Object "'+targetList[i]+'" has no ".'+targetAttr+'" attribute!')
	
	# Get value list
	vList = glTools.utils.mathUtils.distributeValue(len(targetList),1.0,rangeStart,rangeEnd)
	
	# Apply values to target list
	for i in range(len(targetList)):
		val = vList[i]
		if smoothStep: val = glTools.utils.mathUtils.smoothStep(val,rangeStart,rangeEnd,smoothStep)
		mc.setAttr(targetList[i]+'.'+targetAttr,val)
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:29,代码来源:attribute.py


示例2: _publish_gpu_for_item

    def _publish_gpu_for_item(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb):
        """
        Export a gpu cache for the specified item and publish it  to Shotgun.
        """
        group_name = item["name"].strip("|")
        debug(app = None, method = '_publish_gpu_for_item', message = 'group_name: %s' % group_name, verbose = False)
        tank_type = output["tank_type"]
        publish_template = output["publish_template"]        
                
        # get the current scene path and extract fields from it using the work template:
        scene_path = os.path.abspath(cmds.file(query=True, sn= True))
        fields = work_template.get_fields(scene_path)
        publish_version = fields["version"]

        # update fields with the group name:
        fields["grp_name"] = group_name

        ## create the publish path by applying the fields with the publish template:
        publish_path = publish_template.apply_fields(fields)
        #'@asset_root/publish/gpu/{name}[_{grp_name}].v{version}.abc'
        gpuFileName = os.path.splitext(publish_path)[0].split('\\')[-1] 
        fileDir = '/'.join(publish_path.split('\\')[0:-1])
        debug(app = None, method = '_publish_gpu_for_item', message = 'gpuFileName: %s' % gpuFileName, verbose = False)
        
        ## Now fix the shaders
        shd.fixDGForGPU()
        
        if cmds.objExists('CORE_ARCHIVES_hrc'):
            cmds.setAttr('CORE_ARCHIVES_hrc.visiblity', 0)
        
        if cmds.objExists('ROOT_ARCHIVES_DNT_hrc'):
            cmds.setAttr('ROOT_ARCHIVES_DNT_hrc.visiblity', 0)
                                       
        ## build and execute the gpu cache export command for this item:
        try:
            print '====================='
            print 'Exporting gpu now to %s\%s' % (fileDir, gpuFileName)
            #PUT THE FILE EXPORT COMMAND HERE
            cmds.select(clear = True)
            for geo in cmds.listRelatives(group_name, children = True):
                if 'geo_hrc' in geo:
                    geoGroup = str(group_name)
                    debug(app = None, method = '_publish_gpu_for_item', message = 'geoGroup: %s' % geoGroup, verbose = False)
                
            cmds.select(geoGroup)
            
            debug(app = None, method = '_publish_gpu_for_item', message = 'geoGroup: %s' % geoGroup, verbose = False)
            debug(app = None, method = '_publish_gpu_for_item', message = "gpuCache -startTime 1 -endTime 1 -optimize -optimizationThreshold 40000 -directory \"%s\" -fileName %s %s;" % (fileDir, gpuFileName, geoGroup), verbose = False)
            
            mel.eval("gpuCache -startTime 1 -endTime 1 -optimize -optimizationThreshold 40000 -directory \"%s\" -fileName %s %s;" % (fileDir, gpuFileName, geoGroup))

            print 'Finished gpu export...'
            print '====================='
            
            if cmds.objExists('dgSHD'):            
                ## Now reconnect the FileIn nodes
                for key, var in filesDict.items():
                    cmds.connectAttr('%s.outColor' % key, '%s.color' % var)
        except Exception, e:
            raise TankError("Failed to export gpu cache file")
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:60,代码来源:maya_asset_secondary_publish.py


示例3: unparent

def unparent(shape):
	'''
	Unparent shape nodes from a source parent
	@param shape: Shape or transform to unparent shapes from
	@type shape: str
	'''
	# Checks
	if not mc.objExists(shape):
		raise Exception('Object "'+shape+'" does not exist!!')
	
	# Get shapes
	if mc.ls(shape,type='transform'):
		transform = shape
		shapes = mc.listRelatives(shape,s=True,pa=True)
	else:
		transform = mc.listRelatives(shape,p=True,pa=True)[0]
		shapes = [shape]
	
	# Create shape holder
	shapeHolder = transform+'Shapes'
	if not mc.objExists(shapeHolder): shapeHolder = mc.createNode('transform',n=shapeHolder)
	targetXform = mc.xform(transform,q=True,ws=True,m=True)
	mc.xform(shapeHolder,ws=True,m=targetXform)
	
	# Unparent shapes
	for shape in shapes:
		mc.parent(shape,shapeHolder,s=True,r=True)
	
	# Return Result
	return shapeHolder
开发者ID:auqeyjf,项目名称:glTools,代码行数:30,代码来源:shape.py


示例4: doSyncInfo

    def doSyncInfo(self) : 
        asset = entityInfo.info()
        rigGrps = ['Rig_Grp', 'Rig:Rig_Grp']
        assetID = self.getAssetID()
        attrs = ['assetID', 'assetType', 'assetSubType', 'assetName', 'project']
        values = [assetID, asset.type(), asset.subType(), asset.name(), asset.project()]
        geoGrps = ['Geo_Grp', 'Rig:Geo_Grp']
        refPath = asset.getPath('ref')

        pipelineTools.assignGeoInfo()

        for rigGrp in rigGrps : 
            if mc.objExists(rigGrp) : 

                i = 0 
                for each in attrs : 
                    attr = '%s.%s' % (rigGrp, each)

                    if mc.objExists(attr) : 
                        if not each == 'assetID' : 
                            mc.setAttr(attr, values[i], type = 'string')

                        else : 
                            mc.setAttr(attr, values[i])

                    i += 1 

        for geoGrp in geoGrps : 
            if mc.objExists(geoGrp) : 
                mc.setAttr('%s.%s' % (geoGrp, 'id'), assetID)
                mc.setAttr('%s.%s' % (geoGrp, 'ref'), refPath, type = 'string')

        self.setStatus('Sync info', True)
        self.messageBox('Information', 'Sync Complete')
开发者ID:myCodeTD,项目名称:shade_tool,代码行数:34,代码来源:shade_app.py


示例5: matchUsing

def matchUsing(transform, reference, target):
    """
    Match the specified transform to a target transform, relative to a reference transform
    @param transform: Transform to set
    @type transform: str
    @param reference: Reference transform
    @type reference: str
    @param target: Target transform to match to
    @type target: str
    """
    # Checks
    if not cmds.objExists(transform):
        raise Exception('Transform "' + transform + '" does not exist!')
    if not cmds.objExists(reference):
        raise Exception('Reference transform "' + target + '" does not exist!')
    if not cmds.objExists(target):
        raise Exception('Target transform "' + target + '" does not exist!')

    # Get Transform, Target and Reference Matrices
    trMat = getMatrix(transform)
    rfMat = getMatrix(reference)
    tgMat = getMatrix(target)

    # Calculate Transform Target
    resultMat = trMat * rfMat.inverse() * tgMat

    # Set Transform Matrix
    setFromMatrix(transform, resultMat)
开发者ID:bennymuller,项目名称:glTools,代码行数:28,代码来源:transform.py


示例6: processItems

    def processItems(self, sender = None, all = False, case = ''):
        cmds.undoInfo(openChunk = True)
        cmds.select(clear = True)
        if not all:
            for eachItem in self._getSelItems():
                itemName = eachItem.text().replace(SEP, "|")
                if not cmds.objExists(itemName):
                    itemName = itemName.split("|")[-1] or None

                if itemName:
                    if case == 'select':
                        cmds.select(itemName, add = True, ne = True)
                    elif case == 'delete':
                        cmds.delete(itemName)
                    elif case == 'deleteCH':
                        cmds.delete(itemName, ch = True)
        else:
            count = self.reportTree.count()
            items = []
            for x in range(count):
                if "-----" not in self.reportTree.item(x).text():
                    itemName = self.reportTree.item(x).text().replace(SEP, "|")
                    if not cmds.objExists(itemName):
                        itemName = itemName.split("|")[-1] or None
                    if itemName:
                        items.extend([itemName])

            if case == 'select':
                cmds.select(items, r = True, ne = True)
            elif case == 'delete':
                cmds.delete(items)
            elif case == 'deleteCH':
                cmds.delete(items, ch = True)

        cmds.undoInfo(closeChunk = True)
开发者ID:yes7rose,项目名称:jbd_sanityCheckUI,代码行数:35,代码来源:reportWindow.py


示例7: add

	def add(self,objectList):
		'''
		Adds the channel state attr to all specified objects
		@param objectList: List of objects to add flags to
		@type objectList: list
		'''
		# Add Channel State Attrs
		for obj in objectList:
			
			# Check obj
			if not mc.objExists(obj):
				raise Exception('Object "'+obj+'" does not exist!')
			if not glTools.utils.transform.isTransform(obj):
				raise Exception('Object "'+obj+'" is not a valid transform!')
			if mc.objExists(obj+'.channelState'):
				print ('Object "'+obj+'" already has a "channelState" attribute! Skipping...')
			
			# Add channelState attr
			#mc.addAttr(obj,ln='channelState',at='enum',en=':Keyable:NonKeyable:Locked:',m=1,dv=-1)
			mc.addAttr(obj,ln='channelState',at='enum',en=':Keyable:NonKeyable:Locked:',m=1)
			
			# Set channelState flag values
			for i in range(len(self.channel)):
				if mc.getAttr(obj+'.'+self.channel[i],l=1):
					# Set Locked State
					mc.setAttr(obj+'.channelState['+str(i)+']',2)
				elif not mc.getAttr(obj+'.'+self.channel[i],k=1):
					# Set NonKeyable State
					mc.setAttr(obj+'.channelState['+str(i)+']',1)
				else:
					# Set Keyable State
					mc.setAttr(obj+'.channelState['+str(i)+']',0)
				# Alias Attribute
				mc.aliasAttr(self.channel[i]+'_state',obj+'.channelState['+str(i)+']')
开发者ID:auqeyjf,项目名称:glTools,代码行数:34,代码来源:channelState.py


示例8: doAnimRig

	def doAnimRig(self) : 
		path = str(self.ui.path_lineEdit.text())
		texturePath = '%s/textures' % path 
		animRes = str(self.ui.animRes_comboBox.currentText())

		facialCore.path = texturePath
		facialCore.animRes = animRes

		if mc.objExists(self.renderHeadName) : 
			previewHead = mc.duplicate(self.renderHeadName, n = self.previewHeadName)[0]

			# render node 
			ltNode = facialCore.makeAnimFacial(facialCore.renderLayerTextureName)

			# create lambert 
			if not mc.objExists(self.animNode) : 
				mtl = mc.shadingNode('lambert', asShader = True, n = self.animNode)

			# connect 
			mc.connectAttr('%s.outColor' % ltNode, '%s.color' % mtl, f = True)

			# assign 
			mc.select(previewHead)
			mc.hyperShade(assign = mtl)

			self.messageBox('Success', 'Set Anim Node Complete')
开发者ID:myCodeTD,项目名称:frozen_facial,代码行数:26,代码来源:app.py


示例9: on_actionStartMove_triggered

 def on_actionStartMove_triggered(self, args=None):
     if args==None:return
     toMoveOBJ = str(self.MovedOBJLineEdit.text())
     toKeepOBJ = str(self.KeepedOBJLineEdit.text())
     
     if not mc.objExists(toMoveOBJ) or not mc.objExists(toKeepOBJ):return
     if toMoveOBJ == toKeepOBJ:return
     
     
     self.ConstraintDT = {}
     self.ConstraintLocators = []
     
     
     for Jnt in (toKeepOBJ, toMoveOBJ):
         OldConstraintNode = [x for x in mc.listRelatives(Jnt, c=True, path=True) or [] if mc.nodeType(x).endswith('Constraint')]
         for OCSN in OldConstraintNode:
             ConstraintType = mc.nodeType(OCSN)
             ConstraintOBJ  = eval('mc.%s("%s", q=True, tl=True)'%(ConstraintType, OCSN))
             
             self.ConstraintDT.setdefault(Jnt, {})['type'] = ConstraintType
             self.ConstraintDT.setdefault(Jnt, {})['ConsOBJ'] = ConstraintOBJ
             mc.delete(OCSN)
         
         
         Loc = mc.spaceLocator(p=(0,0,0))
         mc.delete(mc.parentConstraint(Jnt, Loc))
         ConstraintNode = mc.parentConstraint(Loc[0], Jnt)
         
         self.ConstraintLocators.append(Loc[0])
         self.ConstraintLocators.append(ConstraintNode[0])
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:30,代码来源:ChangeOBJpivot.py


示例10: setDeformerAttrConnections

	def setDeformerAttrConnections(self):
		'''
		Set custom (non-standard) deformer attribute connections based on the stored deformer connection data.
		'''
		# ====================================
		# - Set Custom Attribute Connections -
		# ====================================
		
		for attr in self._data['attrConnectionDict'].iterkeys():
			
			# Define Deformer Attribute
			deformerAttr = self._data['name']+'.'+attr
			
			# Check connection destination
			if not mc.objExists(deformerAttr):
				print('Deformer attribute connection destination "'+deformerAttr+'" does not exist!('+self._data['name']+')')
				continue
			# Check connection destination settable state
			if not mc.getAttr(deformerAttr,se=True):
				print('Deformer attribute connection destination "'+deformerAttr+'" is not settable!('+self._data['name']+')')
				continue
			# Check connection source
			if not mc.objExists(self._data['attrConnectionDict'][attr]):
				print('Deformer attribute connection source "'+self._data['attrConnectionDict'][attr]+'" does not exist!('+self._data['name']+')')
				continue
			# Create Connection
			mc.connectAttr(self._data['attrConnectionDict'][attr],deformerAttr,f=True)
开发者ID:auqeyjf,项目名称:glTools,代码行数:27,代码来源:deformerData.py


示例11: doRenderRig

	def doRenderRig(self) : 
		path = str(self.ui.path_lineEdit.text())
		texturePath = '%s/textures' % path 
		renderRes = str(self.ui.renderRes_comboBox.currentText())

		facialCore.path = texturePath
		facialCore.res = renderRes

		if mc.objExists(self.defaultHeadName) : 
			# rename 
			mc.rename(self.defaultHeadName, self.renderHeadName)

			# group 
			group = mc.group(em = True, n = self.stillGroup)
			mc.parent(self.renderHeadName, group)

			# render node 
			ltNode = facialCore.makeRenderFacial()

			# create lambert 
			if not mc.objExists(self.renderNode) : 
				vrayMtl = mc.shadingNode('VRayMtl', asShader = True, n = self.renderNode)

			# connect 
			mc.connectAttr('%s.outColor' % ltNode, '%s.color' % vrayMtl, f = True)

			# assign 
			mc.select(self.renderHeadName)
			mc.hyperShade(assign = vrayMtl)

			self.messageBox('Success', 'Set Render Node Complete')

		else : 
			self.messageBox('Warning', '%s not Exists' % self.defaultHeadName)
开发者ID:myCodeTD,项目名称:frozen_facial,代码行数:34,代码来源:app.py


示例12: bsManUpdateTargetsFromUI

def bsManUpdateTargetsFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: raise Exception('No base (old) geometry specified!')
	oldBase = base[0]
	newBase = mc.textFieldButtonGrp('bsMan_updateTargetTFB',q=True,text=True)
	targetList = mc.textScrollList('bsMan_targetsTSL',q=True,si=True)
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if not mc.objExists(oldBase):
		raise Exception('Old base geometry "'+oldBase+'" does not exist!')
	if not mc.objExists(newBase):
		raise Exception('New base geometry "'+newBase+'" does not exist!')
	if not targetList: raise Exception('Empty target list!')
	
	# Get Target Geometry
	targetGeoList = []
	for target in targetList:
		targetGeo = glTools.utils.blendShape.getTargetGeo(blendShape[0],target,baseGeo=oldBase)
		if not targetGeo:
			print('No target geometry found for target name"'+target+'"! Skipping')
			continue
		targetGeoList.append(targetGeo)
	
	# Update Targets
	glTools.tools.blendShape.updateTargets(oldBase,newBase,targetGeoList)
开发者ID:auqeyjf,项目名称:glTools,代码行数:34,代码来源:blendShape.py


示例13: connectToTargetFromUI

def connectToTargetFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: base = ['']
	target = mc.textScrollList('bsMan_targetsTSL',q=True,si=True)
	if not target:
		print('No blendShape target selected!')
		return
	targetGeo = mc.textFieldButtonGrp('bsMan_connectTargetTFB',q=True,text=True)
	targetWt = mc.floatSliderGrp('bsMan_connectTargetFSG',q=True,v=True)
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if base[0] and not mc.objExists(base[0]):
		raise Exception('Base geometry "'+base[0]+'" does not exist!')
	if not mc.objExists(targetGeo):
		raise Exception('Target geometry "'+targetGeo+'" does not exist!')
	
	# Add BlendShape Target Inbetween
	glTools.utils.blendShape.connectToTarget(	blendShape=blendShape[0],
											targetGeo=targetGeo,
											targetName=targetName[0],
											baseGeo=base[0],
											weight=1.0	)
	
	# Reload
	reloadUI()
开发者ID:auqeyjf,项目名称:glTools,代码行数:34,代码来源:blendShape.py


示例14: addTargetFromUI

def addTargetFromUI():
	'''
	'''
	# Get UI Data
	blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True)
	if not blendShape:
		print('No blendShape node selected!')
		return
	base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True)
	if not base: base = ['']
	targetGeo = mc.textFieldButtonGrp('bsMan_addTargetGeoTFB',q=True,text=True)
	targetName = mc.textFieldGrp('bsMan_addTargetNameTFG',q=True,text=True)
	
	# Checks
	if not glTools.utils.blendShape.isBlendShape(blendShape[0]):
		raise Exception('BlendShape "'+blendShape[0]+'" does not exist!')
	if base[0] and not mc.objExists(base[0]):
		raise Exception('Base geometry "'+base[0]+'" does not exist!')
	if not mc.objExists(targetGeo):
		raise Exception('Target geometry "'+targetGeo+'" does not exist!')
	
	# Add BlendShape Target
	glTools.utils.blendShape.addTarget(	blendShape=blendShape[0],
										target=targetGeo,
										base=base[0],
										targetIndex=-1,
										targetAlias=targetName,
										targetWeight=0.0,
										topologyCheck=False	)
	
	# Reload
	reloadUI()
开发者ID:auqeyjf,项目名称:glTools,代码行数:32,代码来源:blendShape.py


示例15: addOverrideTarget

def addOverrideTarget(geo, targetGeo, targetWeight=0):
    """
    Add override blendShape target to the specified geometry.
    @param geo: The geometry to add an override blendShape target to.
    @type geo: str
    @param targetGeo: The override target geometry to add to the blendShape deformer.
    @type targetGeo: str
    @param targetWeight: The override target blend weight to apply.
    @type targetWeight: float
    """
    # Checks
    if not cmds.objExists(geo):
        raise Exception('Base geometry "' + geo + '" does not exist!!')
    if not cmds.objExists(targetGeo):
        raise Exception('Target geometry "' + targetGeo + '" does not exist!!')

    # Get Override BlendShape
    blendShape = geo.split(":")[-1] + "_override_blendShape"
    if not cmds.objExists(blendShape):
        blendShape = geo + "_override_blendShape"
    if not cmds.objExists(blendShape):
        raise Exception('Override blendShape "' + blendShape + '" does not exist!!')

    # Add Target
    targetAttr = glTools.utils.blendShape.addTarget(
        blendShape=blendShape, target=targetGeo, base=geo, targetWeight=targetWeight, topologyCheck=False
    )

    # Return Result
    return targetAttr
开发者ID:bennymuller,项目名称:glTools,代码行数:30,代码来源:blendShape.py


示例16: set

	def set(self,state,objectList=[]):
		'''
		Set channel states based on channelState multi attribute
		@param state: The state to set object channels to
		@type state: int
		@param objList: List of objects to set channels states for
		@type objList: list
		'''
		# Check objectList
		if type(objectList) == str: objectList = [objectList]
		if not objectList: objectList = mc.ls('*.channelState',o=True)
		
		# For each object in list
		for obj in objectList:
			
			# Get channel state values
			channelState = self.get(obj)
			if not len(channelState): continue
			if len(channelState) != 10: raise UserInputError('Attribute "'+obj+'.channelState" is not the expected length (10)!')
			
			if state:
				for i in range(len(self.channel)):
					if not channelState[i]: mc.setAttr(obj+'.'+self.channel[i],l=0,k=1)
					elif channelState[i] == 1: mc.setAttr(obj+'.'+self.channel[i],l=0,k=0)
					elif channelState[i] == 2: mc.setAttr(obj+'.'+self.channel[i],l=1,k=0)
				# radius
				if mc.objExists(obj+'.radius'): mc.setAttr(obj+'.radius',l=0,k=0)
			else:
				for attr in self.channel:
					mc.setAttr(obj+'.'+attr,l=0,k=1)
				if mc.objExists(obj+'.radius'): mc.setAttr(obj+'.radius',l=0,k=1)
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:31,代码来源:channelState.py


示例17: __add_root_attributes

 def __add_root_attributes(self):
     #--- globalScale
     if not cmds.objExists(self.root + ".globalScale"):
         cmds.addAttr(self.root, longName="globalScale",
                      min=0, defaultValue=1, attributeType='float')
         cmds.setAttr(self.root + '.globalScale',
                      edit=True, keyable=False, channelBox=True)
     #--- project
     if not cmds.objExists(self.root + ".project"):
         cmds.addAttr(self.root, longName="project", dataType='string')
         cmds.setAttr(self.root + '.project', self.assetInfo[0],
                      type='string', lock=True)
     #--- assetType
     if not cmds.objExists(self.root + ".assetType"):
         cmds.addAttr(self.root, longName="assetType", dataType='string')
         cmds.setAttr(self.root + '.assetType', self.assetInfo[1],
                      type='string', lock=True)
     #--- assetResolution
     if not cmds.objExists(self.root + ".assetResolution"):
         cmds.addAttr(self.root, longName="assetResolution", dataType='string')
         cmds.setAttr(self.root + '.assetResolution', self.assetInfo[2],
                      type='string', lock=True)
     #--- assetName
     if not cmds.objExists(self.root + ".assetName"):
         cmds.addAttr(self.root, longName="assetName", dataType='string')
         cmds.setAttr(self.root + '.assetName', self.assetInfo[3],
                      type='string', lock=True)
开发者ID:jonntd,项目名称:Public,代码行数:27,代码来源:guides.py


示例18: assignShader

    def assignShader(self):
        if not cmds.objExists(str(self.shaderToAssign)):
            if self.shaderToAssign.endswith("SG") and cmds.objExists(str(self.shaderToAssign)[:-2]):
                
                self.shaderToAssign = self.interface.createSG(str(self.shaderToAssign)[:-2])
            else:
                return
        
        if not cmds.nodeType(self.shaderToAssign) == "shadingEngine":
            self.shaderToAssign = self.interface.createSG(str(self.shaderToAssign))

        path = self.getPath()

        self.cache.assignShader(path, self.shaderToAssign)


        selectedItems = self.interface.hierarchyWidget.selectedItems()
        if len(selectedItems) > 1:
            for item in selectedItems:
                if item is not self:
                    item.cache.assignShader(item.getPath(), self.shaderToAssign)


        self.interface.checkShaders(self.interface.getLayer(), item=self)
        self.interface.hierarchyWidget.resizeColumnToContents(1)
开发者ID:skarone,项目名称:PipeL,代码行数:25,代码来源:treeitem.py


示例19: __setup_final_meshes

    def __setup_final_meshes(self):
        #--- this method setups the final meshes
        if 'FINAL' in self.mesh:
            if cmds.objExists(self.mesh):
                self.final_mesh = self.mesh
            else:
                self.final_mesh = cmds.duplicate(self.mesh)
                cmds.parent(self.final_mesh, self.sf_final_meshes)
                final_name = cmds.rename(self.final_mesh,
                                         self.mesh)
                self.final_mesh = final_name
        else:
            if cmds.objExists(self.mesh + 'FINAL'):
                self.final_mesh = self.mesh + 'FINAL'
            else:
                self.final_mesh = cmds.duplicate(self.mesh)
                cmds.parent(self.final_mesh, self.sf_final_meshes)
                final_name = cmds.rename(self.final_mesh,
                                         self.mesh + 'FINAL')
                self.final_mesh = final_name

        if cmds.objExists(self.mesh + '_BSP'):
            #--- setup blendShape deformer
            self.final_bsp = self.mesh + '_BSP'
            cmds.setAttr(self.final_bsp + '.' + self.mesh, 1)
            cmds.setAttr(self.mesh + '.v', 0)
        else:
            if 'FINAL' in self.mesh:
                self.mesh = self.mesh.split('FINAL')[0]
            self.final_bsp = cmds.blendShape(self.mesh,
                                             self.final_mesh,
                                             name = self.mesh + '_BSP')[0]
            cmds.setAttr(self.final_bsp + '.' + self.mesh, 1)
            cmds.setAttr(self.mesh + '.v', 0)
开发者ID:jonntd,项目名称:Public,代码行数:34,代码来源:shotfinaling.py


示例20: test_createRig

    def test_createRig(self):
        scene = cwd + os.sep + "tests/scenes/test_createRig.ma"
        cmds.file(scene, o=True, f=True)

        self.rig.createRig(
            name="test", baseTransform="joint2", targetTransform="joint3", control="control", aim="y", up="z", wup="y"
        )

        self.assertTrue(cmds.objExists("test_multiAxisRigGrp"))
        self.assertTrue(cmds.objExists("test_multiAxisRigGrpParentConst"))
        self.assertTrue(cmds.objExists("test_multiAxisRigPlane"))
        self.assertTrue(cmds.objExists("test_multiAxisRigPlanePointConst"))
        self.assertTrue(cmds.objExists("test_multiAxisRigLoc"))
        self.assertTrue(cmds.objExists("test_multiAxisRigCPOS"))
        self.assertTrue(cmds.objExists("test_multiAxisRigLocGeoConst"))
        self.assertTrue(cmds.objExists("test_multiAxisRigLocPointConst"))
        self.assertTrue(cmds.objExists("control.test_u"))
        self.assertTrue(cmds.objExists("control.test_v"))

        self.assertEqual(cmds.getAttr("control.test_u"), 0.5)
        self.assertEqual(cmds.getAttr("control.test_v"), 0.5)
        cmds.rotate(0, 90, 0, "joint2", a=True)
        self.assertEqual(cmds.getAttr("control.test_u"), 0)
        cmds.rotate(0, 0, 90, "joint2", a=True)
        self.assertEqual(cmds.getAttr("control.test_v"), 0)
        cmds.rotate(0, -90, 0, "joint2", a=True)
        self.assertEqual(cmds.getAttr("control.test_u"), 1)
        cmds.rotate(0, 0, -90, "joint2", a=True)
        self.assertEqual(cmds.getAttr("control.test_v"), 1)
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:29,代码来源:test_MultiAxisRigSetup.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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