summaryrefslogtreecommitdiff
path: root/doc/classes/EditorSettings.xml
blob: ad63abafa650681867bf725de36374b4a6ac0335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorSettings" inherits="Resource" version="4.0">
	<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 &gt; 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="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_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_project_settings_dir" qualifiers="const">
			<return type="String" />
			<description>
				Returns the project-specific settings path. Projects all have a unique subdirectory inside the settings path where project-specific settings are saved.
			</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="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>