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

Python core.nodeType函数代码示例

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

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



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

示例1: FTV_getFluidElements

def FTV_getFluidElements( fluid ):
	'''this function consider the type of parameter fluid to not be exactly known but output anyway the fluid Transform and the fluid Shape'''

	if fluid is None:
		raise FTV_msCommandException('Please select a Fluid')

	fldTrs = None
	fldShp = None

	if pm.nodeType(fluid)== 'transform':
		childs = pm.listRelatives(fluid, s=True)
		if len(childs)>0 and pm.nodeType(childs[0]) == 'fluidShape' :
			fldTrs = fluid
			fldShp = childs[0]
		else :
			raise FTV_msCommandException('selection is invalid, you must select a fluid')
	elif pm.nodeType(fluid)== 'fluidShape':
		par = pm.listRelatives(fluid, p=True)
		if len(par)>0 and pm.nodeType(par[0]) == 'transform' :
			fldTrs = par[0]
			fldShp = fluid
		else :
			raise FTV_msCommandException('selection is invalid, you must select a fluid')
	else :
		raise FTV_msCommandException('selection is invalid, you must select a fluid')
	return (fldTrs,fldShp)
开发者ID:mathieuSauvage,项目名称:MayaFluidTextureViewer,代码行数:26,代码来源:fluidTextureViewer.py


示例2: createManipCtrlCenter

	def createManipCtrlCenter(self):
		
		pm.select(cl = True)
		
		#createTextCurves
		nurbsText = self.prefix + '_Ctrl'
		textCurvesReturnList = pm.textCurves(f = 'arial' , t = nurbsText, ch = True )
		
		textTopGrp = textCurvesReturnList[0]
		makeTextCurvesNode = textCurvesReturnList[1]
		
		pm.select(cl = True)
		
		#get future history of makeTextCurvesNode
		textHistoryList = pm.listHistory(makeTextCurvesNode, future = True, af = True)
		
		#get list of transforms and NurbsCurve nodes connected to makeTextCurvesNode
		textTransformList = []
		textNurbsCurveList = []
		for node in textHistoryList:
			if(pm.nodeType(node) == 'transform'): textTransformList.append(node)
			if(pm.nodeType(node) == 'nurbsCurve'): textNurbsCurveList.append(node)
			
		pm.select(cl = True)
		
		#delete makeTextCurvesNode
		pm.delete(makeTextCurvesNode)
		pm.select(cl = True)
		
		#iterate through transformList, move pivot to ws (0,0,0) and freeze all
		for transformNode in textTransformList:
			pm.xform(transformNode, ws = True, piv = (0,0,0))
			pm.makeIdentity(transformNode, a = True)
			
			
		#create manipCtrlGrp
		self.manip_CtrlCenter = pm.group(n = self.prefix + '_manip_ctrl_center')
		pm.select(cl = True)
		
		#iterate through nurbsCurve list and parent shapes under manip ctrlCenter
		for nurbsCurveShape in textNurbsCurveList:
			pm.parent(nurbsCurveShape, self.manip_CtrlCenter, r = True, s = True)
			
		pm.select(cl = True)
		
		#create manip_ctrlCenter grp and translate correctly
		self.manip_CtrlCenter_grp = pm.group(n = self.prefix + '_manip_ctrl_center_grp')
		pm.select(cl = True)
		pm.parent(self.manip_CtrlCenter, self.manip_CtrlCenter_grp)
		pm.select(cl = True)
		
		self.manip_CtrlCenter_grp.translate.set(self.jointPositionList[-1][0], self.jointPositionList[-1][1] + 2, self.jointPositionList[-1][2])
		
		
		#delete remaining text transform nodes
		pm.delete(textTopGrp)
		pm.select(cl = True)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:57,代码来源:rbDynamicChain.py


示例3: isObjType

