:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the FileDialog.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_FileDialog: FileDialog ========== **Inherits:** :ref:`ConfirmationDialog` **<** :ref:`AcceptDialog` **<** :ref:`WindowDialog` **<** :ref:`Popup` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Dialog for selecting files or directories in the filesystem. Properties ---------- +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`Access` | :ref:`access` | 0 | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`String` | :ref:`current_dir` | "res://" | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`String` | :ref:`current_file` | "" | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`String` | :ref:`current_path` | "res://" | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`PoolStringArray` | :ref:`filters` | PoolStringArray( ) | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`Mode` | :ref:`mode` | 4 | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`bool` | :ref:`mode_overrides_title` | true | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ | :ref:`bool` | :ref:`show_hidden_files` | false | +-----------------------------------------------+-----------------------------------------------------------------------------+---------------------+ Methods ------- +-------------------------------------------+------------------------------------------------------------------------------------------------------+ | void | :ref:`add_filter` **(** :ref:`String` filter **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_filters` **(** **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------+ | void | :ref:`deselect_items` **(** **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------+ | :ref:`LineEdit` | :ref:`get_line_edit` **(** **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------+ | :ref:`VBoxContainer` | :ref:`get_vbox` **(** **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------+ | void | :ref:`invalidate` **(** **)** | +-------------------------------------------+------------------------------------------------------------------------------------------------------+ Theme Properties ---------------- +-------------------------------+----------------+-----------------------+ | :ref:`Color` | files_disabled | Color( 0, 0, 0, 0.7 ) | +-------------------------------+----------------+-----------------------+ | :ref:`Texture` | folder | | +-------------------------------+----------------+-----------------------+ | :ref:`Texture` | parent_folder | | +-------------------------------+----------------+-----------------------+ | :ref:`Texture` | reload | | +-------------------------------+----------------+-----------------------+ | :ref:`Texture` | toggle_hidden | | +-------------------------------+----------------+-----------------------+ Signals ------- .. _class_FileDialog_signal_dir_selected: - **dir_selected** **(** :ref:`String` dir **)** Emitted when the user selects a directory. .. _class_FileDialog_signal_file_selected: - **file_selected** **(** :ref:`String` path **)** Emitted when the user selects a file by double-clicking it or pressing the **OK** button. .. _class_FileDialog_signal_files_selected: - **files_selected** **(** :ref:`PoolStringArray` paths **)** Emitted when the user selects multiple files. Enumerations ------------ .. _enum_FileDialog_Mode: .. _class_FileDialog_constant_MODE_OPEN_FILE: .. _class_FileDialog_constant_MODE_OPEN_FILES: .. _class_FileDialog_constant_MODE_OPEN_DIR: .. _class_FileDialog_constant_MODE_OPEN_ANY: .. _class_FileDialog_constant_MODE_SAVE_FILE: enum **Mode**: - **MODE_OPEN_FILE** = **0** --- The dialog allows selecting one, and only one file. - **MODE_OPEN_FILES** = **1** --- The dialog allows selecting multiple files. - **MODE_OPEN_DIR** = **2** --- The dialog only allows selecting a directory, disallowing the selection of any file. - **MODE_OPEN_ANY** = **3** --- The dialog allows selecting one file or directory. - **MODE_SAVE_FILE** = **4** --- The dialog will warn when a file exists. .. _enum_FileDialog_Access: .. _class_FileDialog_constant_ACCESS_RESOURCES: .. _class_FileDialog_constant_ACCESS_USERDATA: .. _class_FileDialog_constant_ACCESS_FILESYSTEM: enum **Access**: - **ACCESS_RESOURCES** = **0** --- The dialog only allows accessing files under the :ref:`Resource` path (``res://``). - **ACCESS_USERDATA** = **1** --- The dialog only allows accessing files under user data path (``user://``). - **ACCESS_FILESYSTEM** = **2** --- The dialog allows accessing files on the whole file system. Description ----------- FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks. Property Descriptions --------------------- .. _class_FileDialog_property_access: - :ref:`Access` **access** +-----------+-------------------+ | *Default* | 0 | +-----------+-------------------+ | *Setter* | set_access(value) | +-----------+-------------------+ | *Getter* | get_access() | +-----------+-------------------+ The file system access scope. See enum ``Access`` constants. .. _class_FileDialog_property_current_dir: - :ref:`String` **current_dir** +-----------+------------------------+ | *Default* | "res://" | +-----------+------------------------+ | *Setter* | set_current_dir(value) | +-----------+------------------------+ | *Getter* | get_current_dir() | +-----------+------------------------+ The current working directory of the file dialog. .. _class_FileDialog_property_current_file: - :ref:`String` **current_file** +-----------+-------------------------+ | *Default* | "" | +-----------+-------------------------+ | *Setter* | set_current_file(value) | +-----------+-------------------------+ | *Getter* | get_current_file() | +-----------+-------------------------+ The currently selected file of the file dialog. .. _class_FileDialog_property_current_path: - :ref:`String` **current_path** +-----------+-------------------------+ | *Default* | "res://" | +-----------+-------------------------+ | *Setter* | set_current_path(value) | +-----------+-------------------------+ | *Getter* | get_current_path() | +-----------+-------------------------+ The currently selected file path of the file dialog. .. _class_FileDialog_property_filters: - :ref:`PoolStringArray` **filters** +-----------+---------------------+ | *Default* | PoolStringArray( ) | +-----------+---------------------+ | *Setter* | set_filters(value) | +-----------+---------------------+ | *Getter* | get_filters() | +-----------+---------------------+ The available file type filters. For example, this shows only ``.png`` and ``.gd`` files: ``set_filters(PoolStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))``. .. _class_FileDialog_property_mode: - :ref:`Mode` **mode** +-----------+-----------------+ | *Default* | 4 | +-----------+-----------------+ | *Setter* | set_mode(value) | +-----------+-----------------+ | *Getter* | get_mode() | +-----------+-----------------+ The dialog's open or save mode, which affects the selection behavior. See enum ``Mode`` constants. .. _class_FileDialog_property_mode_overrides_title: - :ref:`bool` **mode_overrides_title** +-----------+---------------------------------+ | *Default* | true | +-----------+---------------------------------+ | *Setter* | set_mode_overrides_title(value) | +-----------+---------------------------------+ | *Getter* | is_mode_overriding_title() | +-----------+---------------------------------+ If ``true``, changing the ``Mode`` property will set the window title accordingly (e.g. setting mode to :ref:`MODE_OPEN_FILE` will change the window title to "Open a File"). .. _class_FileDialog_property_show_hidden_files: - :ref:`bool` **show_hidden_files** +-----------+------------------------------+ | *Default* | false | +-----------+------------------------------+ | *Setter* | set_show_hidden_files(value) | +-----------+------------------------------+ | *Getter* | is_showing_hidden_files() | +-----------+------------------------------+ If ``true``, the dialog will show hidden files. Method Descriptions ------------------- .. _class_FileDialog_method_add_filter: - void **add_filter** **(** :ref:`String` filter **)** Adds ``filter`` as a custom filter; ``filter`` should be of the form ``"filename.extension ; Description"``. For example, ``"*.png ; PNG Images"``. .. _class_FileDialog_method_clear_filters: - void **clear_filters** **(** **)** Clear all the added filters in the dialog. .. _class_FileDialog_method_deselect_items: - void **deselect_items** **(** **)** Clear currently selected items in the dialog. .. _class_FileDialog_method_get_line_edit: - :ref:`LineEdit` **get_line_edit** **(** **)** Returns the LineEdit for the selected file. .. _class_FileDialog_method_get_vbox: - :ref:`VBoxContainer` **get_vbox** **(** **)** Returns the vertical box container of the dialog, custom controls can be added to it. .. _class_FileDialog_method_invalidate: - void **invalidate** **(** **)** Invalidate and update the current dialog content list.