Complete the EditorSettings class documentation

EditorSettings is now 100% documented.

(cherry picked from commit 708a0a43fb)
This commit is contained in:
Hugo Locurcio 2020-07-17 11:34:18 +02:00 committed by Rémi Verschelde
parent 7e9a51cdd5
commit 52a33a8066
1 changed files with 23 additions and 10 deletions

View File

@ -5,11 +5,16 @@
</brief_description> </brief_description>
<description> <description>
Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor &gt; Editor Settings[/b] menu. Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor &gt; Editor Settings[/b] menu.
Accessing the settings is done by using the regular [Object] API, such as: 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.
Accessing the settings can be done using the following methods, such as:
[codeblock] [codeblock]
settings.set(prop,value) # `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
settings.get(prop) settings.set_setting("some/property",value)
list_of_settings = settings.get_property_list()
# `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
settings.get_setting("some/property")
var list_of_settings = settings.get_property_list()
[/codeblock] [/codeblock]
[b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings]. [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].
</description> </description>
@ -47,14 +52,14 @@
<argument index="0" name="property" type="String"> <argument index="0" name="property" type="String">
</argument> </argument>
<description> <description>
Erase a given setting (pass full property path). Erases the setting whose name is specified by [code]property[/code].
</description> </description>
</method> </method>
<method name="get_favorites" qualifiers="const"> <method name="get_favorites" qualifiers="const">
<return type="PoolStringArray"> <return type="PoolStringArray">
</return> </return>
<description> <description>
Gets the list of favorite files and directories for this project. Returns the list of favorite files and directories for this project.
</description> </description>
</method> </method>
<method name="get_project_metadata" qualifiers="const"> <method name="get_project_metadata" qualifiers="const">
@ -67,20 +72,21 @@
<argument index="2" name="default" type="Variant" default="null"> <argument index="2" name="default" type="Variant" default="null">
</argument> </argument>
<description> <description>
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].
</description> </description>
</method> </method>
<method name="get_project_settings_dir" qualifiers="const"> <method name="get_project_settings_dir" qualifiers="const">
<return type="String"> <return type="String">
</return> </return>
<description> <description>
Gets the specific project settings path. Projects all have a unique sub-directory inside the settings path where project specific settings are saved. Returns the project-specific settings path. Projects all have a unique subdirectory inside the settings path where project-specific settings are saved.
</description> </description>
</method> </method>
<method name="get_recent_dirs" qualifiers="const"> <method name="get_recent_dirs" qualifiers="const">
<return type="PoolStringArray"> <return type="PoolStringArray">
</return> </return>
<description> <description>
Gets the list of recently visited folders in the file dialog for this project. Returns the list of recently visited folders in the file dialog for this project.
</description> </description>
</method> </method>
<method name="get_setting" qualifiers="const"> <method name="get_setting" qualifiers="const">
@ -89,6 +95,7 @@
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
Returns the value of the setting specified by [code]name[/code]. This is equivalent to using [method Object.get] on the EditorSettings instance.
</description> </description>
</method> </method>
<method name="get_settings_dir" qualifiers="const"> <method name="get_settings_dir" qualifiers="const">
@ -106,6 +113,7 @@
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
Returns [code]true[/code] if the setting specified by [code]name[/code] exists, [code]false[/code] otherwise.
</description> </description>
</method> </method>
<method name="property_can_revert"> <method name="property_can_revert">
@ -114,6 +122,7 @@
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
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.
</description> </description>
</method> </method>
<method name="property_get_revert"> <method name="property_get_revert">
@ -122,6 +131,7 @@
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
</argument> </argument>
<description> <description>
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.
</description> </description>
</method> </method>
<method name="set_favorites"> <method name="set_favorites">
@ -143,6 +153,7 @@
<argument index="2" name="update_current" type="bool"> <argument index="2" name="update_current" type="bool">
</argument> </argument>
<description> <description>
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.
</description> </description>
</method> </method>
<method name="set_project_metadata"> <method name="set_project_metadata">
@ -155,6 +166,7 @@
<argument index="2" name="data" type="Variant"> <argument index="2" name="data" type="Variant">
</argument> </argument>
<description> <description>
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].
</description> </description>
</method> </method>
<method name="set_recent_dirs"> <method name="set_recent_dirs">
@ -174,19 +186,20 @@
<argument index="1" name="value" type="Variant"> <argument index="1" name="value" type="Variant">
</argument> </argument>
<description> <description>
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.
</description> </description>
</method> </method>
</methods> </methods>
<signals> <signals>
<signal name="settings_changed"> <signal name="settings_changed">
<description> <description>
Emitted when editor settings change. Emitted after any editor setting has changed.
</description> </description>
</signal> </signal>
</signals> </signals>
<constants> <constants>
<constant name="NOTIFICATION_EDITOR_SETTINGS_CHANGED" value="10000"> <constant name="NOTIFICATION_EDITOR_SETTINGS_CHANGED" value="10000">
Emitted when editor settings change. It used by various editor plugins to update their visuals on theme changes or logic on configuration changes. 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.
</constant> </constant>
</constants> </constants>
</class> </class>