def isObjType(*args):
    tmpList = [ o.getParent() for o in sel if not(pm.nodeType(o) == 'mesh' or pm.nodeType(o) == 'nurbsSurface') ]
    
    tmpStr = ''
    for s in tmpList:
        tmpStr = tmpStr + s + ','
            
    if( len(tmpList) > 0 ):
        pm.confirmDialog(t="Error", message= tmpStr + " are not mesh or nurbsSurface", icon='critical')
        return 0
    
    return 1
开发者ID:nadibeu,项目名称:arnoldDev,代码行数:12,代码来源:arnold_id_assign_v004b.py


示例4: export

def export():
    '''
    Export a nuke file out with all the selected object from maya. 
    Takes care of all exporting
    need: shape and transform
    because might need some attributes from them
    '''
    objList = []
    for node in pm.ls(sl=True):
        print '[%s]%s' % (pm.nodeType(node) , node)
        if pm.nodeType(node) == 'transform':
            obj = mObject(node)
            objList.append(obj)
    writeNukeFile(objList)
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:14,代码来源:__init___v03.py


示例5: findCameraInSelection

 def findCameraInSelection(self):
     selection = pm.ls(sl=True)
     assert len(selection)>0, "Nothing is selected. Select a camera"
     assert len(selection)<2, "Multiple objects selected. Select camera only"
     
     if pm.nodeType(selection[0])=='transform':
         camShapeLst = pm.listRelatives(selection[0], type='camera')
         assert len(camShapeLst)>0, "No camera selected"
         return (selection[0], camShapeLst[0])
     
     elif pm.nodeType(selection[0])=='camera':
         parentTransform = pm.listRelatives(selection[0], parent=True)
         return (parentTransform,selection[0])
     
     raise StandardError("No camera is selected")
开发者ID:Volodymyrk,项目名称:mayaCameraFrustum,代码行数:15,代码来源:cameraFrustumPlugin.py


示例6: check

    def check(self):
        """
        Initial checks to prevent from some problems.
        This is not a guarantee for the procedure to run smoothly,
        but a big hint that it will.
        """

        #selected_node
        selected_node = self.get_selected_node()

        #check selected node exists
        if not (selected_node):

            #log
            self.logger.debug('Selected node is None.')
            return False

        
        #check if node is transform
        if not (pm.nodeType(selected_node) == 'transform'):

            #log
            self.logger.debug('Selected node {0} is not of type transform'.format(selected_node.name()))
            return False


        #return
        return True
开发者ID:jonntd,项目名称:helga,代码行数:28,代码来源:create_manipulator_in_center.py


示例7: addMaterialinGraph

def addMaterialinGraph(*args):
    
    sel_shapes = pm.ls( sl=True, dag=True, type='shape' )
    
    global panel_hyperShd
    for shape in sel_shapes:
        if( not( pm.nodeType(shape) == 'mesh' or pm.nodeType(shape) == 'nurbsSurface' ) ):
            pm.confirmDialog( t="Error", message= " selected objects are not mesh or nurbsSurface", icon='critical' )
            
        shdGrp = shape.outputs(type='shadingEngine')
        for sg in shdGrp:
            shader = pm.ls( sg.inputs(), materials=1 )
            pm.select(shader)
            mel.eval( "hyperShadePanelGraphCommand( \"%s\", \"addSelected\" )"  % str(panel_hyperShd) )
            
            pm.select(shape.getParent())
开发者ID:kzchen,项目名称:Maya_TD_tools,代码行数:16,代码来源:graphMaterialToHyperShd_v01.py


示例8: create_ui

def create_ui(* args):
    '''
    # this creates the ui for the selected  light from the scrollField
    '''
    # dictionary for class
    # the script get the light type each type is a key
    # and based on that it will pick which class to instance
    
    light_classes = {'spotLight': lights.Light_spot,
            'directionalLight': lights.Light_directional,
              'ambientLight': lights.Light_ambient,
              'areaLight': lights.Light_area,
              'pointLight': lights.Light_point,
              'volumeLight': lights.Light_volume}
    
    selected = scroll_list.getSelectItem()
    global lights_dict
    global obj_ui_list
    # deleteting existing ui objects
    for obj in obj_ui_list:
        try:
            obj.delete()
            
        except:
            pass
    
    
    for sel in selected:
        pm.setParent(ui_row)
       # getting the node type
        obj_type = pm.nodeType('%s' % (lights_dict[u'%s' %(str(sel))]))
        # using the  ^^ dictionarry to instance the appropritate class
        light  = light_classes[obj_type](light= '%s' % (sel)).create()
        # appending that object to the global objects list
        obj_ui_list.append(light)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:35,代码来源:light_rig.py


