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

Python cmds.fileDialog函数代码示例

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

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



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

示例1: getExportFilePathUI

def getExportFilePathUI():
	mode  = cmds.radioButtonGrp( 'em_modeRadio',q=1, select=1)
	if mode ==1:
		filePath = cmds.fileDialog(mode=1, dm=('*.obj') )
	if mode ==2:
		filePath = cmds.fileDialog(mode=1, dm=('*.mdd') )
	if mode ==3:
		filePath = cmds.fileDialog(mode=1, dm=('*.geo') )		
	filePath = pathToWindows(filePath)
	cmds.textFieldButtonGrp('em_fileName',e=1, text=filePath)
	return filePath
开发者ID:horitin,项目名称:pipeline,代码行数:11,代码来源:fx_mdd_obj_exporter.py


示例2: saveToLocal

def saveToLocal(showWarning=True):
	
	episod, shot = getEpiAndShotFromUI()
	if not shot:	return
	
	if showWarning:
		warnMsg = 'SceneName from window doesnt match with opened scene\'s name.\nSceneName will be taken from window by default.\nDo you want to continue?'
		if not filenamesMatch(episod, shot):
			rslt = mc.confirmDialog(t='Warning', m=warnMsg, b=['Continue', 'Cancel'], db='Continue', cb='Cancel', ds='Cancel')
			if rslt == 'Cancel':
				return
	
	expr = '^%s_%s%ssh%s_%s_.*[.]ma' % (util.projShort, util.epOrSeq, episod, shot, util.deptDic['short'])
	dfltName = '%sv00.ma' % expr[1:-7]
	pathToSave = mc.fileDialog(m=1, dm='*.ma', dfn=dfltName)
	
	if pathToSave:
		filename = pathToSave.split('/')[-1]
		if re.search(expr, filename):	# Check if filename matches the required format
			util.correctFrames(episod, shot)
			
			#joj - March 9
			Utils.switchToProxy()
			
			mc.file(rn=pathToSave)
			mc.file(s=True, typ='mayaAscii')
			mc.confirmDialog(t='Success', m='Saved as:\n%s' % pathToSave, b='THANX')
		else:
			mc.confirmDialog(t='Error', m='SceneName format is incorrect', b='SORRY')
			saveToLocal(False)
开发者ID:sid2364,项目名称:Maya_Python,代码行数:30,代码来源:shotManager_Toonz_Old.py


示例3: saveBtnCmd

 def saveBtnCmd(self, *args):
     """Called when the Save Light Setup button is pressed, saves data to file"""
     print("Save Menu Btn has been clicked")
     cmds.select("Three_Point_Lights")
     rootNodes = self.getSelection()
     if rootNodes is None:
         try:
             rootNodes = self.getSelection()
         except:
             return
      #defaults to home directory for the moment
     filePath = ''
     # Maya 2011 and newer use fileDialog2
     try:
         filePath = cmds.fileDialog2(
             ff=self.fileFilter, fileMode=0
         )
     # BUG: Maya 2008 and older may, on some versions of OS X, return the
     # path with no separator between the directory and file names:
     # e.g., /users/adam/Desktopuntitled.pse
     except:
         filePath = cmds.fileDialog(
             dm='*.%s' % kLightFileExtension, mode=1
         )
         # early out of the dialog was canceled
     if filePath is None or len(filePath) < 1: return
     if isinstance(filePath, list): filePath = filePath[0]
     exportSetup(filePath, cmds.ls(sl=True, type='transform'))
开发者ID:NicolasBar,项目名称:maya,代码行数:28,代码来源:3ptLightwin_2.0.py


