EditorSettings.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorSettings" inherits="Resource" version="4.0">
  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. [codeblocks]
  11. [gdscript]
  12. var settings = EditorInterface.get_editor_settings()
  13. # `settings.set("some/property", 10)` also works as this class overrides `_set()` internally.
  14. settings.set_setting("some/property", 10)
  15. # `settings.get("some/property")` also works as this class overrides `_get()` internally.
  16. settings.get_setting("some/property")
  17. var list_of_settings = settings.get_property_list()
  18. [/gdscript]
  19. [csharp]
  20. EditorSettings settings = GetEditorInterface().GetEditorSettings();
  21. // `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
  22. settings.SetSetting("some/property", Value);
  23. // `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
  24. settings.GetSetting("some/property");
  25. Godot.Collections.Array listOfSettings = settings.GetPropertyList();
  26. [/csharp]
  27. [/codeblocks]
  28. [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].
  29. </description>
  30. <tutorials>
  31. </tutorials>
  32. <methods>
  33. <method name="add_property_info">
  34. <return type="void" />
  35. <argument index="0" name="info" type="Dictionary" />
  36. <description>
  37. Adds a custom property info to a property. The dictionary must contain:
  38. - [code]name[/code]: [String] (the name of the property)
  39. - [code]type[/code]: [int] (see [enum Variant.Type])
  40. - optionally [code]hint[/code]: [int] (see [enum PropertyHint]) and [code]hint_string[/code]: [String]
  41. [b]Example:[/b]
  42. [codeblocks]
  43. [gdscript]
  44. var settings = EditorInterface.get_editor_settings()
  45. settings.set("category/property_name", 0)
  46. var property_info = {
  47. "name": "category/property_name",
  48. "type": TYPE_INT,
  49. "hint": PROPERTY_HINT_ENUM,
  50. "hint_string": "one,two,three"
  51. }
  52. settings.add_property_info(property_info)
  53. [/gdscript]
  54. [csharp]
  55. var settings = GetEditorInterface().GetEditorSettings();
  56. settings.Set("category/property_name", 0);
  57. var propertyInfo = new Godot.Collections.Dictionary
  58. {
  59. {"name", "category/propertyName"},
  60. {"type", Variant.Type.Int},
  61. {"hint", PropertyHint.Enum},
  62. {"hint_string", "one,two,three"}
  63. };
  64. settings.AddPropertyInfo(propertyInfo);
  65. [/csharp]
  66. [/codeblocks]
  67. </description>
  68. </method>
  69. <method name="erase">
  70. <return type="void" />
  71. <argument index="0" name="property" type="String" />
  72. <description>
  73. Erases the setting whose name is specified by [code]property[/code].
  74. </description>
  75. </method>
  76. <method name="get_favorites" qualifiers="const">
  77. <return type="PackedStringArray" />
  78. <description>
  79. Returns the list of favorite files and directories for this project.
  80. </description>
  81. </method>
  82. <method name="get_project_metadata" qualifiers="const">
  83. <return type="Variant" />
  84. <argument index="0" name="section" type="String" />
  85. <argument index="1" name="key" type="String" />
  86. <argument index="2" name="default" type="Variant" default="null" />
  87. <description>
  88. 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].
  89. </description>
  90. </method>
  91. <method name="get_project_settings_dir" qualifiers="const">
  92. <return type="String" />
  93. <description>
  94. Returns the project-specific settings path. Projects all have a unique subdirectory inside the settings path where project-specific settings are saved.
  95. </description>
  96. </method>
  97. <method name="get_recent_dirs" qualifiers="const">
  98. <return type="PackedStringArray" />
  99. <description>
  100. Returns the list of recently visited folders in the file dialog for this project.
  101. </description>
  102. </method>
  103. <method name="get_setting" qualifiers="const">
  104. <return type="Variant" />
  105. <argument index="0" name="name" type="String" />
  106. <description>
  107. Returns the value of the setting specified by [code]name[/code]. This is equivalent to using [method Object.get] on the EditorSettings instance.
  108. </description>
  109. </method>
  110. <method name="has_setting" qualifiers="const">
  111. <return type="bool" />
  112. <argument index="0" name="name" type="String" />
  113. <description>
  114. Returns [code]true[/code] if the setting specified by [code]name[/code] exists, [code]false[/code] otherwise.
  115. </description>
  116. </method>
  117. <method name="property_can_revert">
  118. <return type="bool" />
  119. <argument index="0" name="name" type="String" />
  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. <argument index="0" name="name" type="String" />
  127. <description>
  128. 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.
  129. </description>
  130. </method>
  131. <method name="set_builtin_action_override">
  132. <return type="void" />
  133. <argument index="0" name="name" type="String" />
  134. <argument index="1" name="actions_list" type="Array" />
  135. <description>
  136. </description>
  137. </method>
  138. <method name="set_favorites">
  139. <return type="void" />
  140. <argument index="0" name="dirs" type="PackedStringArray" />
  141. <description>
  142. Sets the list of favorite files and directories for this project.
  143. </description>
  144. </method>
  145. <method name="set_initial_value">
  146. <return type="void" />
  147. <argument index="0" name="name" type="StringName" />
  148. <argument index="1" name="value" type="Variant" />
  149. <argument index="2" name="update_current" type="bool" />
  150. <description>
  151. 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.
  152. </description>
  153. </method>
  154. <method name="set_project_metadata">
  155. <return type="void" />
  156. <argument index="0" name="section" type="String" />
  157. <argument index="1" name="key" type="String" />
  158. <argument index="2" name="data" type="Variant" />
  159. <description>
  160. 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].
  161. </description>
  162. </method>
  163. <method name="set_recent_dirs">
  164. <return type="void" />
  165. <argument index="0" name="dirs" type="PackedStringArray" />
  166. <description>
  167. Sets the list of recently visited folders in the file dialog for this project.
  168. </description>
  169. </method>
  170. <method name="set_setting">
  171. <return type="void" />
  172. <argument index="0" name="name" type="String" />
  173. <argument index="1" name="value" type="Variant" />
  174. <description>
  175. 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.
  176. </description>
  177. </method>
  178. </methods>
  179. <signals>
  180. <signal name="settings_changed">
  181. <description>
  182. Emitted after any editor setting has changed.
  183. </description>
  184. </signal>
  185. </signals>
  186. <constants>
  187. <constant name="NOTIFICATION_EDITOR_SETTINGS_CHANGED" value="10000">
  188. 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.
  189. </constant>
  190. </constants>
  191. </class>