示例9: create_preset

 def create_preset(self):
     '''
     # creates the file for the preset
     ******
     # file pattern
     # data = ['preset name', 'light type', 'description',
                         xform_attrs[], shape_attrs[]] 
     ******
     '''
     sel = pm.ls(selection= True)[0]
     sel_shape = sel.getShape()
     node_type = pm.nodeType(sel_shape)
     
     if 'Light' not in node_type:
         return
     
     data = []
     
     data.append('%s' % (self.field.getText()))
     
     data.append('%s' % (node_type))
     
     data.append('%s' % (self.scroll.getText()))
     
     sel_data = []
     
     sel_shape_data = []
     
     sel_attrs = pm.listAttr(sel)
     sel_shape_attrs = pm.listAttr(sel_shape)
     
     for attr in sel_attrs:
         try :
             value = pm.getAttr('%s.%s' % (sel, attr))
             temp_data = (attr , value)
             sel_data.append(temp_data)
         
         except:
             pass
         
     for attr in sel_shape_attrs:
         try:
             value = pm.getAttr('%s.%s' % (sel_shape, attr))
             temp_data = (attr , value)
             sel_shape_data.append(temp_data)
         
         except:
             pass
         
         
     data.append(sel_data)
     data.append(sel_shape_data)
     
     name ='%s.light'  % (self.field.getText())
     full_path = os.path.join(self.path, name)
     f = open(full_path, 'w')
     pickle_data = pickle.dump(data, f)
     f.close()
     
     preset_ui() # this will list will update the preset section
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:60,代码来源:light_rig.py


示例10: __init__

 def __init__(self, node, **kwargs):
     self.setup(kwargs)
     self.transform = node
     self.shape = self.transform.getShape()
     self.type = pm.nodeType(self.shape)
     
     self.setAttributes()
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:7,代码来源:__init___v03.py


示例11: printSelection

def printSelection(longNames=True):
    """Print the selection in an organized, numbered list"""
    selList = pm.selected()
    print '\n//{0} Nodes Selected'.format(len(selList))
    nameMethod = None
    if longNames:
        nameMethod = 'longName'
    else:
        nameMethod = 'name'
    
    maxLen = 0
    for obj in selList:
        if hasattr(obj, nameMethod):
            name = getattr(obj, nameMethod)()
        else:
            name = obj.name()
        if len(name) > maxLen:
            maxLen = len(name)
    
    for i in range(len(selList)):
        obj = selList[i]
        typ = pm.nodeType(obj)
        if hasattr(obj, nameMethod):
            name = getattr(obj, nameMethod)()
        else:
            name = obj.name()
        print '{index:03}. {name:<{maxLen}} - {type}'.format(index=i, name=name, type=typ, maxLen=maxLen)
开发者ID:bohdon,项目名称:boTools,代码行数:27,代码来源:utils.py


示例12: getAnimCurve

def getAnimCurve(node):
    '''
    If node or nodes parent is a transform node.
        returns a AnimCurve node.
    '''
    
    type = pm.nodeType(node)
    if type == 'transform':
        return getAnimCurveFromTransform(node)
    else:
        parent = node.getParent()
        if pm.nodeType(parent) == 'transform':
            return getAnimCurveFromTransform(parent)
        else:
            print node, 'is none of the requered nodeTypes...'
            return None
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:16,代码来源:__init___v01.py


示例13: FindDeformers

