This command provides a dialog that allows users to select files or directories.
| Long name (short name) | Argument Types | Properties | |
|---|---|---|---|
| acceptMode (am) | int |
|
|
|
|||
| cancelCaption (cc) | unicode |
|
|
|
|||
| caption (cap) | unicode |
|
|
|
|||
| dialogStyle (ds) | int |
|
|
|
|||
| fileFilter (ff) | unicode |
|
|
|
|||
| fileMode (fm) | int |
|
|
Indicate what the dialog is to return. 0 Any file, whether it exists or not.1 A single existing file.2 The name of a directory. Both directories and files are displayed in the dialog.3 The name of a directory. Only directories are displayed in the dialog.4 Then names of one or more existing files. |
|||
| fileTypeChanged (ftc) | callable | ||
| okCaption (okc) | unicode |
|
|
|
|||
| optionsUICommit (ocm) | callable | ||
| optionsUICreate (ocr) | callable | ||
| optionsUIInit (oin) | callable | ||
| returnFilter (rf) | bool |
|
|
If true, the selected filter will be returned as the last item in the string array along with the selected files. Flag can have multiple arguments, passed either as a tuple or a list. |
|||
| selectFileFilter (sff) | unicode |
|
|
|
|||
| selectionChanged (sc) | callable | ||
| startingDirectory (dir) | unicode |
|
|
|
|||
Derived from mel command maya.cmds.fileDialog2
Example:
import pymel.core as pm
import maya.cmds as cmds
basicFilter = "*.mb"
pm.fileDialog2(fileFilter=basicFilter, dialogStyle=2)
singleFilter = "All Files (*.*)"
pm.fileDialog2(fileFilter=singleFilter, dialogStyle=2)
multipleFilters = "Maya Files (*.ma *.mb);;Maya ASCII (*.ma);;Maya Binary (*.mb);;All Files (*.*)"
pm.fileDialog2(fileFilter=multipleFilters, dialogStyle=2)