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

Python core.fileDialog2函数代码示例

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

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



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

示例1: setWipFolder

	def setWipFolder(self):
		currentScene = pm.sceneName()
		if currentScene:
			projectPath,fileName = os.path.split(currentScene)
			wipFolder = ''
			try:
				wipFolder = pm.fileDialog2(dir=projectPath,ds=2,fm=3,okc='Select Folder')[0]
			except:
				pm.warning('No folder was selected')

			if wipFolder:
				self.wipFolderEdit.setText(wipFolder)
				self.wipFolderPath = wipFolder
				self.bdPopulateFiles()
		else:
			projectPath = pm.workspace.path
			charactersFolder = os.path.abspath(os.path.join(projectPath,'scenes','characters'))
			path = ''
			try:
				path = pm.fileDialog2(dir=charactersFolder,ds=2,fm=3,okc='Select Folder')[0]
			except:
				pm.warning('No folder was selected')
			if path:
				self.wipFolderEdit.setText(path)
				self.wipFolderPath = path
				self.bdPopulateFiles()
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:26,代码来源:animToolUI.py


示例2: _buttonAction

 def _buttonAction(self):
     #inputs the first object in the selection as the textfield text upon button press
     if not self.disabler.getSelect()-1:
         file = pm.fileDialog2( ds=2, fm=1, cap='Select a binary proxy', ff='*.mib', dir=( self.project_path+"/export/GEO/RENDERPROXY/"+self.user ) )
     else:
         file = pm.fileDialog2( ds=2, fm=3, cap='Select a binary proxy folder', dir=( self.project_path+"/export/GEO/RENDERPROXY/"+self.user ) )
     pm.textFieldButtonGrp( self.button, e=True, text=file[0] )
开发者ID:creuter23,项目名称:tools,代码行数:7,代码来源:aw_binaryProxy.py


示例3: exportAnim

	def exportAnim(self, *args):
		objs = pm.ls( sl=True )
		successState = True
		
		filePath = pm.fileDialog2( caption='Save Animation', startingDirectory=uad , fileFilter="Anim Files (*.anim)" )
		
		if not filePath:
			sys.stdout.write('Save animation cancelled.')
			return None
		
		
		animInfos = {} # dictionary containing dictionaries of every object's animations
		for obj in objs:
			
			if not ( self.hasUniqueName( obj ) ): # if object'n name is not unique, doesn't save animation for it
				successState = False
				pm.warning( "Object %s's name is not unique. skipped"%obj.name() )  
				continue
			
			nameSpace = self.getNameSpace( obj )
			if nameSpace:
				objName = obj.name().split(':')[1]
			else:
				objName = obj.name()
			
			# find all anim curves on the object
			curves = pm.findKeyframe( obj , curve=True )
			
			
			if not curves: # jump to next object if no anim curve found
				continue
				
			animInfo = {} # dictionary containing one object's animations
			
			for curve in curves: # for each curve, find where it's connected to, keys' times, values and tangents
				attr = pm.listConnections( '%s.output'%curve, plugs=True )[0]
				if nameSpace:
					attrName = attr.name().split(':')[1]
				else:
					attrName = attr.name()
				times = pm.keyframe( attr, q=True, timeChange=True )
				values = pm.keyframe( attr, q=True, valueChange=True )
				outWeights = pm.keyTangent( attr, q=True, outWeight=True )
				outAngles = pm.keyTangent( attr, q=True, outAngle=True )
				inWeights = pm.keyTangent( attr, q=True, inWeight=True )
				inAngles = pm.keyTangent( attr, q=True, inAngle=True )
				animInfo[ attrName ] = { 'times':times, 'values':values, 'outWeights':outWeights, 'outAngles':outAngles, 'inWeights':inWeights, 'inAngles':inAngles }
			
			animInfos[ objName ] = animInfo
		
		# write anim info to file
		filePath = filePath[0]
		logfile = open( filePath , 'w')
		logfile.write( str(animInfos) )
		logfile.close()
		
		if successState:
			sys.stdout.write( 'Animation was successfully exported.' )
		else:
			pm.warning( 'Some objects animtions were not saved due to multiple object with the same name, check script editor for more info.' )
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:60,代码来源:exportImportAnim.py


