Go to: Synopsis. Return value. Related. Flags. Python examples.
fileDialog([application=boolean], [defaultFileName=string], [directoryMask=string], [mode=int], [title=string])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
fileDialog is undoable, NOT queryable, and NOT editable.
The fileBrowserDialog and fileDialog commands have now been deprecated.
Both commands are still callable, but it is recommended that the fileDialog2 command
be used instead. To maintain some backwards compatibility, both fileBrowserDialog and
fileDialog will convert the flags/values passed to them into the appropriate flags/values
that the fileDialog2 command uses and will call that command internally. It is not
guaranteed that this compatibility will be able to be maintained in future versions so
any new scripts that are written should use fileDialog2.
See below for an example of how to change a script to use fileDialog2.
fileBrowserDialog
application, defaultFileName, directoryMask, mode, title
Long name (short name) |
Argument types |
Properties |
mode(m)
|
int
|
|
|
Defines the mode in which to run the file dialog:
Write mode can not be used in conjunction with the -application flag.
|
|
directoryMask(dm)
|
string
|
|
|
This can be used to specify what directory and file names
will be displayed in the dialog. If not specified, the
current directory will be used, with all files displayed.
The string may contain a path name, and must contain a
wild-carded file specifier. (eg "*.cc" or "/usr/u/*") If
just a path is specified, then the last directory in the
path is taken to be a file specifier, and this will not
produce the desired results.
|
|
application(app)
|
boolean
|
|
|
This is a "Mac" only flag. This brings up the dialog which
selects only the application bundle.
|
|
defaultFileName(dfn)
|
string
|
|
|
Set default file name. This flag is available under "write" mode
|
|
title(t)
|
string
|
|
|
Set title text. The default value under "write" mode is "Save As". The default value under "read" mode is "Open".
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
import maya.cmds as cmds
# Old way:
cmds.fileDialog()
cmds.fileDialog( directoryMask='/usr/u/bozo/myFiles/*.ma' )
cmds.fileDialog( dm='*.cc' )
# Recommended way:
cmds.fileDialog2(startingDirectory ="/usr/u/bozo/myFiles/", fileFilter="Maya Ascii (*.ma)")