You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/classes/EditorSettings.xml
+62Lines changed: 62 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,33 @@
70
70
[/codeblocks]
71
71
</description>
72
72
</method>
73
+
<methodname="add_shortcut">
74
+
<returntype="void" />
75
+
<paramindex="0"name="path"type="String" />
76
+
<paramindex="1"name="shortcut"type="Shortcut" />
77
+
<description>
78
+
Adds a [param shortcut] whose path is specified by [param path].
79
+
The [param path] determines how the shortcut is organized and displayed in the editor's shortcut settings. The path format affects the display as follows:
80
+
- [code]"name"[/code] (no slash): Creates a category named [code]name[/code] with the shortcut displayed as [code]name[/code].
81
+
- [code]"category/name"[/code] (single slash): Displays as [code]name[/code] in the [code]category[/code] section.
82
+
- [code]"category/name/extra"[/code] (multiple slashes): Extra path components are ignored, so this behaves the same as [code]"category/name"[/code].
83
+
[b]Note:[/b] Shortcuts are only saved to the editor settings if they differ from their original/default state. This means empty shortcuts that were originally empty will not persist between editor sessions and must be re-added. If a shortcut with the same [param path] already exists, this method will update it with the new [param shortcut] instead of creating a duplicate.
84
+
[codeblock]
85
+
# Add a custom shortcut for a plugin action.
86
+
var my_shortcut = Shortcut.new()
87
+
var input_event = InputEventKey.new()
88
+
input_event.keycode = KEY_F5
89
+
input_event.ctrl_pressed = true
90
+
my_shortcut.events.append(input_event)
91
+
92
+
# This will appear under the "My Plugin" category as "Reload Data".
Returns the value of the setting specified by [param name]. This is equivalent to using [method Object.get] on the EditorSettings instance.
119
146
</description>
120
147
</method>
148
+
<methodname="get_shortcut"qualifiers="const">
149
+
<returntype="Shortcut" />
150
+
<paramindex="0"name="path"type="String" />
151
+
<description>
152
+
Returns the shortcut specified by [param path]. Tries to find a built-in action if no shortcut with the provided path is found in the shortcut list. If found, adds it to the list and returns it, otherwise returns [code]null[/code].
153
+
</description>
154
+
</method>
155
+
<methodname="get_shortcut_list">
156
+
<returntype="PackedStringArray" />
157
+
<description>
158
+
Returns the list of stored shortcut paths.
159
+
</description>
160
+
</method>
121
161
<methodname="has_setting"qualifiers="const">
122
162
<returntype="bool" />
123
163
<paramindex="0"name="name"type="String" />
124
164
<description>
125
165
Returns [code]true[/code] if the setting specified by [param name] exists, [code]false[/code] otherwise.
126
166
</description>
127
167
</method>
168
+
<methodname="has_shortcut"qualifiers="const">
169
+
<returntype="bool" />
170
+
<paramindex="0"name="path"type="String" />
171
+
<description>
172
+
Returns [code]true[/code] if the shortcut specified by [param path] exists, [code]false[/code] otherwise.
173
+
</description>
174
+
</method>
175
+
<methodname="is_shortcut"qualifiers="const">
176
+
<returntype="bool" />
177
+
<paramindex="0"name="path"type="String" />
178
+
<paramindex="1"name="event"type="InputEvent" />
179
+
<description>
180
+
Returns [code]true[/code] if the shortcut specified by [param path] matches the event specified by [param event], [code]false[/code] otherwise.
181
+
</description>
182
+
</method>
128
183
<methodname="mark_setting_changed">
129
184
<returntype="void" />
130
185
<paramindex="0"name="setting"type="String" />
131
186
<description>
132
187
Marks the passed editor setting as being changed, see [method get_changed_settings]. Only settings which exist (see [method has_setting]) will be accepted.
0 commit comments