示例4: _saveTab

    def _saveTab(self):
	'''
	The name of the tab 
	The frames included
	the attributes for each frame
	'''
	
	# Prompt where to save the file.

	# pack data
	

    	currTab = cmds.tabLayout( self.mainTab, q=True, selectTab=True)
    	tabIndex = cmds.tabLayout( self.mainTab, q=True, selectTabIndex=True) - 1 # tab index are 1 based.
	tabLabels = cmds.tabLayout( self.mainTab, q=True, tl=True )
	
	tabName = tabLabels[tabIndex]
	frameNames = []	
	frames = {}

	
	for frameInfo in self.tabs[self.tabNames[tabIndex]]:
		frameNames.append([frameInfo.frameName, frameInfo.mainLayout])
		frames[frameInfo.mainLayout] = frameInfo.attrs
	
	path = cmds.fileDialog(mode=1)
	if(path):
		fileInfo = open( path, "w" )
		pickle.dump( tabName, fileInfo  )
		pickle.dump( frameNames, fileInfo )
		pickle.dump( frames, fileInfo )
		fileInfo.close()
	else:
		print("Save Cancelled.")
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:34,代码来源:attr.py


示例5: writeSelAttrFile

def writeSelAttrFile():
    """
	Writes the selected attributes from the textScrollList to a file.
	"""
    # Let the user choose where the files is being saved to.
    # Starting point will be the maya folder.
    mayaFolder = cmds.internalVar(userAppDir=True)
    # File Dialog
    # sba will be the file extension.
    filePath = cmds.fileDialog(mode=1, directoryMask=mayaFolder + "*.sba")

    print("Choosen file: " + filePath)

    # Gather the attributes from the textScrollList
    selectedTSL = cmds.textScrollList("sbaKeyTSL", q=True, si=True)

    # Open File
    attrFile = open(filePath, "w")  # Will overwrite the file if it allready exists!

    # Loop through one element at a time writing it to a file.
    for item in selectedTSL:
        attrFile.write(item + "\n")

        # Close File
    attrFile.close()
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:25,代码来源:mclavan_fp_extra.py


示例6: readAttr

def readAttr():
    """
	Read attributes from a chosen file.
	"""

    # Get information from file
    # Starting at the maya folder and limiting to extension .sba
    mayaFolder = cmds.internalVar(userAppDir=True)
    # File Dialog
    # sba will be the file extension.
    filePath = cmds.fileDialog(mode=0, directoryMask=mayaFolder + "*.sba")

    print("Choosen file: " + filePath)

    # Open File
    attrFile = open(filePath, "r")  # Will overwrite the file if it allready exists!

    attrs = attrFile.readlines()

    # Close File
    attrFile.close()

    # loop through file content adding to the textScrollList
    for attr in attrs:
        # Check to see if the attribute allready exists in the textScrollList
        attr = attr.rstrip()
        # all the current tsl items
        allItemsTSL = cmds.textScrollList("sbaKeyTSL", q=True, allItems=True)
        if allItemsTSL and (attr in allItemsTSL):
            print(attr + " all ready exists in the list.")
        else:
            cmds.textScrollList("sbaKeyTSL", edit=True, append=attr)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:32,代码来源:mclavan_fp_extra.py


示例7: importABCasVRMesh

def importABCasVRMesh():		
	pathPick = cmds.fileDialog()
	path = os.path.split(pathPick)[1]
	name = path.split(".")[0]

	# Export alembic as VRMesh   
	mel.eval('vrayCreateProxyExisting("%s", "geo/%s")' % (name, path))
开发者ID:Kif11,项目名称:curpigeon_tools,代码行数:7,代码来源:app.py


示例8: loadShapes

    def loadShapes(cls):
        path = cmds.fileDialog(mode=0, directoryMask="*.shapes")
        success = "Successfuly loaded shape {0} for {1}."
        err = "{0} does not exist, skipping."
        the_file = open(path, 'rb')
        shapesData = pickle.load(the_file)
        print shapesData

        for obj in shapesData.keys():

            if not cmds.objExists(obj):
                print err.format(obj)
                continue

            # parent does exist
            # delete shapes from obj

            cmds.delete(cmds.listRelatives(obj, s=True, type="nurbsCurve"))

            # initialize object as curve
            con = cls(name='L_' + obj)
            con.name = obj

            for shape in shapesData[obj].keys():
                pos = shapesData[obj][shape]['positions']
                dg = shapesData[obj][shape]['degree']
                knots = shapesData[obj][shape]['knots']
                color = shapesData[obj][shape]['color']
                period = shapesData[obj][shape]['period']

                p = True if period > 0 else False
                con.color = color
                curve = cmds.curve(degree=dg, point=pos, knot=knots, per=p)
                con.get_shape_from(curve, destroy=True, replace=False)
                print success.format(shape, obj)
