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

Python cmds.nodeType函数代码示例

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

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



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

示例1: nameChangedCB

    def nameChangedCB(self, node, prevName, client):
        ''' Callback when a node is renamed '''

        if prevName == "" or not prevName or prevName.startswith("_"):
            return
        handle = MObjectHandle( node )
        if not handle.isValid():
            return
        mobject = handle.object()

        nodeFn = MFnDependencyNode ( mobject )
        if nodeFn.hasUniqueName():
            nodeName = nodeFn.name()
            if cmds.getClassification(cmds.nodeType(nodeName), satisfies="shader"):

                if cmds.nodeType(nodeName) == "displacementShader":
                    items = self.displacementList.findItems(prevName, QtCore.Qt.MatchExactly)
                    for item in items:
                        item.setText(nodeName)

                    # renaming shaders in caches
                    for cache in self.ABCViewerNode.values():
                        cache.renameDisplacement(prevName, nodeName)
                    self.checkShaders()
                else:
                    items = self.shadersList.findItems(prevName, QtCore.Qt.MatchExactly)
                    for item in items:
                        item.setText(nodeName)

            if cmds.nodeType(nodeName) == "shadingEngine":
                    # renaming shaders in caches
                    for cache in self.ABCViewerNode.values():
                        cache.renameShader(prevName, nodeName)

                    self.checkShaders()
开发者ID:skarone,项目名称:PipeL,代码行数:35,代码来源:shaderManager.py


示例2: get_scene_texture_connections

def get_scene_texture_connections():
	conns =[]
	
	for mat in cmds.ls(mat=True):
		if cmds.nodeType(mat) == 'lambert':
			dif_conn = cmds.listConnections('%s.color' % mat)
			nrm_conn = cmds.listConnections('%s.normalCamera' % mat)
			if dif_conn:
				conns.append(dif_conn[0])
			if nrm_conn:
				for itm in cmds.listConnections(nrm_conn):
					if cmds.nodeType(itm) == 'file':
						conns.append(itm)
						break
				
		if cmds.nodeType(mat) == 'blinn' or cmds.nodeType(mat) == 'phong':
			dif_conn = cmds.listConnections('%s.color' % mat)
			nrm_conn = cmds.listConnections('%s.normalCamera' % mat)
			spc_conn = cmds.listConnections('%s.specularColor' % mat)
			if dif_conn:
				conns.append(dif_conn[0])
				
			if nrm_conn:
				#conns.append(nrm_conn[0])
				for itm in cmds.listConnections(nrm_conn):
					if cmds.nodeType(itm) == 'file':
						conns.append(itm)
						break
						
			if spc_conn:
				conns.append(spc_conn[0])
	return conns	
开发者ID:adityavs,项目名称:worldforge_pipeline,代码行数:32,代码来源:wf_pipeline.py


示例3: copy_user_attr

def copy_user_attr(selparentshapes, seltargetshapes, copyUV=True):
    listattrvalue = {}
    listdatatype = {}
    userattr = cmds.listAttr(selparentshapes, ud=True)
    if copyUV and cmds.nodeType(seltargetshapes) == 'mesh' and cmds.nodeType(selparentshapes) == 'mesh':
            cmds.transferAttributes(selparentshapes, seltargetshapes, transferUVs=1, transferColors=2, searchMethod=3, sampleSpace=5, flipUVs=False)
    if userattr:
        for attr in userattr:
            nodetype = cmds.nodeType(selparentshapes)
            checkrendershape = cmds.getAttr(selparentshapes + '.intermediateObject')
            if checkrendershape != 1 or nodetype != 'mesh':
                key = attr
                value = cmds.getAttr("%s.%s" % (selparentshapes, key))
                data = cmds.getAttr("%s.%s" % (selparentshapes, key), typ=True)
                listattrvalue[key] = value
                listdatatype[key] = data
    checkrendershape = cmds.getAttr(seltargetshapes + '.intermediateObject')
    if checkrendershape != 1:
        for key in listattrvalue:
            if not cmds.attributeQuery(key, node=seltargetshapes, ex=True):
                if listdatatype[key] == 'string':
                    cmds.addAttr(seltargetshapes, longName=key, dataType=listdatatype[key])
                    cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key], type=listdatatype[key])
                else:
                    cmds.addAttr(seltargetshapes, longName=key)
                    cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key])
            else:
                cmds.warning('Attribute ' + key + ' already on ' + seltargetshapes)
                if cmds.getAttr("%s.%s" % (seltargetshapes, key), se=True):
                    if listdatatype[key] == 'string':
                        cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key], type=listdatatype[key])
                    else:
                        cmds.setAttr("%s.%s" % (seltargetshapes, key), listattrvalue[key])