def FindDeformers ( shape=None , type=''):
	
	if shape==None:
		obj = pm.ls(sl=True)[0]
		shape = obj.getShape()
	
	if shape :
		# List Deformers
		history = pm.listHistory( shape, pruneDagObjects=True, interestLevel=2 ) 
		
		deformers = []
		
		for node in  history :
			nodeTypes = pm.nodeType( node, inherited=True )
		
			if 'geometryFilter' in nodeTypes:
				
				if type=='' and  nodeTypes[1] != 'tweak' :
					deformers.append(node)
			
				elif nodeTypes[1] == type and nodeTypes[1] != 'tweak':
					deformers.append(node)
		
		return deformers
	else:
		pm.warning('No shape found.')
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:26,代码来源:findDeformers.py


示例14: get_camera_details_list

def get_camera_details_list():
	"""Parse the scene for camera nodes and return list with information"""

	#log_progress
	log_progress = False

	#scene_cameras_list
	scene_cameras_list = pm.ls(ca = True)
	#empty
	if not(scene_cameras_list):
		print('No camera nodes in the scene.')
		return []

	#camera_details_list
	camera_details_list = []

	#iterate and add details
	for camera_node in scene_cameras_list:

		#camera_details_dict
		camera_details_dict = {}

		#camera_shape_name
		camera_details_dict['camera_shape_name'] = camera_node.name()
		#camera_transform_name
		camera_details_dict['camera_transform_name'] = camera_node.getParent().name()
		#camera_type
		camera_details_dict['camera_type'] = pm.nodeType(camera_node)

		
		#inclusive_matrix
		inclusive_matrix = get_inclusive_matrix(camera_node.name())
		#list_matrix
		list_matrix = mmatrix_to_list(inclusive_matrix)
		#add to dict
		camera_details_dict['matrix'] = list_matrix




		#iterate LIGHT_PARAMETERS_LIST and add values if existing
		CAMERA_PARAMETERS_LIST = VRAY_CAMERA_PARAMETERS_LIST + MAYA_CAMERA_PARAMETERS_LIST
		for attr in CAMERA_PARAMETERS_LIST:
			if(camera_node.hasAttr(attr)):
				#attr_value
				attr_value = pm.getAttr(camera_node.name() +'.' +attr)
				#append to dict
				camera_details_dict[attr] = attr_value

		

		#append dict to list
		camera_details_list.append(camera_details_dict)


	return camera_details_list
开发者ID:alexanderrichter,项目名称:helga,代码行数:56,代码来源:setExrMetadata.py


示例15: get_light_details_list

def get_light_details_list():
	"""Parse the scene for light nodes and return list with information"""

	#log_progress
	log_progress = False

	#scene_lights_list
	scene_lights_list = get_all_scene_lights()
	#empty
	if not(scene_lights_list):
		print('No light nodes in the scene.')
		return []

	#scene_light_details_list
	scene_light_details_list = []

	#iterate and add details
	for light_node in scene_lights_list:

		#light_details_dict
		light_details_dict = {}

		#light_shape_name
		light_details_dict['light_shape_name'] = light_node.name()
		#light_transform_name
		light_details_dict['light_transform_name'] = light_node.getParent().name()
		#light_type
		light_details_dict['light_type'] = pm.nodeType(light_node)

		
		#inclusive_matrix
		inclusive_matrix = get_inclusive_matrix(light_node.name())
		#list_matrix
		list_matrix = mmatrix_to_list(inclusive_matrix)
		#add to dict
		light_details_dict['matrix'] = list_matrix




		#iterate LIGHT_PARAMETERS_LIST and add values if existing
		LIGHT_PARAMETERS_LIST = VRAY_LIGHT_PARAMETERS_LIST + MAYA_LIGHT_PARAMETERS_LIST
		for attr in LIGHT_PARAMETERS_LIST:
			if(light_node.hasAttr(attr)):
				#attr_value
				attr_value = pm.getAttr(light_node.name() +'.' +attr)
				#append to dict
				light_details_dict[attr] = attr_value

		

		#append dict to list
		scene_light_details_list.append(light_details_dict)


	return scene_light_details_list
开发者ID:alexanderrichter,项目名称:helga,代码行数:56,代码来源:setExrMetadata.py


示例16: filterForTextures

 def filterForTextures(cls, textureList, *args, **kwargs):
   ''' filter a list for only file texture nodes '''
   newList = []
   if textureList:
     #
     for item in textureList:
       type = pm.nodeType(item)
       if type == 'file':
         newList.append(item)
   return newList
开发者ID:kotchin,项目名称:mayaSettings,代码行数:10,代码来源:lcTexture.py


示例17: getNodeType

def getNodeType(name):
    nodeType = pm.nodeType(name)
    lights = ["directionalLight",
                "pointLight",
                "spotLight",
                "areaLight"]

    if nodeType in lights:
        nodeType = 'light'

    return nodeType
开发者ID:Quazo,项目名称:breakingpoint,代码行数:11,代码来源:utils.py


示例18: startupCheck

	def startupCheck(self):
		'''Perform check to see if all requirements to run the script are fullfilled'''
		
		
		#Check namespaces attrs.
		if not(self.namespaceShader):
			if(self.verbose):print('Empty namespaces for shader. Please provide correct parameter.')
			return False
			
		#Check namespaces attrs.
		if not(self.namespaceChrystal):
			if(self.verbose):print('Empty namespaces for chrystal. Please provide correct parameter.')
			return False
		
		
		
		
		#check selection
		selectionList = pm.ls(sl = True, fl  = True)
		
		#check selectionList 
		if not(selectionList):
			if(self.verbose):print('Nothing selected.')
			return False
			
		#check selectionList == 1
		if not(len(selectionList) == 1):
			if(self.verbose):print('SelectionList has wrong length, please only select Chrystal_top_grp')
			return False
			
		
		#check shadernames in scene
		for shaderName in self.shaderNamesList:
			#if shdername in scene
			if not(self.namespaceShader +':' +shaderName in pm.ls(fl = True, mat = True)):
				if(self.verbose):print(self.namespaceShader +':' +shaderName +' not in scene')
				return False
				
		
		#check if chrystalTopGrp is type transform
		if not(pm.nodeType(selectionList[0]) == 'transform'):
			if(self.verbose):print('Selected chrystal top grp is not of type transform')
			return False
			
		#Check subGroupNames
		for chrystalSubgroupName in self.chrystalSubgroupNamesList:
			if not(chrystalSubgroupName in [x.name().split('|')[-1] for x in selectionList[0].getChildren()]):
				if(self.verbose):print(chrystalSubgroupName +' not in selectionList')
				return False
		
		
		#If successful return True
		return True
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:53,代码来源:rbAutoChrystalRenderImport.py


示例19: listWorldChildren

def listWorldChildren ():
    '''
    Return the transform node at the root of the hierarchy.
    
    Return :
    worldChildrenList = List
    '''
    worldChildrenList = list()
    for elem in pm.ls(assemblies=True) :
        if pm.nodeType(elem) == 'transform' :
            worldChildrenList.append(elem)
    return worldChildrenList
开发者ID:hongloull,项目名称:digital37,代码行数:12,代码来源:utils.py


示例20: getAnimCurveNodeList

	def getAnimCurveNodeList(self, object):
		
		pm.select(cl = True)
		
		#get all connections to object
		connectionsList = pm.listConnections(object)
		
		#Check if connectionsList is empty
		if not(connectionsList):
			if(self.verbose): print('Object hast no input coonections')
			return connectionsList
			
		#get animCurveList
		animCurveList = []
		
		#iterate through connectionList and append animcurve nodes
		for node in connectionsList:
			if(pm.nodeType(node) == 'animCurveTU' or pm.nodeType(node) == 'animCurveTL' or pm.nodeType(node) == 'animCurveTA'): animCurveList.append(node)
			
			
		return animCurveList
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:21,代码来源:rbTransferKeysRelativeToWorldSpace.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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