class_editorsettings.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the EditorSettings.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_EditorSettings:
  6. EditorSettings
  7. ==============
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. Object that holds the project-independent editor settings.
  10. Description
  11. -----------
  12. Object that holds the project-independent editor settings. These settings are generally visible in the **Editor > Editor Settings** menu.
  13. Accessing the settings is done by using the regular :ref:`Object<class_Object>` API, such as:
  14. ::
  15. settings.set(prop,value)
  16. settings.get(prop)
  17. list_of_settings = settings.get_property_list()
  18. Methods
  19. -------
  20. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`add_property_info<class_EditorSettings_method_add_property_info>` **(** :ref:`Dictionary<class_Dictionary>` info **)** |
  22. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`erase<class_EditorSettings_method_erase>` **(** :ref:`String<class_String>` property **)** |
  24. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_favorites<class_EditorSettings_method_get_favorites>` **(** **)** const |
  26. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :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 |
  28. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_String>` | :ref:`get_project_settings_dir<class_EditorSettings_method_get_project_settings_dir>` **(** **)** const |
  30. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_recent_dirs<class_EditorSettings_method_get_recent_dirs>` **(** **)** const |
  32. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Variant<class_Variant>` | :ref:`get_setting<class_EditorSettings_method_get_setting>` **(** :ref:`String<class_String>` name **)** const |
  34. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`String<class_String>` | :ref:`get_settings_dir<class_EditorSettings_method_get_settings_dir>` **(** **)** const |
  36. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`has_setting<class_EditorSettings_method_has_setting>` **(** :ref:`String<class_String>` name **)** const |
  38. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`property_can_revert<class_EditorSettings_method_property_can_revert>` **(** :ref:`String<class_String>` name **)** |
  40. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Variant<class_Variant>` | :ref:`property_get_revert<class_EditorSettings_method_property_get_revert>` **(** :ref:`String<class_String>` name **)** |
  42. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_favorites<class_EditorSettings_method_set_favorites>` **(** :ref:`PackedStringArray<class_PackedStringArray>` dirs **)** |
  44. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`set_initial_value<class_EditorSettings_method_set_initial_value>` **(** :ref:`StringName<class_StringName>` name, :ref:`Variant<class_Variant>` value, :ref:`bool<class_bool>` update_current **)** |
  46. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | 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 **)** |
  48. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`set_recent_dirs<class_EditorSettings_method_set_recent_dirs>` **(** :ref:`PackedStringArray<class_PackedStringArray>` dirs **)** |
  50. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`set_setting<class_EditorSettings_method_set_setting>` **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value **)** |
  52. +---------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. Signals
  54. -------
  55. .. _class_EditorSettings_signal_settings_changed:
  56. - **settings_changed** **(** **)**
  57. Emitted when editor settings change.
  58. Constants
  59. ---------
  60. .. _class_EditorSettings_constant_NOTIFICATION_EDITOR_SETTINGS_CHANGED:
  61. - **NOTIFICATION_EDITOR_SETTINGS_CHANGED** = **10000** --- Emitted when editor settings change. It used by various editor plugins to update their visuals on theme changes or logic on configuration changes.
  62. Method Descriptions
  63. -------------------
  64. .. _class_EditorSettings_method_add_property_info:
  65. - void **add_property_info** **(** :ref:`Dictionary<class_Dictionary>` info **)**
  66. Adds a custom property info to a property. The dictionary must contain:
  67. - ``name``: :ref:`String<class_String>` (the name of the property)
  68. - ``type``: :ref:`int<class_int>` (see :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`)
  69. - optionally ``hint``: :ref:`int<class_int>` (see :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>`) and ``hint_string``: :ref:`String<class_String>`
  70. **Example:**
  71. ::
  72. editor_settings.set("category/property_name", 0)
  73. var property_info = {
  74. "name": "category/property_name",
  75. "type": TYPE_INT,
  76. "hint": PROPERTY_HINT_ENUM,
  77. "hint_string": "one,two,three"
  78. }
  79. editor_settings.add_property_info(property_info)
  80. ----
  81. .. _class_EditorSettings_method_erase:
  82. - void **erase** **(** :ref:`String<class_String>` property **)**
  83. Erase a given setting (pass full property path).
  84. ----
  85. .. _class_EditorSettings_method_get_favorites:
  86. - :ref:`PackedStringArray<class_PackedStringArray>` **get_favorites** **(** **)** const
  87. Gets the list of favorite files and directories for this project.
  88. ----
  89. .. _class_EditorSettings_method_get_project_metadata:
  90. - :ref:`Variant<class_Variant>` **get_project_metadata** **(** :ref:`String<class_String>` section, :ref:`String<class_String>` key, :ref:`Variant<class_Variant>` default=null **)** const
  91. ----
  92. .. _class_EditorSettings_method_get_project_settings_dir:
  93. - :ref:`String<class_String>` **get_project_settings_dir** **(** **)** const
  94. Gets the specific project settings path. Projects all have a unique sub-directory inside the settings path where project specific settings are saved.
  95. ----
  96. .. _class_EditorSettings_method_get_recent_dirs:
  97. - :ref:`PackedStringArray<class_PackedStringArray>` **get_recent_dirs** **(** **)** const
  98. Gets the list of recently visited folders in the file dialog for this project.
  99. ----
  100. .. _class_EditorSettings_method_get_setting:
  101. - :ref:`Variant<class_Variant>` **get_setting** **(** :ref:`String<class_String>` name **)** const
  102. ----
  103. .. _class_EditorSettings_method_get_settings_dir:
  104. - :ref:`String<class_String>` **get_settings_dir** **(** **)** const
  105. Gets the global settings path for the engine. Inside this path, you can find some standard paths such as:
  106. ``settings/tmp`` - Used for temporary storage of files
  107. ``settings/templates`` - Where export templates are located
  108. ----
  109. .. _class_EditorSettings_method_has_setting:
  110. - :ref:`bool<class_bool>` **has_setting** **(** :ref:`String<class_String>` name **)** const
  111. ----
  112. .. _class_EditorSettings_method_property_can_revert:
  113. - :ref:`bool<class_bool>` **property_can_revert** **(** :ref:`String<class_String>` name **)**
  114. ----
  115. .. _class_EditorSettings_method_property_get_revert:
  116. - :ref:`Variant<class_Variant>` **property_get_revert** **(** :ref:`String<class_String>` name **)**
  117. ----
  118. .. _class_EditorSettings_method_set_favorites:
  119. - void **set_favorites** **(** :ref:`PackedStringArray<class_PackedStringArray>` dirs **)**
  120. Sets the list of favorite files and directories for this project.
  121. ----
  122. .. _class_EditorSettings_method_set_initial_value:
  123. - void **set_initial_value** **(** :ref:`StringName<class_StringName>` name, :ref:`Variant<class_Variant>` value, :ref:`bool<class_bool>` update_current **)**
  124. ----
  125. .. _class_EditorSettings_method_set_project_metadata:
  126. - void **set_project_metadata** **(** :ref:`String<class_String>` section, :ref:`String<class_String>` key, :ref:`Variant<class_Variant>` data **)**
  127. ----
  128. .. _class_EditorSettings_method_set_recent_dirs:
  129. - void **set_recent_dirs** **(** :ref:`PackedStringArray<class_PackedStringArray>` dirs **)**
  130. Sets the list of recently visited folders in the file dialog for this project.
  131. ----
  132. .. _class_EditorSettings_method_set_setting:
  133. - void **set_setting** **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value **)**