开发者ID:k0k0c,项目名称:scripts,代码行数:33,代码来源:mayaLgtTmp.py


示例4: ucGetBasePoints

def ucGetBasePoints():
    
    sels = cmds.ls( sl=1 )
    
    model.fnMeshList = []
    model.fnCrvList = []
    model.meshPoints = []
    model.crvPoints = []
    
    for target in sels:
        targetShapes = cmds.listRelatives( target, s=1 )
        
        for shape in targetShapes:
            if cmds.nodeType( shape ) == 'mesh':
                fnMesh = om.MFnMesh( functions.getMObject( shape ) )
                points = om.MPointArray()
                fnMesh.getPoints( points )
                model.fnMeshList.append( fnMesh )
                model.meshPoints.append( points )
            
            elif cmds.nodeType( shape ) == 'nurbsCurve':
                fnCurve = om.MFnNurbsCurve( functions.getMObject( shape ) )
                points = om.MPointArray()
                fnCurve.getCVs( points )
                model.fnCrvList.append( fnCurve )
                model.crvPoints.append( points )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:cmdModel.py


示例5: __check_scene

 def __check_scene(self):
     #--- this method checks the scene
     #--- check if something is selected
     sel = cmds.ls(selection = True)
     if sel:
         #--- check if selection is a mesh
         transform = None
         for i in sel:
             if cmds.nodeType(i) == 'transform':
                 transform = i
         if cmds.listRelatives(transform, allDescendents = True, type = 'mesh'):
             mesh = cmds.listRelatives(transform,
                                       allDescendents = True,
                                       type = 'mesh')[0]
             if cmds.nodeType(mesh) == 'mesh':
                 #--- store the mesh
                 self.mesh = transform
                 #--- get current frame
                 self.currentFrame = cmds.currentTime(query = True)
                 #--- get timestamp
                 ts = str(time.time())
                 self.time_stamp = str(ts.split('.')[0] + ts.split('.')[1])
             else:
                 raise Exception('The selected object is not a mesh!')
         else:
             raise Exception('The selected object is not a mesh!')
     else:
         raise Exception('You have to select a mesh, dude!')
开发者ID:jonntd,项目名称:Public,代码行数:28,代码来源:shotfinaling.py


示例6: linkFileToSpecular