开发者ID:jdynamite,项目名称:autorigger,代码行数:35,代码来源:control.py


示例9: _loadTab

    def _loadTab(self):
    	    
    	    print("Load Tab")
    	    
    	    path = cmds.fileDialog( mode=0)
    	    # load
    	    if( path ):
    	    	    # Reading fileInfo
		    fileInfo = open( path, "r" )
		    tabName = pickle.load( fileInfo )
		    frameNames = pickle.load( fileInfo )
		    frames = pickle.load( fileInfo )
		    fileInfo.close()
		        
		    # Create Tab with tabname
		    tab = self._addTab( tabName )
		    for frame in frameNames:
		    	# frame[0]  the name of the frame
		    	# frame[1] is the layoutName (this is done so the dictionary doesn't get overlap)
		   	# frameGrp = self._addFrame( frame[0] )
		   	
		   	newAttr = FrameGroup( tab , frame[0] )
		   	self.tabs[self.tabNames[-1]].append( newAttr )
		   	
			for attrItem in frames[frame[1]]:
		   		if( cmds.objExists(attrItem) ):
		   			newAttr.addAttr( attrItem )
		    '''
		    print(tabName)
		    print(frameNames)
		    print(frames)
		    '''
    	    else:
    	    	    print("Load Cancelled.")
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:34,代码来源:attr.py


示例10: importCurveShape

 def importCurveShape(self):
         filePath=mc.fileDialog(dm='*.cs',m=0)
         if filePath:
                 readFile = open(filePath,'r')
                 ShapeData = pickle.load(readFile)
                 readFile.close()
                 self.setCurveShape(ShapeData)
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:7,代码来源:rosa_EditCrvTool.py


示例11: loadImageDir

 def loadImageDir(self,*args):
     """ 
     opens dialog so user can browse to the overscan image.
     This will not be neccessary once standard paths for the Tools shelf 
     and icons/images are in place.
     """
     dir = cmds.fileDialog( directoryMask='*.png' )
     cmds.textFieldButtonGrp(self.imageField,edit=True,text=dir)
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:8,代码来源:BlastMaster_GUI.py


示例12: openSceneButtonFunction

def openSceneButtonFunction(*args):
	import os
	global sceneFileName
	global selectedFileName
	selectedFileName=cmds.fileDialog()
	cmds.launchImageEditor(vif=selectedFileName)
	sceneFileName=os.path.basename(selectedFileName)
	cmds.textField('sceneName', w=400, e=1, fi=sceneFileName)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:8,代码来源:SAL_GradingScript_Project_03_v3.py


示例13: fileSaveDialog

	def fileSaveDialog(self, *args):
		
		#!!! look into this
		
		saveFileName = self.base.strip()
		
		#self.downloadPath = tkFileDialog.asksaveasfile(mode='w', initialfile=str(saveFileName))
		self.downloadPath = cmds.fileDialog(mode=1, defaultFileName=str(saveFileName))
开发者ID:debug,项目名称:mayaAutoUpdateFramework,代码行数:8,代码来源:mayaToolAutoUpdateFramework.py


示例14: read_PFtrack_3dPoint

def read_PFtrack_3dPoint():
    basicFilter = '*.txt'
    filename =cmds.fileDialog(dm=basicFilter,title='Open_pftrack_3dPoints_file')#'D:/suvey_points_0110.txt'
    
    if not (filename==''):
        result=read_pf3dpoints_asciifile(filename)
        if len(result)>0:
            spread_PF3dPoints(result)
开发者ID:seungjunyong,项目名称:ZeroNineScripts,代码行数:8,代码来源:LOCUS_PftrackTools_for_maya.py


