210 lines
9.2 KiB
XML
210 lines
9.2 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="EditorSettings" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
Object that holds the project-independent editor settings.
|
|
</brief_description>
|
|
<description>
|
|
Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor > Editor Settings[/b] menu.
|
|
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:
|
|
[codeblocks]
|
|
[gdscript]
|
|
var settings = EditorInterface.get_editor_settings()
|
|
# `settings.set("some/property", 10)` also works as this class overrides `_set()` internally.
|
|
settings.set_setting("some/property", 10)
|
|
# `settings.get("some/property")` also works as this class overrides `_get()` internally.
|
|
settings.get_setting("some/property")
|
|
var list_of_settings = settings.get_property_list()
|
|
[/gdscript]
|
|
[csharp]
|
|
EditorSettings settings = GetEditorInterface().GetEditorSettings();
|
|
// `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
|
|
settings.SetSetting("some/property", Value);
|
|
// `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
|
|
settings.GetSetting("some/property");
|
|
Godot.Collections.Array listOfSettings = settings.GetPropertyList();
|
|
[/csharp]
|
|
[/codeblocks]
|
|
[b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="add_property_info">
|
|
<return type="void" />
|
|
<argument index="0" name="info" type="Dictionary" />
|
|
<description>
|
|
Adds a custom property info to a property. The dictionary must contain:
|
|
- [code]name[/code]: [String] (the name of the property)
|
|
- [code]type[/code]: [int] (see [enum Variant.Type])
|
|
- optionally [code]hint[/code]: [int] (see [enum PropertyHint]) and [code]hint_string[/code]: [String]
|
|
[b]Example:[/b]
|
|
[codeblocks]
|
|
[gdscript]
|
|
var settings = EditorInterface.get_editor_settings()
|
|
settings.set("category/property_name", 0)
|
|
|
|
var property_info = {
|
|
"name": "category/property_name",
|
|
"type": TYPE_INT,
|
|
"hint": PROPERTY_HINT_ENUM,
|
|
"hint_string": "one,two,three"
|
|
}
|
|
|
|
settings.add_property_info(property_info)
|
|
[/gdscript]
|
|
[csharp]
|
|
var settings = GetEditorInterface().GetEditorSettings();
|
|
settings.Set("category/property_name", 0);
|
|
|
|
var propertyInfo = new Godot.Collections.Dictionary
|
|
{
|
|
{"name", "category/propertyName"},
|
|
{"type", Variant.Type.Int},
|
|
{"hint", PropertyHint.Enum},
|
|
{"hint_string", "one,two,three"}
|
|
};
|
|
|
|
settings.AddPropertyInfo(propertyInfo);
|
|
[/csharp]
|
|
[/codeblocks]
|
|
</description>
|
|
</method>
|
|
<method name="check_changed_settings_in_group" qualifiers="const">
|
|
<return type="bool" />
|
|
<argument index="0" name="setting_prefix" type="String" />
|
|
<description>
|
|
Checks if any settings with the prefix [code]setting_prefix[/code] exist in the set of changed settings. See also [method get_changed_settings].
|
|
</description>
|
|
</method>
|
|
<method name="erase">
|
|
<return type="void" />
|
|
<argument index="0" name="property" type="String" />
|
|
<description>
|
|
Erases the setting whose name is specified by [code]property[/code].
|
|
</description>
|
|
</method>
|
|
<method name="get_changed_settings" qualifiers="const">
|
|
<return type="Array" />
|
|
<description>
|
|
Gets an array of the settings which have been changed since the last save. Note that internally [code]changed_settings[/code] is cleared after a successful save, so generally the most appropriate place to use this method is when processing [constant NOTIFICATION_EDITOR_SETTINGS_CHANGED]
|
|
</description>
|
|
</method>
|
|
<method name="get_favorites" qualifiers="const">
|
|
<return type="PackedStringArray" />
|
|
<description>
|
|
Returns the list of favorite files and directories for this project.
|
|
</description>
|
|
</method>
|
|
<method name="get_project_metadata" qualifiers="const">
|
|
<return type="Variant" />
|
|
<argument index="0" name="section" type="String" />
|
|
<argument index="1" name="key" type="String" />
|
|
<argument index="2" name="default" type="Variant" default="null" />
|
|
<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>
|
|
</method>
|
|
<method name="get_recent_dirs" qualifiers="const">
|
|
<return type="PackedStringArray" />
|
|
<description>
|
|
Returns the list of recently visited folders in the file dialog for this project.
|
|
</description>
|
|
</method>
|
|
<method name="get_setting" qualifiers="const">
|
|
<return type="Variant" />
|
|
<argument index="0" name="name" type="String" />
|
|
<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>
|
|
</method>
|
|
<method name="has_setting" qualifiers="const">
|
|
<return type="bool" />
|
|
<argument index="0" name="name" type="String" />
|
|
<description>
|
|
Returns [code]true[/code] if the setting specified by [code]name[/code] exists, [code]false[/code] otherwise.
|
|
</description>
|
|
</method>
|
|
<method name="mark_setting_changed">
|
|
<return type="void" />
|
|
<argument index="0" name="setting" type="String" />
|
|
<description>
|
|
Marks the passed editor setting as being changed, see [method get_changed_settings]. Only settings which exist (see [method has_setting]) will be accepted.
|
|
</description>
|
|
</method>
|
|
<method name="property_can_revert">
|
|
<return type="bool" />
|
|
<argument index="0" name="name" type="String" />
|
|
<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>
|
|
</method>
|
|
<method name="property_get_revert">
|
|
<return type="Variant" />
|
|
<argument index="0" name="name" type="String" />
|
|
<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>
|
|
</method>
|
|
<method name="set_builtin_action_override">
|
|
<return type="void" />
|
|
<argument index="0" name="name" type="String" />
|
|
<argument index="1" name="actions_list" type="Array" />
|
|
<description>
|
|
</description>
|
|
</method>
|
|
<method name="set_favorites">
|
|
<return type="void" />
|
|
<argument index="0" name="dirs" type="PackedStringArray" />
|
|
<description>
|
|
Sets the list of favorite files and directories for this project.
|
|
</description>
|
|
</method>
|
|
<method name="set_initial_value">
|
|
<return type="void" />
|
|
<argument index="0" name="name" type="StringName" />
|
|
<argument index="1" name="value" type="Variant" />
|
|
<argument index="2" name="update_current" type="bool" />
|
|
<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>
|
|
</method>
|
|
<method name="set_project_metadata">
|
|
<return type="void" />
|
|
<argument index="0" name="section" type="String" />
|
|
<argument index="1" name="key" type="String" />
|
|
<argument index="2" name="data" type="Variant" />
|
|
<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>
|
|
</method>
|
|
<method name="set_recent_dirs">
|
|
<return type="void" />
|
|
<argument index="0" name="dirs" type="PackedStringArray" />
|
|
<description>
|
|
Sets the list of recently visited folders in the file dialog for this project.
|
|
</description>
|
|
</method>
|
|
<method name="set_setting">
|
|
<return type="void" />
|
|
<argument index="0" name="name" type="String" />
|
|
<argument index="1" name="value" type="Variant" />
|
|
<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>
|
|
</method>
|
|
</methods>
|
|
<signals>
|
|
<signal name="settings_changed">
|
|
<description>
|
|
Emitted after any editor setting has changed.
|
|
</description>
|
|
</signal>
|
|
</signals>
|
|
<constants>
|
|
<constant name="NOTIFICATION_EDITOR_SETTINGS_CHANGED" value="10000">
|
|
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>
|
|
</constants>
|
|
</class>
|