def linkFileToSpecular(src, dst):
    cmds.shadingNode("remapHsv", n="%s_remapHsc" % dst, au=1)
    cmds.shadingNode("solidFractal", n="%s_solidFractal" % dst, at=1)
    cmds.shadingNode("place3dTexture", n="%s_place3dTexture" % dst, at=1)
    cmds.shadingNode("multiplyDivide", n="%s_multiplyDivide" % dst, au=1)
    cmds.shadingNode("ramp", n="%s_ramp" % dst, at=1)
    cmds.setAttr("%s.saturation[1].saturation_Position" % ("%s_remapHsc" % dst), 1)
    cmds.setAttr("%s.saturation[1].saturation_FloatValue" % ("%s_remapHsc" % dst), 0)
    cmds.setAttr("%s.value[0].value_FloatValue" % ("%s_remapHsc" % dst), 0)
    cmds.setAttr("%s.value[0].value_Position" % ("%s_remapHsc" % dst), 0.025)
    cmds.setAttr("%s.value[1].value_FloatValue" % ("%s_remapHsc" % dst), 1)
    cmds.setAttr("%s.value[1].value_Position" % ("%s_remapHsc" % dst), 0.075)
    cmds.connectAttr(
        "%s.worldInverseMatrix[0]" % ("%s_place3dTexture" % dst), "%s.placementMatrix" % ("%s_solidFractal" % dst), f=1
    )
    cmds.connectAttr("%s.outColor" % src, "%s.color" % ("%s_remapHsc" % dst), f=1)
    cmds.connectAttr("%s.outColor" % ("%s_remapHsc" % dst), "%s.input1" % ("%s_multiplyDivide" % dst), f=1)
    cmds.connectAttr("%s.outColor" % ("%s_solidFractal" % dst), "%s.input2" % ("%s_multiplyDivide" % dst), f=1)
    cmds.connectAttr("%s.output" % ("%s_multiplyDivide" % dst), "%s.colorGain" % ("%s_ramp" % dst), f=1)
    if cmds.nodeType(dst) == "RedshiftArchitectural":
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.diffuse'%dst)
        cmds.connectAttr("%s.outColor" % ("%s_ramp" % dst), "%s.refl_color" % dst, f=1)
    elif cmds.nodeType(dst) == "aiStandard":
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.color'%dst)
        cmds.connectAttr("%s.outColor" % ("%s_ramp" % dst), "%s.KsColor" % dst, f=1)
        # cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.color'%dst, f = 1)
    else:
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.color'%dst)
        cmds.connectAttr("%s.outColor" % ("%s_ramp" % dst), "%s.reflectedColor" % dst, f=1)
        # cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.color'%dst, f = 1)
    linkTopRemapNodeToAll("%s_ramp" % dst)
开发者ID:chuckbruno,项目名称:remap,代码行数:31,代码来源:RemapAndIllumanceForSelectObjsInstance.py


示例7: linkFileToSpecular

def linkFileToSpecular(src, dst):
    cmds.shadingNode('remapHsv', n = '%s_remapHsc'%dst, au = 1)
    cmds.shadingNode('solidFractal', n = '%s_solidFractal'%dst, at = 1)
    cmds.shadingNode('place3dTexture', n = '%s_place3dTexture'%dst, at = 1)
    cmds.shadingNode('multiplyDivide', n = '%s_multiplyDivide'%dst, au = 1)
    cmds.shadingNode('ramp', n = '%s_ramp'%dst, at = 1)
    cmds.setAttr('%s.saturation[1].saturation_Position'%('%s_remapHsc'%dst), 1)
    cmds.setAttr('%s.saturation[1].saturation_FloatValue'%('%s_remapHsc'%dst), 0)
    cmds.setAttr('%s.value[0].value_FloatValue'%('%s_remapHsc'%dst), 0)
    cmds.setAttr('%s.value[0].value_Position'%('%s_remapHsc'%dst), 0.025)
    cmds.setAttr('%s.value[1].value_FloatValue'%('%s_remapHsc'%dst), 1)
    cmds.setAttr('%s.value[1].value_Position'%('%s_remapHsc'%dst), 0.075)
    cmds.connectAttr('%s.worldInverseMatrix[0]'%('%s_place3dTexture'%dst), '%s.placementMatrix'%('%s_solidFractal'%dst), f = 1)
    cmds.connectAttr('%s.outColor'%src, '%s.color'%('%s_remapHsc'%dst), f = 1)
    cmds.connectAttr('%s.outColor'%('%s_remapHsc'%dst), '%s.input1'%('%s_multiplyDivide'%dst), f = 1)
    cmds.connectAttr('%s.outColor'%('%s_solidFractal'%dst), '%s.input2'%('%s_multiplyDivide'%dst), f = 1)
    cmds.connectAttr('%s.output'%('%s_multiplyDivide'%dst), '%s.colorGain'%('%s_ramp'%dst), f = 1)
    if cmds.nodeType(dst) == 'RedshiftArchitectural':
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.diffuse'%dst)
        cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.refl_color'%dst, f = 1)
    elif cmds.nodeType(dst) == 'aiStandard':
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.color'%dst)
        cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.KsColor'%dst, f = 1)
        # cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.color'%dst, f = 1)
    else:
        # cmds.disconnectAttr('%s.outColor'%(src), '%s.color'%dst)
        cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.reflectedColor'%dst, f = 1)
        # cmds.connectAttr('%s.outColor'%('%s_ramp'%dst), '%s.color'%dst, f = 1)
    linkTopRemapNodeToAll('%s_ramp'%dst)
    getRemapAndMutilplyNodes(dst)
