This command provides a dialog that allows users to select files or directories.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
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) | unicode | ||
MEL only. The string is interpreted as a MEL callback, to be called when the user-selected file type changes. The callback is of the form: global proc MyCustomFileTypeChanged(string $parent, string $newType) The parent argument is the parent layout into which controls have been added using the optionsUICreate flag. The newType argument is the new file type. |
|||
hideFileExtensions (hfe) | bool | ||
okCaption (okc) | unicode | ||
|
|||
optionsUICommit (ocm) | unicode | ||
MEL only. The string is interpreted as a MEL callback, to be called when the dialog is successfully dismissed. It will not be called if the user cancels the dialog, or closes the window using window title bar controls or other window system means. The callback is of the form: global proc MyCustomOptionsUICommit(string $parent) The parent argument is the parent layout into which controls have been added using the optionsUICreate flag.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
optionsUICreate (ocr) | bool | ||
MEL only. The string is interpreted as a MEL callback, to be called on creation of the file dialog. The callback is of the form: global proc MyCustomOptionsUISetup(string $parent) The parent argument is the parent layout into which controls can be added. This parent is the right-hand pane of the file dialog. |
|||
optionsUIInit (oin) | unicode | ||
MEL only. The string is interpreted as a MEL callback, to be called just after file dialog creation, to initialize controls. The callback is of the form: global proc MyCustomOptionsUIInitValues(string $parent, string $filterType) The parent argument is the parent layout into which controls have been added using the optionsUICreate flag. The filterType argument is the initial file filter. |
|||
returnFilter (rf) | bool | ||
|
|||
selectFileFilter (sff) | unicode | ||
|
|||
selectionChanged (sc) | unicode | ||
MEL only. The string is interpreted as a MEL callback, to be called when the user changes the file selection in the file dialog. The callback is of the form: global proc MyCustomSelectionChanged(string $parent, string $selection) The parent argument is the parent layout into which controls have been added using the optionsUICreate flag. The selection argument is the full path to the newly-selected file. |
|||
setProjectBtnEnabled (spe) | bool | ||
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)