示例4: _exportGroup

    def _exportGroup( self, *args ):

        path = pm.fileDialog2( dialogStyle=2,
                               fileMode=0,
                               caption='Choose Group File',
                               okCaption='Export',
                               selectFileFilter='Group',
                               fileFilter='Group (*.group)'
                               )

        if path is None:
            return
        else:
            path = path[0]

        groupName = self.groupOM.getValueStr()
        group = self._poseGroups[ groupName ]

        f = open( path, 'w' )
        pp = pprint.PrettyPrinter( stream=f, indent=1 )
        #output = ( groupName, 'group', group )
        pp.pprint( group )
        f.close()

        print "Exported Group: '%s' to: %s" % ( groupName, path )
开发者ID:kinetifex,项目名称:maya-kinetifex,代码行数:25,代码来源:poses.py


示例5: _exportPose

    def _exportPose( self, *args ):

        path = pm.fileDialog2( dialogStyle=2,
                               fileMode=0,
                               caption='Choose Pose File',
                               okCaption='Export',
                               selectFileFilter='Pose',
                               fileFilter='Pose (*.pose)'
                               )

        if path is None:
            return
        else:
            path = path[0]

        group = self._poseGroups[ self.groupOM.getValueStr() ]

        #try:
        poseName = self.poseListTSL.getSelectItem()[0]

        f = open( path, 'w' )
        pp = pprint.PrettyPrinter( stream=f, indent=1 )
        #output = ( poseName, 'pose', group[poseName] )
        pp.pprint( group[poseName] )
        f.close()

        print "Exported Pose: '%s' to: %s" % ( group[poseName], path )
开发者ID:kinetifex,项目名称:maya-kinetifex,代码行数:27,代码来源:poses.py


示例6: __importBone__

 def __importBone__(self):
     """import from file data"""
     # check if we have an object to work with
     if self.objSwc != None:
         # opening file dialog to choose a file
         basicFilter = "*.swc"
         path = pmc.fileDialog2(fileFilter=basicFilter, dialogStyle=2, caption='Import Bones Influences', okCaption='Import', fileMode=1)
         if (path):
             # get all items from both array
             itemsL = self.boneUI['tslBoneL'].getAllItems()
             itemsR = self.boneUI['tslBoneR'].getAllItems()
             
             # open the file
             f = open(str(path[0]), 'r')
             
             for line in f:
                 if line.count('#') == 0:
                     if line != '\n':
                         tmp = line.split('=')
                         if itemsL.count(tmp[0]) > 0:
                             index = itemsL.index(tmp[0])
                             self.__renameBone__(tmp[1].replace('\n', ''), index+1)
                 
             # and then close the file
             f.close()
开发者ID:loichuss,项目名称:maya,代码行数:25,代码来源:skin_swcUI.py


示例7: __exportBone__

 def __exportBone__(self):
     """export into file current data"""
     # check if we have an object to work with
     if self.objSwc != None:
         # opening file dialog to choose a file
         basicFilter = "*.swc"
         path = pmc.fileDialog2(fileFilter=basicFilter, dialogStyle=2, caption='Export Bones Influences', okCaption='Export', fileMode=0)
         if (path):
             # get all items from both array
             itemsL = self.boneUI['tslBoneL'].getAllItems()
             itemsR = self.boneUI['tslBoneR'].getAllItems()
             
             # create and open the file
             f = open(str(path[0]), 'w')
             
             # writting in the file
             f.write('# SWC export for %s \n' % self.objSwc.name())
             for i in range(0, len(itemsL)):
                 f.write(str(itemsL[i]).replace('=', '_'))
                 f.write('=')
                 f.write(str(itemsR[i]).replace('=', '_'))
                 f.write('\n')
             
             # and then close the file
             f.close()
             vp.vPrint('Export Done, %s' % path[0], 2)
开发者ID:loichuss,项目名称:maya,代码行数:26,代码来源:skin_swcUI.py