开发者ID:chuckbruno,项目名称:remap,代码行数:30,代码来源:RemapAndIllumanceForAllShadings_modify.py


示例8: check_name_match

 def check_name_match(self, parents=None, targets=None, topology=None):
     target_events_list = {}
     for parent in parents:
         parent_name = parent.split('|')[-1].split(':')[-1]
         copy_event_parent = False
         target_match = []
         for target in targets:
             copy_event_target = False
             target_name = target.split('|')[-1].split(':')[-1]
             if parent_name == target_name:
                 if cmds.nodeType(parent) == cmds.nodeType(target) == 'mesh':
                     tp = [parent]
                     tt = [target]
                     topocheck = self.check_topology_match(parents=tp, targets=tt, globout=False)
                     if parent in topocheck and target in topocheck[parent]:
                         target_match.append(target)
                         self.found_matches[parent] = target_match
                         copy_event_target = True
                 else:
                     target_match.append(target)
                     self.found_matches[parent] = target_match
                     copy_event_target = True
             if not copy_event_target and target_events_list.get(target) != True:
                 target_events_list[target] = False
             if copy_event_target:
                 target_events_list[target] = True
                 copy_event_parent = True
         if not copy_event_parent:
             self.non_found_parent.append(parent)
     for target in target_events_list:
         if not target_events_list[target]:
             self.non_found_target.append(target)
     self.non_found_target = list(set(self.non_found_target))
     self.non_found_parent = list(set(self.non_found_parent))
     return self.found_matches, self.non_found_parent, self.non_found_target
开发者ID:k0k0c,项目名称:scripts,代码行数:35,代码来源:maya_func.py


示例9: on_actionLoadSourceControl_triggered

 def on_actionLoadSourceControl_triggered(self, clicked=None):
     if clicked == None:return
     selectOBJ = mc.ls(sl=True)
     
     if len(selectOBJ) == 0:return
     self.sourceControlFLD.setText(selectOBJ[0])
     
     KeyableAttr = mc.listAttr(selectOBJ[0], k=True)
     
     del self.sourceAtrLst[:]
     del self.targentAtrLst[:]
     # loop  Attributes..
     for Attr in KeyableAttr:
         SDKeys = mc.connectionInfo('%s.%s'%(selectOBJ[0], Attr), dfs=True)
         # loop driven Attributes..
         for key in SDKeys:
             if mc.nodeType(key) == 'unitConversion':
                 keyNode = mc.connectionInfo('%s.output'%key.split('.')[0], dfs=True)[0].split('.')[0]
             
             elif mc.nodeType(key) not in ('animCurve','animCurveTA', 'animCurveTL', 'animCurveTT','animCurveTU','animCurveUA','animCurveUL','animCurveUT','animCurveUU'):
                 continue
             else:
                 keyNode = key.split('.')[0]
             DriverValues     =  mc.keyframe(keyNode, q=True, fc=True)
             DrivenValues     =  mc.keyframe(keyNode, q=True, vc=True)
             DriverAttribute =  mc.connectionInfo('%s.output'%keyNode, dfs=True)[0]
             
             # if more than one Drivers, from add  node get the attribute..
             if  DriverAttribute.endswith(']'):
                 DriverAttribute = mc.connectionInfo('%s.output'%(DriverAttribute.split('.')[0]), dfs=True)[0]
              
             self.sourceAtrLst.append(['%s.%s'%(selectOBJ[0], Attr), DriverAttribute, DriverValues, DrivenValues])
     
     self.on_actionInputSearchReplace_triggered()
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:34,代码来源:mirrorSDK.py


示例10: SundayRenderToolsChangeTextureResolution

