class_editorfiledialog.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/EditorFileDialog.xml.
  6. .. _class_EditorFileDialog:
  7. EditorFileDialog
  8. ================
  9. **Inherits:** :ref:`ConfirmationDialog<class_ConfirmationDialog>` **<** :ref:`AcceptDialog<class_AcceptDialog>` **<** :ref:`Window<class_Window>` **<** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A modified version of :ref:`FileDialog<class_FileDialog>` used by the editor.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **EditorFileDialog** is an enhanced version of :ref:`FileDialog<class_FileDialog>` available only to editor plugins. Additional features include list of favorited/recent files and the ability to see files as thumbnails grid instead of list.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  21. | :ref:`Access<enum_EditorFileDialog_Access>` | :ref:`access<class_EditorFileDialog_property_access>` | ``0`` |
  22. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  23. | :ref:`String<class_String>` | :ref:`current_dir<class_EditorFileDialog_property_current_dir>` | |
  24. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  25. | :ref:`String<class_String>` | :ref:`current_file<class_EditorFileDialog_property_current_file>` | |
  26. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  27. | :ref:`String<class_String>` | :ref:`current_path<class_EditorFileDialog_property_current_path>` | |
  28. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | dialog_hide_on_ok | ``false`` (overrides :ref:`AcceptDialog<class_AcceptDialog_property_dialog_hide_on_ok>`) |
  30. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`disable_overwrite_warning<class_EditorFileDialog_property_disable_overwrite_warning>` | ``false`` |
  32. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  33. | :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` | :ref:`display_mode<class_EditorFileDialog_property_display_mode>` | ``0`` |
  34. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  35. | :ref:`FileMode<enum_EditorFileDialog_FileMode>` | :ref:`file_mode<class_EditorFileDialog_property_file_mode>` | ``4`` |
  36. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  37. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`filters<class_EditorFileDialog_property_filters>` | ``PackedStringArray()`` |
  38. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`show_hidden_files<class_EditorFileDialog_property_show_hidden_files>` | ``false`` |
  40. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  41. | :ref:`String<class_String>` | title | ``"Save a File"`` (overrides :ref:`Window<class_Window_property_title>`) |
  42. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  43. .. rst-class:: classref-reftable-group
  44. Methods
  45. -------
  46. .. table::
  47. :widths: auto
  48. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`add_filter<class_EditorFileDialog_method_add_filter>` **(** :ref:`String<class_String>` filter, :ref:`String<class_String>` description="" **)** |
  50. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`add_side_menu<class_EditorFileDialog_method_add_side_menu>` **(** :ref:`Control<class_Control>` menu, :ref:`String<class_String>` title="" **)** |
  52. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`clear_filters<class_EditorFileDialog_method_clear_filters>` **(** **)** |
  54. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`LineEdit<class_LineEdit>` | :ref:`get_line_edit<class_EditorFileDialog_method_get_line_edit>` **(** **)** |
  56. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`VBoxContainer<class_VBoxContainer>` | :ref:`get_vbox<class_EditorFileDialog_method_get_vbox>` **(** **)** |
  58. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`invalidate<class_EditorFileDialog_method_invalidate>` **(** **)** |
  60. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. .. rst-class:: classref-section-separator
  62. ----
  63. .. rst-class:: classref-descriptions-group
  64. Signals
  65. -------
  66. .. _class_EditorFileDialog_signal_dir_selected:
  67. .. rst-class:: classref-signal
  68. **dir_selected** **(** :ref:`String<class_String>` dir **)**
  69. Emitted when a directory is selected.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_EditorFileDialog_signal_file_selected:
  73. .. rst-class:: classref-signal
  74. **file_selected** **(** :ref:`String<class_String>` path **)**
  75. Emitted when a file is selected.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_EditorFileDialog_signal_files_selected:
  79. .. rst-class:: classref-signal
  80. **files_selected** **(** :ref:`PackedStringArray<class_PackedStringArray>` paths **)**
  81. Emitted when multiple files are selected.
  82. .. rst-class:: classref-section-separator
  83. ----
  84. .. rst-class:: classref-descriptions-group
  85. Enumerations
  86. ------------
  87. .. _enum_EditorFileDialog_FileMode:
  88. .. rst-class:: classref-enumeration
  89. enum **FileMode**:
  90. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_FILE:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_FILE** = ``0``
  93. The **EditorFileDialog** can select only one file. Accepting the window will open the file.
  94. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_FILES:
  95. .. rst-class:: classref-enumeration-constant
  96. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_FILES** = ``1``
  97. The **EditorFileDialog** can select multiple files. Accepting the window will open all files.
  98. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_DIR:
  99. .. rst-class:: classref-enumeration-constant
  100. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_DIR** = ``2``
  101. The **EditorFileDialog** can select only one directory. Accepting the window will open the directory.
  102. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_ANY:
  103. .. rst-class:: classref-enumeration-constant
  104. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_ANY** = ``3``
  105. The **EditorFileDialog** can select a file or directory. Accepting the window will open it.
  106. .. _class_EditorFileDialog_constant_FILE_MODE_SAVE_FILE:
  107. .. rst-class:: classref-enumeration-constant
  108. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_SAVE_FILE** = ``4``
  109. The **EditorFileDialog** can select only one file. Accepting the window will save the file.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _enum_EditorFileDialog_Access:
  113. .. rst-class:: classref-enumeration
  114. enum **Access**:
  115. .. _class_EditorFileDialog_constant_ACCESS_RESOURCES:
  116. .. rst-class:: classref-enumeration-constant
  117. :ref:`Access<enum_EditorFileDialog_Access>` **ACCESS_RESOURCES** = ``0``
  118. The **EditorFileDialog** can only view ``res://`` directory contents.
  119. .. _class_EditorFileDialog_constant_ACCESS_USERDATA:
  120. .. rst-class:: classref-enumeration-constant
  121. :ref:`Access<enum_EditorFileDialog_Access>` **ACCESS_USERDATA** = ``1``
  122. The **EditorFileDialog** can only view ``user://`` directory contents.
  123. .. _class_EditorFileDialog_constant_ACCESS_FILESYSTEM:
  124. .. rst-class:: classref-enumeration-constant
  125. :ref:`Access<enum_EditorFileDialog_Access>` **ACCESS_FILESYSTEM** = ``2``
  126. The **EditorFileDialog** can view the entire local file system.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _enum_EditorFileDialog_DisplayMode:
  130. .. rst-class:: classref-enumeration
  131. enum **DisplayMode**:
  132. .. _class_EditorFileDialog_constant_DISPLAY_THUMBNAILS:
  133. .. rst-class:: classref-enumeration-constant
  134. :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **DISPLAY_THUMBNAILS** = ``0``
  135. The **EditorFileDialog** displays resources as thumbnails.
  136. .. _class_EditorFileDialog_constant_DISPLAY_LIST:
  137. .. rst-class:: classref-enumeration-constant
  138. :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **DISPLAY_LIST** = ``1``
  139. The **EditorFileDialog** displays resources as a list of filenames.
  140. .. rst-class:: classref-section-separator
  141. ----
  142. .. rst-class:: classref-descriptions-group
  143. Property Descriptions
  144. ---------------------
  145. .. _class_EditorFileDialog_property_access:
  146. .. rst-class:: classref-property
  147. :ref:`Access<enum_EditorFileDialog_Access>` **access** = ``0``
  148. .. rst-class:: classref-property-setget
  149. - void **set_access** **(** :ref:`Access<enum_EditorFileDialog_Access>` value **)**
  150. - :ref:`Access<enum_EditorFileDialog_Access>` **get_access** **(** **)**
  151. The location from which the user may select a file, including ``res://``, ``user://``, and the local file system.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_EditorFileDialog_property_current_dir:
  155. .. rst-class:: classref-property
  156. :ref:`String<class_String>` **current_dir**
  157. .. rst-class:: classref-property-setget
  158. - void **set_current_dir** **(** :ref:`String<class_String>` value **)**
  159. - :ref:`String<class_String>` **get_current_dir** **(** **)**
  160. The currently occupied directory.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_EditorFileDialog_property_current_file:
  164. .. rst-class:: classref-property
  165. :ref:`String<class_String>` **current_file**
  166. .. rst-class:: classref-property-setget
  167. - void **set_current_file** **(** :ref:`String<class_String>` value **)**
  168. - :ref:`String<class_String>` **get_current_file** **(** **)**
  169. The currently selected file.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_EditorFileDialog_property_current_path:
  173. .. rst-class:: classref-property
  174. :ref:`String<class_String>` **current_path**
  175. .. rst-class:: classref-property-setget
  176. - void **set_current_path** **(** :ref:`String<class_String>` value **)**
  177. - :ref:`String<class_String>` **get_current_path** **(** **)**
  178. The file system path in the address bar.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_EditorFileDialog_property_disable_overwrite_warning:
  182. .. rst-class:: classref-property
  183. :ref:`bool<class_bool>` **disable_overwrite_warning** = ``false``
  184. .. rst-class:: classref-property-setget
  185. - void **set_disable_overwrite_warning** **(** :ref:`bool<class_bool>` value **)**
  186. - :ref:`bool<class_bool>` **is_overwrite_warning_disabled** **(** **)**
  187. If ``true``, the **EditorFileDialog** will not warn the user before overwriting files.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_EditorFileDialog_property_display_mode:
  191. .. rst-class:: classref-property
  192. :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **display_mode** = ``0``
  193. .. rst-class:: classref-property-setget
  194. - void **set_display_mode** **(** :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` value **)**
  195. - :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **get_display_mode** **(** **)**
  196. The view format in which the **EditorFileDialog** displays resources to the user.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_EditorFileDialog_property_file_mode:
  200. .. rst-class:: classref-property
  201. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **file_mode** = ``4``
  202. .. rst-class:: classref-property-setget
  203. - void **set_file_mode** **(** :ref:`FileMode<enum_EditorFileDialog_FileMode>` value **)**
  204. - :ref:`FileMode<enum_EditorFileDialog_FileMode>` **get_file_mode** **(** **)**
  205. The dialog's open or save mode, which affects the selection behavior. See :ref:`FileMode<enum_EditorFileDialog_FileMode>`.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_EditorFileDialog_property_filters:
  209. .. rst-class:: classref-property
  210. :ref:`PackedStringArray<class_PackedStringArray>` **filters** = ``PackedStringArray()``
  211. .. rst-class:: classref-property-setget
  212. - void **set_filters** **(** :ref:`PackedStringArray<class_PackedStringArray>` value **)**
  213. - :ref:`PackedStringArray<class_PackedStringArray>` **get_filters** **(** **)**
  214. The available file type filters. For example, this shows only ``.png`` and ``.gd`` files: ``set_filters(PackedStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))``. Multiple file types can also be specified in a single filter. ``"*.png, *.jpg, *.jpeg ; Supported Images"`` will show both PNG and JPEG files when selected.
  215. .. rst-class:: classref-item-separator
  216. ----
  217. .. _class_EditorFileDialog_property_show_hidden_files:
  218. .. rst-class:: classref-property
  219. :ref:`bool<class_bool>` **show_hidden_files** = ``false``
  220. .. rst-class:: classref-property-setget
  221. - void **set_show_hidden_files** **(** :ref:`bool<class_bool>` value **)**
  222. - :ref:`bool<class_bool>` **is_showing_hidden_files** **(** **)**
  223. If ``true``, hidden files and directories will be visible in the **EditorFileDialog**. This property is synchronized with :ref:`EditorSettings.filesystem/file_dialog/show_hidden_files<class_EditorSettings_property_filesystem/file_dialog/show_hidden_files>`.
  224. .. rst-class:: classref-section-separator
  225. ----
  226. .. rst-class:: classref-descriptions-group
  227. Method Descriptions
  228. -------------------
  229. .. _class_EditorFileDialog_method_add_filter:
  230. .. rst-class:: classref-method
  231. void **add_filter** **(** :ref:`String<class_String>` filter, :ref:`String<class_String>` description="" **)**
  232. Adds a comma-delimited file name ``filter`` option to the **EditorFileDialog** with an optional ``description``, which restricts what files can be picked.
  233. A ``filter`` should be of the form ``"filename.extension"``, where filename and extension can be ``*`` to match any string. Filters starting with ``.`` (i.e. empty filenames) are not allowed.
  234. For example, a ``filter`` of ``"*.tscn, *.scn"`` and a ``description`` of ``"Scenes"`` results in filter text "Scenes (\*.tscn, \*.scn)".
  235. .. rst-class:: classref-item-separator
  236. ----
  237. .. _class_EditorFileDialog_method_add_side_menu:
  238. .. rst-class:: classref-method
  239. void **add_side_menu** **(** :ref:`Control<class_Control>` menu, :ref:`String<class_String>` title="" **)**
  240. Adds the given ``menu`` to the side of the file dialog with the given ``title`` text on top. Only one side menu is allowed.
  241. .. rst-class:: classref-item-separator
  242. ----
  243. .. _class_EditorFileDialog_method_clear_filters:
  244. .. rst-class:: classref-method
  245. void **clear_filters** **(** **)**
  246. Removes all filters except for "All Files (\*)".
  247. .. rst-class:: classref-item-separator
  248. ----
  249. .. _class_EditorFileDialog_method_get_line_edit:
  250. .. rst-class:: classref-method
  251. :ref:`LineEdit<class_LineEdit>` **get_line_edit** **(** **)**
  252. Returns the LineEdit for the selected file.
  253. \ **Warning:** 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 :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  254. .. rst-class:: classref-item-separator
  255. ----
  256. .. _class_EditorFileDialog_method_get_vbox:
  257. .. rst-class:: classref-method
  258. :ref:`VBoxContainer<class_VBoxContainer>` **get_vbox** **(** **)**
  259. Returns the :ref:`VBoxContainer<class_VBoxContainer>` used to display the file system.
  260. \ **Warning:** 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 :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  261. .. rst-class:: classref-item-separator
  262. ----
  263. .. _class_EditorFileDialog_method_invalidate:
  264. .. rst-class:: classref-method
  265. void **invalidate** **(** **)**
  266. Notify the **EditorFileDialog** that its view of the data is no longer accurate. Updates the view contents on next view update.
  267. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  268. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  269. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  270. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  271. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  272. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  273. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`