class_editorsettings.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/EditorSettings.xml.
  6. .. _class_EditorSettings:
  7. EditorSettings
  8. ==============
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. Object that holds the project-independent editor settings.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Object that holds the project-independent editor settings. These settings are generally visible in the **Editor > Editor Settings** menu.
  15. Property names use slash delimiters to distinguish sections. Setting values can be of any :ref:`Variant<class_Variant>` type. It's recommended to use ``snake_case`` for editor settings to be consistent with the Godot editor itself.
  16. Accessing the settings can be done using the following methods, such as:
  17. ::
  18. # `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
  19. settings.set_setting("some/property",value)
  20. # `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
  21. settings.get_setting("some/property")
  22. var list_of_settings = settings.get_property_list()
  23. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton using :ref:`EditorInterface.get_editor_settings<class_EditorInterface_method_get_editor_settings>`.
  24. .. rst-class:: classref-reftable-group
  25. Methods
  26. -------
  27. .. table::
  28. :widths: auto
  29. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`add_property_info<class_EditorSettings_method_add_property_info>` **(** :ref:`Dictionary<class_Dictionary>` info **)** |
  31. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`erase<class_EditorSettings_method_erase>` **(** :ref:`String<class_String>` property **)** |
  33. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_favorites<class_EditorSettings_method_get_favorites>` **(** **)** |const| |
  35. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Variant<class_Variant>` | :ref:`get_project_metadata<class_EditorSettings_method_get_project_metadata>` **(** :ref:`String<class_String>` section, :ref:`String<class_String>` key, :ref:`Variant<class_Variant>` default=null **)** |const| |
  37. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`String<class_String>` | :ref:`get_project_settings_dir<class_EditorSettings_method_get_project_settings_dir>` **(** **)** |const| |
  39. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_recent_dirs<class_EditorSettings_method_get_recent_dirs>` **(** **)** |const| |
  41. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Variant<class_Variant>` | :ref:`get_setting<class_EditorSettings_method_get_setting>` **(** :ref:`String<class_String>` name **)** |const| |
  43. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`String<class_String>` | :ref:`get_settings_dir<class_EditorSettings_method_get_settings_dir>` **(** **)** |const| |
  45. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`bool<class_bool>` | :ref:`has_setting<class_EditorSettings_method_has_setting>` **(** :ref:`String<class_String>` name **)** |const| |
  47. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`bool<class_bool>` | :ref:`property_can_revert<class_EditorSettings_method_property_can_revert>` **(** :ref:`String<class_String>` name **)** |
  49. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Variant<class_Variant>` | :ref:`property_get_revert<class_EditorSettings_method_property_get_revert>` **(** :ref:`String<class_String>` name **)** |
  51. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_favorites<class_EditorSettings_method_set_favorites>` **(** :ref:`PoolStringArray<class_PoolStringArray>` dirs **)** |
  53. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_initial_value<class_EditorSettings_method_set_initial_value>` **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value, :ref:`bool<class_bool>` update_current **)** |
  55. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_project_metadata<class_EditorSettings_method_set_project_metadata>` **(** :ref:`String<class_String>` section, :ref:`String<class_String>` key, :ref:`Variant<class_Variant>` data **)** |
  57. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_recent_dirs<class_EditorSettings_method_set_recent_dirs>` **(** :ref:`PoolStringArray<class_PoolStringArray>` dirs **)** |
  59. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_setting<class_EditorSettings_method_set_setting>` **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value **)** |
  61. +-----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. .. rst-class:: classref-section-separator
  63. ----
  64. .. rst-class:: classref-descriptions-group
  65. Signals
  66. -------
  67. .. _class_EditorSettings_signal_settings_changed:
  68. .. rst-class:: classref-signal
  69. **settings_changed** **(** **)**
  70. Emitted after any editor setting has changed.
  71. .. rst-class:: classref-section-separator
  72. ----
  73. .. rst-class:: classref-descriptions-group
  74. Constants
  75. ---------
  76. .. _class_EditorSettings_constant_NOTIFICATION_EDITOR_SETTINGS_CHANGED:
  77. .. rst-class:: classref-constant
  78. **NOTIFICATION_EDITOR_SETTINGS_CHANGED** = ``10000``
  79. Emitted after any editor setting has changed. It's used by various editor plugins to update their visuals on theme changes or logic on configuration changes.
  80. .. rst-class:: classref-section-separator
  81. ----
  82. .. rst-class:: classref-descriptions-group
  83. Method Descriptions
  84. -------------------
  85. .. _class_EditorSettings_method_add_property_info:
  86. .. rst-class:: classref-method
  87. void **add_property_info** **(** :ref:`Dictionary<class_Dictionary>` info **)**
  88. Adds a custom property info to a property. The dictionary must contain:
  89. - ``name``: :ref:`String<class_String>` (the name of the property)
  90. - ``type``: :ref:`int<class_int>` (see :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`)
  91. - optionally ``hint``: :ref:`int<class_int>` (see :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>`) and ``hint_string``: :ref:`String<class_String>`\
  92. \ **Example:**\
  93. ::
  94. editor_settings.set("category/property_name", 0)
  95. var property_info = {
  96. "name": "category/property_name",
  97. "type": TYPE_INT,
  98. "hint": PROPERTY_HINT_ENUM,
  99. "hint_string": "one,two,three"
  100. }
  101. editor_settings.add_property_info(property_info)
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_EditorSettings_method_erase:
  105. .. rst-class:: classref-method
  106. void **erase** **(** :ref:`String<class_String>` property **)**
  107. Erases the setting whose name is specified by ``property``.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_EditorSettings_method_get_favorites:
  111. .. rst-class:: classref-method
  112. :ref:`PoolStringArray<class_PoolStringArray>` **get_favorites** **(** **)** |const|
  113. Returns the list of favorite files and directories for this project.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_EditorSettings_method_get_project_metadata:
  117. .. rst-class:: classref-method
  118. :ref:`Variant<class_Variant>` **get_project_metadata** **(** :ref:`String<class_String>` section, :ref:`String<class_String>` key, :ref:`Variant<class_Variant>` default=null **)** |const|
  119. Returns project-specific metadata for the ``section`` and ``key`` specified. If the metadata doesn't exist, ``default`` will be returned instead. See also :ref:`set_project_metadata<class_EditorSettings_method_set_project_metadata>`.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_EditorSettings_method_get_project_settings_dir:
  123. .. rst-class:: classref-method
  124. :ref:`String<class_String>` **get_project_settings_dir** **(** **)** |const|
  125. Returns the project-specific settings path. Projects all have a unique subdirectory inside the settings path where project-specific settings are saved.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_EditorSettings_method_get_recent_dirs:
  129. .. rst-class:: classref-method
  130. :ref:`PoolStringArray<class_PoolStringArray>` **get_recent_dirs** **(** **)** |const|
  131. Returns the list of recently visited folders in the file dialog for this project.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_EditorSettings_method_get_setting:
  135. .. rst-class:: classref-method
  136. :ref:`Variant<class_Variant>` **get_setting** **(** :ref:`String<class_String>` name **)** |const|
  137. Returns the value of the setting specified by ``name``. This is equivalent to using :ref:`Object.get<class_Object_method_get>` on the EditorSettings instance.
  138. .. rst-class:: classref-item-separator
  139. ----
  140. .. _class_EditorSettings_method_get_settings_dir:
  141. .. rst-class:: classref-method
  142. :ref:`String<class_String>` **get_settings_dir** **(** **)** |const|
  143. Gets the global settings path for the engine. Inside this path, you can find some standard paths such as:
  144. \ ``settings/tmp`` - Used for temporary storage of files
  145. \ ``settings/templates`` - Where export templates are located
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_EditorSettings_method_has_setting:
  149. .. rst-class:: classref-method
  150. :ref:`bool<class_bool>` **has_setting** **(** :ref:`String<class_String>` name **)** |const|
  151. Returns ``true`` if the setting specified by ``name`` exists, ``false`` otherwise.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_EditorSettings_method_property_can_revert:
  155. .. rst-class:: classref-method
  156. :ref:`bool<class_bool>` **property_can_revert** **(** :ref:`String<class_String>` name **)**
  157. Returns ``true`` if the setting specified by ``name`` can have its value reverted to the default value, ``false`` otherwise. When this method returns ``true``, a Revert button will display next to the setting in the Editor Settings.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_EditorSettings_method_property_get_revert:
  161. .. rst-class:: classref-method
  162. :ref:`Variant<class_Variant>` **property_get_revert** **(** :ref:`String<class_String>` name **)**
  163. Returns the default value of the setting specified by ``name``. This is the value that would be applied when clicking the Revert button in the Editor Settings.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_EditorSettings_method_set_favorites:
  167. .. rst-class:: classref-method
  168. void **set_favorites** **(** :ref:`PoolStringArray<class_PoolStringArray>` dirs **)**
  169. Sets the list of favorite files and directories for this project.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_EditorSettings_method_set_initial_value:
  173. .. rst-class:: classref-method
  174. void **set_initial_value** **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value, :ref:`bool<class_bool>` update_current **)**
  175. Sets the initial value of the setting specified by ``name`` to ``value``. This is used to provide a value for the Revert button in the Editor Settings. If ``update_current`` is true, the current value of the setting will be set to ``value`` as well.
  176. .. rst-class:: classref-item-separator
  177. ----
  178. .. _class_EditorSettings_method_set_project_metadata:
  179. .. rst-class:: classref-method
  180. void **set_project_metadata** **(** :ref:`String<class_String>` section, :ref:`String<class_String>` key, :ref:`Variant<class_Variant>` data **)**
  181. Sets project-specific metadata with the ``section``, ``key`` and ``data`` specified. This metadata is stored outside the project folder and therefore won't be checked into version control. See also :ref:`get_project_metadata<class_EditorSettings_method_get_project_metadata>`.
  182. .. rst-class:: classref-item-separator
  183. ----
  184. .. _class_EditorSettings_method_set_recent_dirs:
  185. .. rst-class:: classref-method
  186. void **set_recent_dirs** **(** :ref:`PoolStringArray<class_PoolStringArray>` dirs **)**
  187. Sets the list of recently visited folders in the file dialog for this project.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_EditorSettings_method_set_setting:
  191. .. rst-class:: classref-method
  192. void **set_setting** **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value **)**
  193. Sets the ``value`` of the setting specified by ``name``. This is equivalent to using :ref:`Object.set<class_Object_method_set>` on the EditorSettings instance.
  194. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  195. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  196. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  197. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`