def SundayRenderToolsChangeTextureResolution(object, level):
    sel = cmds.ls(selection = True)
    if object == 'selected':
        if len(sel) == 0:
            SundayDialogPy.SundayDialogConfirm('ERROR                       ', 'Nothing selected.', 'OK')
        else:
            cmds.hyperShade('', shaderNetworksSelectMaterialNodes = True)
            selShader = cmds.ls(selection = True)
            for curSelShader in selShader:
                notes = cmds.hyperShade(listUpstreamNodes = curSelShader)
                for note in notes:
                    if cmds.nodeType(note) == 'file' or cmds.nodeType(note) == 'psdFileTex':
                        cmds.select(note)
                        SundayRenderToolsChangeTextureResolutionSet(level, note)
                        continue
                
            
    elif object == 'global':
        notes = cmds.ls(type = 'file')
        for note in notes:
            cmds.select(note)
            SundayRenderToolsChangeTextureResolutionSet(level, note)
        
    
    
    try:
        cmds.select(sel)
    except:
        pass
开发者ID:elliottjames,项目名称:jeeves,代码行数:29,代码来源:SundayRenderToolsPy.py


示例11: stabilizer

def stabilizer ():
	global _camera_
	_point = cmds.ls (selection = True)
	
	if cmds.objExists ('stabilizator_expression') == False and len(_point) > 0:
		_camera_	= Camera()
		_point		= _point[0]

		if (cmds.nodeType (_point) == 'mesh' or cmds.nodeType (_point) == 'transform') and _camera_.transform != 'empty':
			_expression	=	r'''
$pos=`python "fmmu.get_normalized_screen_position(\"'''	+	_point	+	r'''\")"`;
setAttr "'''	+	_camera_.shape	+	r'''.horizontalFilmOffset" $pos[2];
setAttr "'''	+	_camera_.shape	+	r'''.verticalFilmOffset" $pos[3];'''

			print "=================================="
			print _expression
			cmds.expression		(name = 'stabilizator_expression', string = _expression)
			cmds.frameLayout	('adjustCam_frml', edit = True, visible = True)
			cmds.symbolButton	('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__deStabilize.xpm', annotation = 'deStabilizer')
			cmds.floatField		('field_overscan', edit = True, value = _camera_.overscan)

	else:
		if cmds.objExists ('stabilizator_expression') == True:
			cmds.delete ('stabilizator_expression')
		
		cmds.symbolButton	('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__stabilize.xpm', annotation = 'deStabilizer')
		cmds.frameLayout	('adjustCam_frml', edit = True, collapse = True, visible = False)
		
		try:
			_camera_.reset_camera()
		except:
			pass
开发者ID:danielforgacs,项目名称:code-dump,代码行数:32,代码来源:ford_matchMoveUtils_v0.5.3.py


示例12: latticeRemove

def latticeRemove():

    #undo enable
    cmds.undoInfo(openChunk=True)

    #getting nodes
    sel = cmds.ls(selection=True)
    if not sel:
        cmds.warning('No nodes selected!')
        return

    lat = sel[-1]
    objs = sel[0:-1]

    if cmds.nodeType(cmds.listRelatives(lat, shapes=True)[0]) != 'lattice':
        cmds.warning('Last selected is NOT a lattice!')
        return

    #removing from lattice
    for obj in objs:
        try:
            cmds.lattice(lat, e=True, remove=True, geometry=obj)

            #disconnecting shapes
            shapes = cmds.listRelatives(obj, shapes=True)
            for shp in shapes:
                source = cmds.listConnections(shp + '.inMesh', source=True)
                if cmds.nodeType(source) == 'ffd':
                    attr = cmds.listConnections(shp + '.inMesh', plugs=True)[0]
                    cmds.disconnectAttr(attr, shp + '.inMesh')
        except:
            pass

    cmds.undoInfo(closeChunk=True)
开发者ID:Bumpybox,项目名称:Tapp,代码行数:34,代码来源:lattice.py


示例13: setCharacterInput