示例8: Maya_createNode

    def Maya_createNode(self, nodeType, *args):
        
        if nodeType == 'aiStandard':
            # Ask for name
            name = self.User_inputDialog("Create aiStandard", "Enter a name for the node: ")
            
            # Create and assign shader
            aiStd = pc.shadingNode('aiStandard', asShader=True, name=name)
            aiStdSg = pc.sets(renderable=True, noSurfaceShader=True, empty=True, name=name + 'SG')
            aiStd.outColor >> aiStdSg.surfaceShader 
            
            self.UI_refreshShaders()
            
            return(str(aiStd))

        if nodeType == 'file':
            # Ask for name
            name = self.User_inputDialog("Create file", "Enter a name for the node: ")
            # Ask for location of the file
            location = pc.fileDialog2(fm=1, dialogStyle=2)
            myTex = pc.shadingNode('file', asTexture=True, name=name)  
            myTex.fileTextureName.set(location)
            
            return(str(myTex))
            
        if nodeType == 'ygColorCorrect':
            # Ask for name
            name = self.User_inputDialog("Create ygColorCorrect", "Enter a name for the node: ")
            ygC = pc.shadingNode('ygColorCorrect', asShader=True, name=name)
            
            return(str(ygC))
开发者ID:ma55acre,项目名称:MayaDev,代码行数:31,代码来源:arnold_lookdevassist.py


示例9: new_scene

    def new_scene(self):

        cmds.file(newFile=True, force=True)
        location = "{0}{1}{2}".format(os.path.dirname(os.path.realpath(__file__)), os.path.sep, self.cleanScene)
        self.set_project(location)
        cmds.file("cleanScene.ma", open=True)

        select_dir = pm.fileDialog2(fileMode=2, dialogStyle=3, startingDirectory=self.statusDir)

        if select_dir != None:
            print select_dir[0]
            sDir = str(select_dir[0])

            result = cmds.promptDialog(
                title='Asset Name',
                message='Enter Name:',
                button=['OK', 'Cancel'],
                defaultButton='OK',
                cancelButton='Cancel',
                dismissString='Cancel')

            if result == 'OK':
                assetName = cmds.promptDialog(query=True, text=True)
            print assetName

            # makes project folder
            projectFolder = os.path.join(sDir, assetName)
            if not os.path.exists(projectFolder):
                print "Creating {0}".format(projectFolder)
                os.makedirs(projectFolder)

            # makes scenes folder
            scenesFolder = os.path.join(projectFolder, SCENE_FOLDER)
            if not os.path.exists(scenesFolder):
                print "Creating {0}".format(scenesFolder)
                os.makedirs(scenesFolder)

                # makes turntable folder
            turntableFolder = os.path.join(projectFolder, TURNTABLE_FOLDER)
            if not os.path.exists(turntableFolder):
                print "Creating {0}".format(turntableFolder)
                os.makedirs(turntableFolder)

                # makes export folder
            exportFolder = os.path.join(projectFolder, EXPORT_FOLDER)
            if not os.path.exists(exportFolder):
                print "Creating {0}".format(exportFolder)
                os.makedirs(exportFolder)

            # makes sourceimages folder
            sourceimagesFolder = os.path.join(projectFolder, SOURCEIMAGES_FOLDER)
            if not os.path.exists(sourceimagesFolder):
                print "Creating {0}".format(sourceimagesFolder)
                os.makedirs(sourceimagesFolder)

            fileName = assetName + "_v001_" + get_author_initials() + ".ma"
            fileSavePath = os.path.join(scenesFolder, fileName)
            print fileSavePath
            cmds.file(rename=fileSavePath)
            cmds.file(save=True)
开发者ID:Phoenyx,项目名称:TruemaxScriptPackage,代码行数:60,代码来源:moduleScene.py


示例10: Export

def Export(data):
    multipleFilters = "JSON Files (*.json)"
    f = pm.fileDialog2(fileMode=0, fileFilter=multipleFilters)
    if f:
        f = open(f[0], 'w')
        json.dump(data, f)
        f.close()
开发者ID:Bumpybox,项目名称:Tapp,代码行数:7,代码来源:connections.py


示例11: loadDeformerWeights

