当前位置: 首页>>代码示例>>Python>>正文


Python core.nodeType函数代码示例

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


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


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