def setCharacterInput(_HIK, _HIK_source, **kwargs):
    if not ( cmds.nodeType(_HIK) == 'HIKCharacterNode' and cmds.nodeType(_HIK_source) == 'HIKCharacterNode' ):
        print u'HIKCharacterNode를 입력하세요.'
        return

    # sourceHide
    _sourceHide = False
    if kwargs.get('sourceHide') or kwargs.get('sh'):
        _input = ''

        # 해당 키워드에 해당하는 키값을 받아오고
        if   kwargs.get('sourceHide'): 
            _input = kwargs.get('sourceHide')
        elif kwargs.get('sh'): 
            _input = kwargs.get('sh')

        # 맞으면.. 아래 실행
        _sourceHide = _input

    # 연결
    mel.eval( 'mayaHIKsetCharacterInput( "%s", "%s" );'%(_HIK, _HIK_source) )
    mel.eval( '$gHIKCurrentCharacter = "%s";'%_HIK)
    mel.eval( 'hikUpdateCurrentCharacterFromScene();')

    if _sourceHide:
        # 소스 루트 알아옴.
        _root = getRootParent(_HIK_source)
        cmds.setAttr(_root+'.v',0)
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:28,代码来源:Gun_Tools.py


示例14: deleteLocalControler

 def deleteLocalControler(self, target ):
     
     if not cmds.objExists( target ): return None
     
     transNode = cmds.listConnections( target, type='retargetTransNode' )
     orientNode = cmds.listConnections( target, type='retargetOrientNode' )
     
     if cmds.nodeType( target ) == 'editMatrixByCurve' :
         cmds.delete( target )
     else:
         targetP = fnc.getP( target )
         targetPShape = cmds.listRelatives( targetP, s=1 )[0]
         
         if cmds.nodeType( targetPShape ) == 'retargetLocator':
             cmds.delete( targetP )
         else:
             cmds.delete( target )
     
     if transNode:  
         length = fnc.getLastIndex( transNode[0]+'.localData' )+1
         for i in range( length ):
             if not cmds.listConnections( transNode[0]+'.localData[%d].localMatrix' % i ):
                 mel.eval( 'removeMultiInstance %s[%d]' %( transNode[0]+'.localData', i ) )
     if orientNode :
         length = fnc.getLastIndex( orientNode[0]+'.localData' )+1
         for i in range( length ):
             if not cmds.listConnections( orientNode[0]+'.localData[%d].localMatrix' % i ):
                 mel.eval( 'removeMultiInstance %s[%d]' %( orientNode[0]+'.localData', i ) )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:editTransform.py


示例15: positionReorderDoIt

def positionReorderDoIt(*args):
	meshes = []
	sourceMeshText = cmds.textField( 'sourceMeshTextField', query=True, text=True )

	if sourceMeshText == '':
		cmds.error('source mesh textfield is empty')

	if cmds.objExists(sourceMeshText) == False:
		cmds.error('the source mesh ( '+sourceMeshText+' ) does not exist')

	if cmds.nodeType(sourceMeshText) != 'mesh':
		shapes = cmds.listRelatives( sourceMeshText, shapes=True )

		if shapes is None or len(shapes) < 1 or cmds.nodeType(shapes[0]) != 'mesh':
			cmds.error('source ( '+sourceMeshText+' ) is not a mesh')

	meshes.append( sourceMeshText )

	destinationMeshText = cmds.textField( 'destinationMeshTextField', query=True, text=True )
	
	if destinationMeshText == '':
		cmds.error('destination mesh textfield is empty')

	if cmds.objExists(destinationMeshText) == False:
		cmds.error('the destination mesh ( '+destinationMeshText+' ) does not exist')

	if cmds.nodeType(destinationMeshText) != 'mesh':
		shapes = cmds.listRelatives( destinationMeshText, shapes=True )

		if shapes is None or len(shapes) < 1 or cmds.nodeType(shapes[0]) != 'mesh':
			cmds.error('destination ( '+destinationMeshText+' ) is not a mesh')

	meshes.append( destinationMeshText )

	positionReorder( meshes=meshes )
开发者ID:Ryanagogo,项目名称:reorderVertexIDs,代码行数:35,代码来源:reorderVertexIDs.py