def loadDeformerWeights(filename=None):
	'''
	Usage:
		loadDeformerWeights(filename='/jobs/mercedesFable_5402587/build/charTortoise/maya/export/WEIGHTS/tortoiseAFacial/extraWeights/deformerWeights/v03/deformerWeights.json')
		loadDeformerWeights()
	'''
	if not filename:
		try:
			filename = pm.fileDialog2(cap='Select a json file you stored', fm=1, okc='Load', ff='JSON (*.json)')[0]
		except:
			pm.error('file not found, whatever.')
	with open(filename, 'rb') as fp:
		data = json.load(fp)
		for key in data.keys():
			if pm.objExists(key):
				deformer = Deformer(pm.PyNode(key))
				print 'Loading weights for deformer:\t%s'%deformer
				for deformedShape in data[key].keys():
					if pm.objExists(deformedShape):
						print '\tLoading deformer weights on shape:\t%s'%deformedShape
						deformedTransform = pm.PyNode(deformedShape).getParent()
						#print data[key][deformedShape]
						deformer.setWeights(data[key][deformedShape], deformedTransform)
					else:
						pm.warning('Object %s does not exist to apply deformer weights to...skipping'%deformedShape)
			else:
				pm.warning('Deformer %s doesn\'t exist...skipping'%key)
开发者ID:creuter23,项目名称:tools,代码行数:27,代码来源:lib_deformer.py


示例12: storeDeformerWeights

def storeDeformerWeights(selection=True, type='rig_vertSnap'):
	'''
	Usage:
		storeDeformerWeights(selection=False)
		storeDeformerWeights(selection=True, type=['rig_vertSnap'])
		storeDeformerWeights(selection=False, type=['rig_vertSnap', 'wire'])
	'''
	
	deformers = pm.ls(type=type)
	if selection:
		if len(pm.ls(sl=True))==0:
			pm.error('select something numbnuts!')
		deformers = pm.ls(sl=True)[0].listHistory(type='rig_vertSnap')
	vsFile = {}
	for deformer in deformers:
		vs = Deformer(deformer)
		vs.initializeWeights()
		if len(vs.weightsList) > 0:
			vsFile[deformer.name()] = vs.weightsList
	try:
		filename = os.path.join( pm.fileDialog2(cap='Select a folder to store the weights', fm=3, okc='Select')[0], 'deformerWeights.json' )
	except:
		pm.error('Why did you cancel? :(')
	with open(filename, 'wb') as fp:
		print 'Storing weights in file:\n\t%s'%(filename)
		print '\t\tDeformers Stored:\n\t\t\t%s'%('\n\t\t\t'.join([deformer.name() for deformer in deformers]))
		json.dump(vsFile, fp, indent=4)
开发者ID:creuter23,项目名称:tools,代码行数:27,代码来源:lib_deformer.py


示例13: xmlFileBrowse

 def xmlFileBrowse(self, args=None):
     filename = pm.fileDialog2(fileMode=0, caption="Export Corona File Name")
     if len(filename) > 0:
         filename = filename[0]
         if not filename.endswith(".igs"):
             filename += ".igs"
         self.rendererTabUiDict['xml']['xmlFile'].setText(filename)
开发者ID:timmwagener,项目名称:OpenMaya,代码行数:7,代码来源:mtco_initialize.py


示例14: changeOutputDestination

 def changeOutputDestination(self, dest = None):
     '''updates the output location for muster renders'''
     #TODO: check access to proposed render location location
     if not dest:
         dest = pm.fileDialog2(fileMode = 3, dialogStyle = 1, startingDirectory = self.widgets['outputDir'].getFileName())
     if dest:
         self.widgets['outputDir'].setText(pm.Path(dest[0]))
开发者ID:jessedenton,项目名称:musterSubmit,代码行数:7,代码来源:musterUI.py


示例15: load_shelf_UI

 def load_shelf_UI(cls):
     """ Gives us a file dialog to pick a specific shelf to reload/create
     """
     prefs = cls.get_user_shelves_dir()
     shelf_path = pm.fileDialog2(ff='*.mel', ds=2, fm=4,dir=prefs)
     if shelf_path:
         cls.shelf_update(shelf_path[0])
开发者ID:AndresMWeber,项目名称:aw,代码行数:7,代码来源:aw_shelfReload.py


示例16: bdGetObjPath

	def bdGetObjPath(self):
		projectPath = pm.workspace.name

		self.path = pm.fileDialog2(dir=projectPath,ds=2,fm=3,okc='Select Folder')[0]
		if self.path:
			self.objPath.setText(self.path)
			self.bdPopulateFiles()
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:7,代码来源:bdImportObj.py


示例17: readStandin

