2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 10:08:05 +02:00
<class name= "FileDialog" inherits= "ConfirmationDialog" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 22:42:36 +02:00
<brief_description >
2023-04-30 16:26:09 +02:00
A dialog for selecting files or directories in the filesystem.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2023-04-30 16:26:09 +02:00
[FileDialog] is a preset dialog used to choose files and directories in the filesystem. It supports filter masks. [FileDialog] automatically sets its window title according to the [member file_mode]. If you want to use a custom title, disable this by setting [member mode_overrides_title] to [code]false[/code].
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "add_filter" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "filter" type= "String" />
<param index= "1" name= "description" type= "String" default= """" />
2017-09-12 22:42:36 +02:00
<description >
2022-08-12 18:07:53 +02:00
Adds a comma-delimited file name [param filter] option to the [FileDialog] with an optional [param description], which restricts what files can be picked.
A [param filter] should be of the form [code]"filename.extension"[/code], where filename and extension can be [code]*[/code] to match any string. Filters starting with [code].[/code] (i.e. empty filenames) are not allowed.
For example, a [param filter] of [code]"*.png, *.jpg"[/code] and a [param description] of [code]"Images"[/code] results in filter text "Images (*.png, *.jpg)".
2017-09-12 22:42:36 +02:00
</description>
</method>
2023-10-13 11:37:46 +02:00
<method name= "add_option" >
<return type= "void" />
<param index= "0" name= "name" type= "String" />
<param index= "1" name= "values" type= "PackedStringArray" />
2024-03-21 09:42:38 +01:00
<param index= "2" name= "default_value_index" type= "int" />
2023-10-13 11:37:46 +02:00
<description >
Adds an additional [OptionButton] to the file dialog. If [param values] is empty, a [CheckBox] is added instead.
2024-03-21 09:42:38 +01:00
[param default_value_index] should be an index of the value in the [param values]. If [param values] is empty it should be either [code]1[/code] (checked), or [code]0[/code] (unchecked).
2023-10-13 11:37:46 +02:00
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "clear_filters" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2017-09-12 22:42:36 +02:00
<description >
Clear all the added filters in the dialog.
</description>
</method>
2020-12-21 11:26:41 +01:00
<method name= "deselect_all" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2017-11-27 23:37:47 +01:00
<description >
2020-12-21 11:26:41 +01:00
Clear all currently selected items in the dialog.
2017-11-27 23:37:47 +01:00
</description>
</method>
2018-06-11 18:41:16 +02:00
<method name= "get_line_edit" >
2021-07-30 15:28:05 +02:00
<return type= "LineEdit" />
2018-06-11 18:41:16 +02:00
<description >
2018-10-11 19:28:36 +02:00
Returns the LineEdit for the selected file.
2021-10-10 21:28:56 +02:00
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
2018-06-11 18:41:16 +02:00
</description>
</method>
2023-10-13 11:37:46 +02:00
<method name= "get_option_default" qualifiers= "const" >
<return type= "int" />
<param index= "0" name= "option" type= "int" />
<description >
Returns the default value index of the [OptionButton] or [CheckBox] with index [param option].
</description>
</method>
<method name= "get_option_name" qualifiers= "const" >
<return type= "String" />
<param index= "0" name= "option" type= "int" />
<description >
Returns the name of the [OptionButton] or [CheckBox] with index [param option].
</description>
</method>
<method name= "get_option_values" qualifiers= "const" >
<return type= "PackedStringArray" />
<param index= "0" name= "option" type= "int" />
<description >
Returns an array of values of the [OptionButton] with index [param option].
</description>
</method>
<method name= "get_selected_options" qualifiers= "const" >
<return type= "Dictionary" />
<description >
Returns a [Dictionary] with the selected values of the additional [OptionButton]s and/or [CheckBox]es. [Dictionary] keys are names and values are selected value indices.
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "get_vbox" >
2021-07-30 15:28:05 +02:00
<return type= "VBoxContainer" />
2017-09-12 22:42:36 +02:00
<description >
2019-05-24 04:15:43 +02:00
Returns the vertical box container of the dialog, custom controls can be added to it.
2021-10-10 21:28:56 +02:00
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
2024-07-10 08:28:15 +02:00
[b]Note:[/b] Changes to this node are ignored by native file dialogs, use [method add_option] to add custom elements to the dialog instead.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "invalidate" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2017-09-12 22:42:36 +02:00
<description >
Invalidate and update the current dialog content list.
2024-07-10 08:28:15 +02:00
[b]Note:[/b] This method does nothing on native file dialogs.
2017-09-12 22:42:36 +02:00
</description>
</method>
2023-10-13 11:37:46 +02:00
<method name= "set_option_default" >
<return type= "void" />
<param index= "0" name= "option" type= "int" />
2024-03-21 09:42:38 +01:00
<param index= "1" name= "default_value_index" type= "int" />
2023-10-13 11:37:46 +02:00
<description >
Sets the default value index of the [OptionButton] or [CheckBox] with index [param option].
</description>
</method>
<method name= "set_option_name" >
<return type= "void" />
<param index= "0" name= "option" type= "int" />
<param index= "1" name= "name" type= "String" />
<description >
Sets the name of the [OptionButton] or [CheckBox] with index [param option].
</description>
</method>
<method name= "set_option_values" >
<return type= "void" />
<param index= "0" name= "option" type= "int" />
<param index= "1" name= "values" type= "PackedStringArray" />
<description >
Sets the option values of the [OptionButton] with index [param option].
</description>
</method>
2017-09-12 22:42:36 +02:00
</methods>
<members >
2019-06-29 12:38:01 +02:00
<member name= "access" type= "int" setter= "set_access" getter= "get_access" enum= "FileDialog.Access" default= "0" >
2023-04-10 15:13:20 +02:00
The file system access scope. See [enum Access] constants.
2024-07-10 08:28:15 +02:00
[b]Warning:[/b] In Web builds, FileDialog cannot access the host file system. In sandboxed Linux and macOS environments, [member use_native_dialog] is automatically used to allow limited access to host file system.
2017-09-12 22:42:36 +02:00
</member>
2021-10-29 20:15:33 +02:00
<member name= "current_dir" type= "String" setter= "set_current_dir" getter= "get_current_dir" >
2018-01-11 23:38:35 +01:00
The current working directory of the file dialog.
2024-07-10 08:28:15 +02:00
[b]Note:[/b] For native file dialogs, this property is only treated as a hint and may not be respected by specific OS implementations.
2018-01-11 23:38:35 +01:00
</member>
2021-10-29 20:15:33 +02:00
<member name= "current_file" type= "String" setter= "set_current_file" getter= "get_current_file" >
2018-01-11 23:38:35 +01:00
The currently selected file of the file dialog.
</member>
2021-10-29 20:15:33 +02:00
<member name= "current_path" type= "String" setter= "set_current_path" getter= "get_current_path" >
2018-01-11 23:38:35 +01:00
The currently selected file path of the file dialog.
</member>
2021-12-02 20:38:49 +01:00
<member name= "dialog_hide_on_ok" type= "bool" setter= "set_hide_on_ok" getter= "get_hide_on_ok" overrides= "AcceptDialog" default= "false" />
2020-03-31 11:56:58 +02:00
<member name= "file_mode" type= "int" setter= "set_file_mode" getter= "get_file_mode" enum= "FileDialog.FileMode" default= "4" >
The dialog's open or save mode, which affects the selection behavior. See [enum FileMode].
</member>
2019-09-24 19:45:03 +02:00
<member name= "filters" type= "PackedStringArray" setter= "set_filters" getter= "get_filters" default= "PackedStringArray()" >
2024-03-04 20:12:22 +01:00
The available file type filters. Each filter string in the array should be formatted like this: [code]*.txt,*.doc;Text Files[/code]. The description text of the filter is optional and can be omitted.
2017-09-12 22:42:36 +02:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "mode_overrides_title" type= "bool" setter= "set_mode_overrides_title" getter= "is_mode_overriding_title" default= "true" >
2023-04-10 15:13:20 +02:00
If [code]true[/code], changing the [member file_mode] property will set the window title accordingly (e.g. setting [member file_mode] to [constant FILE_MODE_OPEN_FILE] will change the window title to "Open a File").
2017-12-03 02:54:06 +01:00
</member>
2023-10-13 11:37:46 +02:00
<member name= "option_count" type= "int" setter= "set_option_count" getter= "get_option_count" default= "0" >
The number of additional [OptionButton]s and [CheckBox]es in the dialog.
</member>
2022-03-13 01:35:20 +01:00
<member name= "root_subfolder" type= "String" setter= "set_root_subfolder" getter= "get_root_subfolder" default= """" >
If non-empty, the given sub-folder will be "root" of this [FileDialog], i.e. user won't be able to go to its parent directory.
2024-07-10 08:28:15 +02:00
[b]Note:[/b] This property is ignored by native file dialogs.
2022-03-13 01:35:20 +01:00
</member>
2019-06-29 12:38:01 +02:00
<member name= "show_hidden_files" type= "bool" setter= "set_show_hidden_files" getter= "is_showing_hidden_files" default= "false" >
2018-10-11 19:28:36 +02:00
If [code]true[/code], the dialog will show hidden files.
2024-07-10 08:28:15 +02:00
[b]Note:[/b] This property is ignored by native file dialogs on Linux.
2017-09-12 22:42:36 +02:00
</member>
2024-09-14 13:28:39 +02:00
<member name= "size" type= "Vector2i" setter= "set_size" getter= "get_size" overrides= "Window" default= "Vector2i(640, 360)" />
2021-12-02 20:38:49 +01:00
<member name= "title" type= "String" setter= "set_title" getter= "get_title" overrides= "Window" default= ""Save a File"" />
2021-03-30 14:42:50 +02:00
<member name= "use_native_dialog" type= "bool" setter= "set_use_native_dialog" getter= "get_use_native_dialog" default= "false" >
If [code]true[/code], [member access] is set to [constant ACCESS_FILESYSTEM], and it is supported by the current [DisplayServer], OS native dialog will be used instead of custom one.
2024-07-10 08:28:15 +02:00
[b]Note:[/b] On Linux and macOS, sandboxed apps always use native dialogs to access the host file system.
[b]Note:[/b] On macOS, sandboxed apps will save security-scoped bookmarks to retain access to the opened folders across multiple sessions. Use [method OS.get_granted_permissions] to get a list of saved bookmarks.
[b]Note:[/b] Native dialogs are isolated from the base process, file dialog properties can't be modified once the dialog is shown.
2021-03-30 14:42:50 +02:00
</member>
2017-09-12 22:42:36 +02:00
</members>
<signals >
<signal name= "dir_selected" >
2022-08-06 20:11:48 +02:00
<param index= "0" name= "dir" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Emitted when the user selects a directory.
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "file_selected" >
2022-08-06 20:11:48 +02:00
<param index= "0" name= "path" type= "String" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Emitted when the user selects a file by double-clicking it or pressing the [b]OK[/b] button.
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "files_selected" >
2022-08-06 20:11:48 +02:00
<param index= "0" name= "paths" type= "PackedStringArray" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Emitted when the user selects multiple files.
2017-09-12 22:42:36 +02:00
</description>
</signal>
</signals>
<constants >
2020-03-31 11:56:58 +02:00
<constant name= "FILE_MODE_OPEN_FILE" value= "0" enum= "FileMode" >
2019-06-22 01:04:47 +02:00
The dialog allows selecting one, and only one file.
2017-09-12 22:42:36 +02:00
</constant>
2020-03-31 11:56:58 +02:00
<constant name= "FILE_MODE_OPEN_FILES" value= "1" enum= "FileMode" >
2019-06-22 01:04:47 +02:00
The dialog allows selecting multiple files.
2017-09-12 22:42:36 +02:00
</constant>
2020-03-31 11:56:58 +02:00
<constant name= "FILE_MODE_OPEN_DIR" value= "2" enum= "FileMode" >
2019-06-22 01:04:47 +02:00
The dialog only allows selecting a directory, disallowing the selection of any file.
2017-09-12 22:42:36 +02:00
</constant>
2020-03-31 11:56:58 +02:00
<constant name= "FILE_MODE_OPEN_ANY" value= "3" enum= "FileMode" >
2019-06-22 01:04:47 +02:00
The dialog allows selecting one file or directory.
2017-09-12 22:42:36 +02:00
</constant>
2020-03-31 11:56:58 +02:00
<constant name= "FILE_MODE_SAVE_FILE" value= "4" enum= "FileMode" >
2017-09-12 22:42:36 +02:00
The dialog will warn when a file exists.
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "ACCESS_RESOURCES" value= "0" enum= "Access" >
2019-06-22 01:04:47 +02:00
The dialog only allows accessing files under the [Resource] path ([code]res://[/code]).
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "ACCESS_USERDATA" value= "1" enum= "Access" >
2019-06-22 01:04:47 +02:00
The dialog only allows accessing files under user data path ([code]user://[/code]).
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "ACCESS_FILESYSTEM" value= "2" enum= "Access" >
2019-06-22 01:04:47 +02:00
The dialog allows accessing files on the whole file system.
2017-09-12 22:42:36 +02:00
</constant>
</constants>
<theme_items >
2022-09-06 19:09:32 +02:00
<theme_item name= "file_disabled_color" data_type= "color" type= "Color" default= "Color(1, 1, 1, 0.25)" >
2020-03-03 19:21:21 +01:00
The color tint for disabled files (when the [FileDialog] is used in open folder mode).
2017-09-12 22:42:36 +02:00
</theme_item>
2022-09-06 19:09:32 +02:00
<theme_item name= "file_icon_color" data_type= "color" type= "Color" default= "Color(1, 1, 1, 1)" >
The color modulation applied to the file icon.
</theme_item>
<theme_item name= "folder_icon_color" data_type= "color" type= "Color" default= "Color(1, 1, 1, 1)" >
2020-03-03 19:21:21 +01:00
The color modulation applied to the folder icon.
2019-08-21 18:43:01 +02:00
</theme_item>
2021-12-01 19:02:20 +01:00
<theme_item name= "back_folder" data_type= "icon" type= "Texture2D" >
Custom icon for the back arrow.
</theme_item>
2024-02-25 17:51:50 +01:00
<theme_item name= "create_folder" data_type= "icon" type= "Texture2D" >
Custom icon for the create folder button.
</theme_item>
2021-12-01 19:02:20 +01:00
<theme_item name= "file" data_type= "icon" type= "Texture2D" >
Custom icon for files.
</theme_item>
<theme_item name= "folder" data_type= "icon" type= "Texture2D" >
Custom icon for folders.
</theme_item>
2021-08-04 18:54:41 +02:00
<theme_item name= "forward_folder" data_type= "icon" type= "Texture2D" >
2021-03-19 13:01:03 +01:00
Custom icon for the forward arrow.
</theme_item>
2021-08-04 18:54:41 +02:00
<theme_item name= "parent_folder" data_type= "icon" type= "Texture2D" >
2020-03-03 19:21:21 +01:00
Custom icon for the parent folder arrow.
2017-12-07 08:23:08 +01:00
</theme_item>
2021-08-04 18:54:41 +02:00
<theme_item name= "reload" data_type= "icon" type= "Texture2D" >
2020-03-03 19:21:21 +01:00
Custom icon for the reload button.
2017-09-12 22:42:36 +02:00
</theme_item>
2021-08-04 18:54:41 +02:00
<theme_item name= "toggle_hidden" data_type= "icon" type= "Texture2D" >
2020-03-03 19:21:21 +01:00
Custom icon for the toggle hidden button.
2019-06-15 00:04:55 +02:00
</theme_item>
2017-09-12 22:42:36 +02:00
</theme_items>
</class>