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
@@ -69,6 +69,33 @@
69
69
[/codeblocks]
70
70
</description>
71
71
</method>
72
+
<methodname="add_shortcut">
73
+
<returntype="void" />
74
+
<paramindex="0"name="path"type="String" />
75
+
<paramindex="1"name="shortcut"type="Shortcut" />
76
+
<description>
77
+
Adds a [param shortcut] whose path is specified by [param path].
78
+
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:
79
+
- [code]"name"[/code] (no slash): Creates a category named [code]name[/code] with the shortcut displayed as [code]name[/code].
80
+
- [code]"category/name"[/code] (single slash): Displays as [code]name[/code] in the [code]category[/code] section.
81
+
- [code]"category/name/extra"[/code] (multiple slashes): Extra path components are ignored, so this behaves the same as [code]"category/name"[/code].
82
+
[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.
83
+
[codeblock]
84
+
# Add a custom shortcut for a plugin action.
85
+
var my_shortcut = Shortcut.new()
86
+
var input_event = InputEventKey.new()
87
+
input_event.keycode = KEY_F5
88
+
input_event.ctrl_pressed = true
89
+
my_shortcut.events.append(input_event)
90
+
91
+
# 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.
118
145
</description>
119
146
</method>
147
+
<methodname="get_shortcut"qualifiers="const">
148
+
<returntype="Shortcut" />
149
+
<paramindex="0"name="path"type="String" />
150
+
<description>
151
+
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].
152
+
</description>
153
+
</method>
154
+
<methodname="get_shortcut_list">
155
+
<returntype="PackedStringArray" />
156
+
<description>
157
+
Returns the list of stored shortcut paths.
158
+
</description>
159
+
</method>
120
160
<methodname="has_setting"qualifiers="const">
121
161
<returntype="bool" />
122
162
<paramindex="0"name="name"type="String" />
123
163
<description>
124
164
Returns [code]true[/code] if the setting specified by [param name] exists, [code]false[/code] otherwise.
125
165
</description>
126
166
</method>
167
+
<methodname="has_shortcut"qualifiers="const">
168
+
<returntype="bool" />
169
+
<paramindex="0"name="path"type="String" />
170
+
<description>
171
+
Returns [code]true[/code] if the shortcut specified by [param path] exists, [code]false[/code] otherwise.
172
+
</description>
173
+
</method>
174
+
<methodname="is_shortcut"qualifiers="const">
175
+
<returntype="bool" />
176
+
<paramindex="0"name="path"type="String" />
177
+
<paramindex="1"name="event"type="InputEvent" />
178
+
<description>
179
+
Returns [code]true[/code] if the shortcut specified by [param path] matches the event specified by [param event], [code]false[/code] otherwise.
180
+
</description>
181
+
</method>
127
182
<methodname="mark_setting_changed">
128
183
<returntype="void" />
129
184
<paramindex="0"name="setting"type="String" />
130
185
<description>
131
186
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