示例16: findLambert

def findLambert(each):
    """
    This will find a lambert to 4 levels deep of connects for a suuplied node. Usually a File node for us
    """
    getConns = findConnections(each)
    if getConns:##make sure it's a valid list of connections to look through
        for eachConn in getConns:
            #print 'Looking For Lambert: %s \tnodeType: %s' % (eachConn, cmds.nodeType(eachConn))
            if cmds.nodeType(eachConn) == 'lambert':
                return eachConn
            else:            
                getConn2 = findConnections(eachConn)
                if getConn2:##make sure it's a valid list of connections to look through
                    for eachConn2 in getConn2:
                        #print 'Looking For Lambert LvL2: %s \tnodeType: %s' % (eachConn2, cmds.nodeType(getConn2))
                        if cmds.nodeType(eachConn2) == 'lambert':
                            return eachConn2
                        else:
                            getConn3 = findConnections(eachConn2)
                            if getConn3:##make sure it's a valid list of connections to look through
                                for eachConn3 in getConn3:
                                    #print 'Looking For Lambert LvL3: %s \tnodeType: %s' % (eachConn3, cmds.nodeType(eachConn3))
                                    if cmds.nodeType(eachConn3) == 'lambert':
                                        return eachConn3
                                    else:
                                        getConn4 = findConnections(eachConn3)                                        
                                        if getConn4:##make sure it's a valid list of connections to look through
                                            for eachConn4 in getConn4:
                                                #print 'Looking For Lambert LvL4: %s \tnodeType: %s' % (eachConn4, cmds.nodeType(eachConn4))
                                                if cmds.nodeType(eachConn4) == 'lambert':
                                                    return eachConn4
                                                else:
                                                    pass
    else:
        return False
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:35,代码来源:sg_shd_lib.py


示例17: cacheFluidsToCTemp

def cacheFluidsToCTemp():
	if cmds.objExists(CONST.FOAM_FLUID_SHAPENODE) and cmds.objExists(CONST.WAKE_FLUID_SHAPENODE):
		## Get default non-cached wake and foam
		fluidsToCache = []
		for cache in [CONST.FOAM_FLUID_SHAPENODE, CONST.WAKE_FLUID_SHAPENODE]:
			fluidConnection = cmds.listConnections(cache, type = 'cacheFile') or cmds.listConnections(cache, type = 'cacheBlend')
			if fluidConnection:
				if cmds.nodeType(fluidConnection[0]) == 'cacheFile' or cmds.nodeType(fluidConnection[0]) == 'cacheBlend':
					cmds.confirmDialog(title = 'CACHE FLUIDS', message = 'Cache already exist for "%s". You should cleanup your caches if you want to re-cache a newer one!' % cache, button = 'OK')
				else:
					fluidsToCache.append(cache)
			else:
				fluidsToCache.append(cache)

		## Cache em fluids at one go to save time
		if fluidsToCache:
			cachePath = _getPathFromSceneName()
			if cachePath:
				if os.path.exists(cachePath):
					_cacheWake(cachepath = cachePath, fluids = fluidsToCache)

					## Set time to min
					[cmds.currentTime( cmds.playbackOptions(q = True, min = True) ) for x in range(2)]
	else:
		cmds.confirmDialog(title = 'CACHE FLUIDS', message = 'Both "%s" and "%s" fluids don\'t exist in your scene!' % (CONST.FOAM_FLUID_SHAPENODE, CONST.WAKE_FLUID_SHAPENODE), button = 'OK')
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:25,代码来源:fluidCaches.py


示例18: deleteExpression

def deleteExpression(con='', attr=''):
    '''
    #
    '''
    # find exp
    cnn = cmds.listConnections(con + '.' + attr, s=True, d=False)
    if cnn:
        if cmds.nodeType(cnn[0]) == 'unitConversion':
            cnn_uc = cmds.listConnections(cnn, s=True, d=False, type='expression')
            if cnn_uc:
                if cmds.nodeType(cnn_uc[0]) == 'expression':
                    exp = cnn_uc[0]
        elif cmds.nodeType(cnn[0]) == 'expression':
            exp = cnn[0]
        # delete exp
        if exp:
            st1 = cmds.expression(exp, q=True, s=True)
            st2 = 'frame'
            if st2 in st1:
                cmds.delete(exp)
                print 'deleted___  ', con, '  ___  ', exp
            else:
                print '    nope     '
        else:
            print 'no expression  ', attr
开发者ID:boochos,项目名称:work,代码行数:25,代码来源:delayExpression.py


示例19: getObjMaterials

def getObjMaterials():
    global remapAndLuminaceNodes
    index = 0
    shadingType = ["blinn", "phong", "RedshiftArchitectural", "aiStandard"]
    displacementShading = ["RedshiftDisplacement", "displacementShader"]
    duplicateMaterials = list()
    selObjsList = cmds.ls(sl=1, tr=1)
    if not selObjsList:
        assert "No object is selected!"
    for obj in selObjsList:
        duplicateNodes = list()
        cmds.select(obj, r=1)
        cmds.hyperShade(smn=1)
        selObjsDuplicateMaterials = cmds.duplicate(un=1)
        for item in selObjsDuplicateMaterials:
            dupliMater = cmds.rename(item, "%s_duplicate" % (item))
            duplicateNodes.append(dupliMater)
        remapAndLuminaceNodes.append(duplicateNodes[1])
        remapAndLuminaceNodes.append(duplicateNodes[2])
        remapAndLuminaceNodes.extend(duplicateNodes)
        for item in duplicateNodes:
            if cmds.nodeType(item) == "shadingEngine":
                duplicateShading = item
            if cmds.nodeType(item) in shadingType:
                duplicateMaterials.append(item)
            #     duplicateMaterials.append(item)
            #     remapAndLuminaceNodes.remove(item)
            # if cmds.nodeType(item) == displacementShading:
            #     if index >= 1: continue
            #     cmds.connectAttr('%s.displacement'%item, '%s.displacementShader'%duplicateShading, f = 1)
            #     index += 1
            # remapAndLuminaceNodes.remove(item)
        cmds.sets(obj, e=1, fe=duplicateShading)
    cmds.select(selObjsList, r=1)
    return list(set(duplicateMaterials))
开发者ID:chuckbruno,项目名称:remap,代码行数:35,代码来源:RemapAndIllumanceForSelectObjsInstance.py


示例20: and

def	splitJoint	():
	_newBoneNum	= cmds.intSlider	('boneNum',	query	= 1,	value	= 1)
	_bone		= cmds.ls	(selection	= 1,	long	= 1)
	_childJoint	= cmds.listRelatives	(children	= 1)

	if (len (_bone)	> 0) and (type(_childJoint) is not NoneType) \
	and (cmds.nodeType(_bone[0]) == 'joint') and (cmds.nodeType(_childJoint) == 'joint'):
		
		_childTranslateX	=	cmds.getAttr	(	_childJoint[0]	+	'.translateX'	)
		_childTranslateY	=	cmds.getAttr	(	_childJoint[0]	+	'.translateY'	)
		_childTranslateZ	=	cmds.getAttr	(	_childJoint[0]	+	'.translateZ'	)

		_newX				=	_childTranslateX	/	(	_newBoneNum	+	1.0	)
		_newY				=	_childTranslateY	/	(	_newBoneNum	+	1.0	)
		_newZ				=	_childTranslateZ	/	(	_newBoneNum	+	1.0	)

		for	_k	in	range	(	_newBoneNum):
			_bone	=	cmds.insertJoint	(	_bone	)
			cmds.toggle	(localAxis		=1)
			cmds.xform	(_bone	+	'.scalePivot',	_bone	+	'.rotatePivot',
						relative	=	1,	objectSpace	=	1,	translation	=	(	_newX,	_newY,	_newZ	)	)

		for	_k	in	range	(	_newBoneNum	):	cmds.pickWalk	(	direction	=	'up'	)
	
	else:	raiseWarning	(	'select a bone! You can do it!'	)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:25,代码来源:ford_riggingAid.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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