示例15: exportCurveShape

 def exportCurveShape(self):
         filePath=mc.fileDialog(dm='*.cs',m=1)
         if filePath:
                 if 'cs' != filePath.split('.')[-1]:
                         filePath += '.cs'
                 ShapeData = self.getCurveShape()
                 newFile = open(filePath,'w')
                 pickle.dump(ShapeData,newFile)
                 newFile.close()
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:9,代码来源:rosa_EditCrvTool.py


示例16: fileDialog

 def fileDialog(self,label="",callback=None):
     """ Draw a File input dialog
     @type  label: string
     @param label: the windows title       
     @type  callback: function
     @param callback: the callback function to call
     """         
     filename = cmds.fileDialog(t=label)
     callback(str(filename))
开发者ID:gj210,项目名称:upy,代码行数:9,代码来源:mayaUI.py


示例17: promptExport

def promptExport( pos, start, end, cols, tags ):
	'''
	File prompt is given
	'''
	results = cmds.fileDialog(  m=0, dm='*.xls' )
	if( results ):
		temp = baseballExport( results, pos, start, end, cols, tags )
		return temp
	else:
		print("Cancelled.")
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:10,代码来源:excel.py


示例18: cc_import

def cc_import(*arg):
	filepath=maya.fileDialog(m=0,t='Import')
	print filepath
	filenumbers=maya.intField(filenumberGUI,q=True,v=True)
	print filenumbers
	nameSpace=maya.textField(nameSpaceGUI,q=True,tx=True)
	print nameSpace
	if(filepath!=None):
		for i in range(filenumbers):
			maya.file(filepath,i=True,ns=nameSpace)
开发者ID:tenghaowang,项目名称:Ryan_Toys,代码行数:10,代码来源:Batch_ImportTool.py


示例19: import_anim

def import_anim():
    # メッセージ
    # cmds.inViewMessage( amg='<hl>「モーションをベイク」</hl>を押してください。', pos='midCenter', fade=True, fit=1,fst=4000,fts=20 )

    cmds.select("Root_M")
    cmds.select("foot_R_controller", add=True)
    cmds.select("foot_L_controller", add=True)
    cmds.select("Knee_R_Locator", add=True)
    cmds.select("Knee_L_Locator", add=True)

    fileName = cmds.fileDialog(dm="*.anim")
    cmds.file(fileName, ra=True, pr=True, typ="animImport", i=True)
开发者ID:akkey,项目名称:maya,代码行数:12,代码来源:LightSkeleton.py


示例20: shelfFromFile

def shelfFromFile():
    """
	Creates a shelf button to keyframe the attributes straight from a previously saved file.
	"""
    # Get information from file
    # Starting at the maya folder and limiting to extension .sba
    mayaFolder = cmds.internalVar(userAppDir=True)
    # File Dialog
    # sba will be the file extension.
    filePath = cmds.fileDialog(mode=0, directoryMask=mayaFolder + "*.sba")

    print("Choosen file: " + filePath)

    # Open File
    attrFile = open(filePath, "r")  # Will overwrite the file if it allready exists!

    attrs = attrFile.readlines()

    # Close File
    attrFile.close()

    attrToShelf = []
    # loop through file content adding to the attrToShelf variable.
    for attr in attrs:
        attrToShelf.append(attr.rstrip())

    print(attrToShelf)

    results = cmds.promptDialog(
        title="Creating a shelf button.",
        message="Enter Shelf Button Name:",
        button=["OK", "Cancel"],
        defaultButton="OK",
        cancelButton="Cancel",
        dismissString="Cancel",
    )

    fileName = cmds.promptDialog(query=True, text=True)

    # if( results ):

    # Get the current shelf
    currentShelf = mel.eval(
        "global string $gShelfTopLevel;\rstring $shelves = `tabLayout -q -selectTab $gShelfTopLevel`;"
    )

    # Calling my function to complies the attribute to be keyframed correctly.
    keyFrameLines = compileKeyframes(attrToShelf)

    print(keyFrameLines)
    # Create the shelfButton
    cmds.shelfButton(l=fileName, iol=fileName, c=keyFrameLines, image="setKey.xpm", parent=currentShelf)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:52,代码来源:mclavan_fp_extra.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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