def readStandin(*args):
    ff = "*.binarymesh"
    filename = pm.fileDialog2(fileMode=1, caption="Select binarymesh", fileFilter = ff)
    if len(filename) > 0:
        bm = BinaryMesh()
        bm.path = filename[0]
        bm.loadStandins()
开发者ID:dictoon,项目名称:appleseed-maya,代码行数:7,代码来源:appleseedmenu.py


示例18: press_vdb_path

 def press_vdb_path(param_name):
     basic_filter = "OpenVDB File(*.vdb)"
     project_dir = pm.workspace(query=True, directory=True)
     vdb_path = pm.fileDialog2(fileFilter=basic_filter, cap="Select OpenVDB File", okc="Load", fm=1, startingDirectory=project_dir)
     if vdb_path is not None and len(vdb_path) > 0:
         vdb_path = vdb_path[0]
         # inspect file and try to figure out the padding and such
         try:
             dirname, filename = os.path.split(vdb_path)
             if re.match(".*[\._][0-9]+[\._]vdb", filename):
                 m = re.findall("[0-9]+", filename)
                 frame_number = m[-1]
                 padding = len(frame_number)
                 cache_start = int(frame_number)
                 cache_end = int(frame_number)
                 frame_location = filename.rfind(frame_number)
                 check_file_re = re.compile((filename[:frame_location] + "[0-9]{%i}" % padding + filename[frame_location + padding:]).replace(".", "\\."))
                 for each in os.listdir(dirname):
                     if os.path.isfile(os.path.join(dirname, each)):
                         if check_file_re.match(each):
                             current_frame_number = int(each[frame_location : frame_location + padding])
                             cache_start = min(cache_start, current_frame_number)
                             cache_end = max(cache_end, current_frame_number)
                 frame_location = vdb_path.rfind(frame_number)
                 vdb_path = vdb_path[:frame_location] + "#" * padding + vdb_path[frame_location + padding:]
                 node_name = param_name.split(".")[0]
                 pm.setAttr("%s.cache_playback_start" % node_name, cache_start)
                 pm.setAttr("%s.cache_playback_end" % node_name, cache_end)
         except:
             print "[openvdb] Error while trying to figure out padding, and frame range!"
             import sys, traceback
             traceback.print_exc(file=sys.stdout)
         pm.textFieldButtonGrp("OpenVDBPathGrp", edit=True, text=vdb_path)
         pm.setAttr(param_name, vdb_path, type="string")
开发者ID:redpawfx,项目名称:openvdb-render,代码行数:34,代码来源:AEvdb_visualizerTemplate.py


示例19: exportSelectionAsABC

def exportSelectionAsABC():
    # check for AbcExport command
    if not 'AbcExport' in dir(pm):
        pm.error('AbcExport: command not found.')
        return
    # retrieve all selected node paths
    selection = pm.ls(sl=True, recursive=True, dagObjects=True)
    if not selection:
        return
    nodePathtoExport = []
    for n in selection:
        if n.type() != 'transform':
            nodePathtoExport.append(n.getParent().fullPath())
    # get out file path from user
    outfile = pm.fileDialog2(fileMode=0)
    if not outfile:
        return
    # ensure we use a '*.abc' file extension
    outfile = os.path.splitext(outfile[0])[0]+'.abc'
    # build the AbcExport command
    exportCmd = '-worldSpace -attr mvg_imageSourcePath -attr mvg_intrinsicParams -file %s -uvWrite'%outfile
    for p in nodePathtoExport:
        exportCmd += ' -root %s'%p
    exportCmd = '''
import pymel.core as pm
pm.AbcExport(j="%s")'''%exportCmd
    pm.evalDeferred(exportCmd)
开发者ID:jonntd,项目名称:mayaMVG,代码行数:27,代码来源:menu.py


示例20: fileBrowser

 def fileBrowser(self, *args):
     erg = pm.fileDialog2(dialogStyle=2, fileMode=2)
     print "Result", erg
     if len(erg) > 0:
         if len(erg[0]) > 0:
             exportPath = erg[0]
             pm.textFieldButtonGrp(self.pathUI, edit=True, text=exportPath)
开发者ID:MassW,项目名称:OpenMaya,代码行数:7,代码来源:appleseedMenu.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python core.floatFieldGrp函数代码示例发布时间:2022-05-25
下一篇:
Python core.error函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap