EditorSettings.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorSettings" inherits="Resource" version="3.3">
  3. <brief_description>
  4. Object that holds the project-independent editor settings.
  5. </brief_description>
  6. <description>
  7. Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor &gt; Editor Settings[/b] menu.
  8. Property names use slash delimiters to distinguish sections. Setting values can be of any [Variant] type. It's recommended to use [code]snake_case[/code] for editor settings to be consistent with the Godot editor itself.
  9. Accessing the settings can be done using the following methods, such as:
  10. [codeblock]
  11. # `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
  12. settings.set_setting("some/property",value)
  13. # `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
  14. settings.get_setting("some/property")
  15. var list_of_settings = settings.get_property_list()
  16. [/codeblock]
  17. [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].
  18. </description>
  19. <tutorials>
  20. </tutorials>
  21. <methods>
  22. <method name="add_property_info">
  23. <return type="void">
  24. </return>
  25. <argument index="0" name="info" type="Dictionary">
  26. </argument>
  27. <description>
  28. Adds a custom property info to a property. The dictionary must contain:
  29. - [code]name[/code]: [String] (the name of the property)
  30. - [code]type[/code]: [int] (see [enum Variant.Type])
  31. - optionally [code]hint[/code]: [int] (see [enum PropertyHint]) and [code]hint_string[/code]: [String]
  32. [b]Example:[/b]
  33. [codeblock]
  34. editor_settings.set("category/property_name", 0)
  35. var property_info = {
  36. "name": "category/property_name",
  37. "type": TYPE_INT,
  38. "hint": PROPERTY_HINT_ENUM,
  39. "hint_string": "one,two,three"
  40. }
  41. editor_settings.add_property_info(property_info)
  42. [/codeblock]
  43. </description>
  44. </method>
  45. <method name="erase">
  46. <return type="void">
  47. </return>
  48. <argument index="0" name="property" type="String">
  49. </argument>
  50. <description>
  51. Erases the setting whose name is specified by [code]property[/code].
  52. </description>
  53. </method>
  54. <method name="get_favorites" qualifiers="const">
  55. <return type="PoolStringArray">
  56. </return>
  57. <description>
  58. Returns the list of favorite files and directories for this project.
  59. </description>
  60. </method>
  61. <method name="get_project_metadata" qualifiers="const">
  62. <return type="Variant">
  63. </return>
  64. <argument index="0" name="section" type="String">
  65. </argument>
  66. <argument index="1" name="key" type="String">
  67. </argument>
  68. <argument index="2" name="default" type="Variant" default="null">
  69. </argument>
  70. <description>
  71. Returns project-specific metadata for the [code]section[/code] and [code]key[/code] specified. If the metadata doesn't exist, [code]default[/code] will be returned instead. See also [method set_project_metadata].
  72. </description>
  73. </method>
  74. <method name="get_project_settings_dir" qualifiers="const">
  75. <return type="String">
  76. </return>
  77. <description>
  78. Returns the project-specific settings path. Projects all have a unique subdirectory inside the settings path where project-specific settings are saved.
  79. </description>
  80. </method>
  81. <method name="get_recent_dirs" qualifiers="const">
  82. <return type="PoolStringArray">
  83. </return>
  84. <description>
  85. Returns the list of recently visited folders in the file dialog for this project.
  86. </description>
  87. </method>
  88. <method name="get_setting" qualifiers="const">
  89. <return type="Variant">
  90. </return>
  91. <argument index="0" name="name" type="String">
  92. </argument>
  93. <description>
  94. Returns the value of the setting specified by [code]name[/code]. This is equivalent to using [method Object.get] on the EditorSettings instance.
  95. </description>
  96. </method>
  97. <method name="get_settings_dir" qualifiers="const">
  98. <return type="String">
  99. </return>
  100. <description>
  101. Gets the global settings path for the engine. Inside this path, you can find some standard paths such as:
  102. [code]settings/tmp[/code] - Used for temporary storage of files
  103. [code]settings/templates[/code] - Where export templates are located
  104. </description>
  105. </method>
  106. <method name="has_setting" qualifiers="const">
  107. <return type="bool">
  108. </return>
  109. <argument index="0" name="name" type="String">
  110. </argument>
  111. <description>
  112. Returns [code]true[/code] if the setting specified by [code]name[/code] exists, [code]false[/code] otherwise.
  113. </description>
  114. </method>
  115. <method name="property_can_revert">
  116. <return type="bool">
  117. </return>
  118. <argument index="0" name="name" type="String">
  119. </argument>
  120. <description>
  121. Returns [code]true[/code] if the setting specified by [code]name[/code] can have its value reverted to the default value, [code]false[/code] otherwise. When this method returns [code]true[/code], a Revert button will display next to the setting in the Editor Settings.
  122. </description>
  123. </method>
  124. <method name="property_get_revert">
  125. <return type="Variant">
  126. </return>
  127. <argument index="0" name="name" type="String">
  128. </argument>
  129. <description>
  130. Returns the default value of the setting specified by [code]name[/code]. This is the value that would be applied when clicking the Revert button in the Editor Settings.
  131. </description>
  132. </method>
  133. <method name="set_favorites">
  134. <return type="void">
  135. </return>
  136. <argument index="0" name="dirs" type="PoolStringArray">
  137. </argument>
  138. <description>
  139. Sets the list of favorite files and directories for this project.
  140. </description>
  141. </method>
  142. <method name="set_initial_value">
  143. <return type="void">
  144. </return>
  145. <argument index="0" name="name" type="String">
  146. </argument>
  147. <argument index="1" name="value" type="Variant">
  148. </argument>
  149. <argument index="2" name="update_current" type="bool">
  150. </argument>
  151. <description>
  152. Sets the initial value of the setting specified by [code]name[/code] to [code]value[/code]. This is used to provide a value for the Revert button in the Editor Settings. If [code]update_current[/code] is true, the current value of the setting will be set to [code]value[/code] as well.
  153. </description>
  154. </method>
  155. <method name="set_project_metadata">
  156. <return type="void">
  157. </return>
  158. <argument index="0" name="section" type="String">
  159. </argument>
  160. <argument index="1" name="key" type="String">
  161. </argument>
  162. <argument index="2" name="data" type="Variant">
  163. </argument>
  164. <description>
  165. Sets project-specific metadata with the [code]section[/code], [code]key[/code] and [code]data[/code] specified. This metadata is stored outside the project folder and therefore won't be checked into version control. See also [method get_project_metadata].
  166. </description>
  167. </method>
  168. <method name="set_recent_dirs">
  169. <return type="void">
  170. </return>
  171. <argument index="0" name="dirs" type="PoolStringArray">
  172. </argument>
  173. <description>
  174. Sets the list of recently visited folders in the file dialog for this project.
  175. </description>
  176. </method>
  177. <method name="set_setting">
  178. <return type="void">
  179. </return>
  180. <argument index="0" name="name" type="String">
  181. </argument>
  182. <argument index="1" name="value" type="Variant">
  183. </argument>
  184. <description>
  185. Sets the [code]value[/code] of the setting specified by [code]name[/code]. This is equivalent to using [method Object.set] on the EditorSettings instance.
  186. </description>
  187. </method>
  188. </methods>
  189. <signals>
  190. <signal name="settings_changed">
  191. <description>
  192. Emitted after any editor setting has changed.
  193. </description>
  194. </signal>
  195. </signals>
  196. <constants>
  197. <constant name="NOTIFICATION_EDITOR_SETTINGS_CHANGED" value="10000">
  198. 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.
  199. </constant>
  200. </constants>
  201. </class>