Debian Codegraph @

doc/classes/EditorPlugin.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="EditorPlugin" inherits="Node" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 Used by the editor to extend its functionality.
5 </brief_description>
6 <description>
7 Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins. See also [EditorScript] to add functions to the editor.
8 [b]Note:[/b] Some names in this class contain "left" or "right" (e.g. [constant DOCK_SLOT_LEFT_UL]). These APIs assume left-to-right layout, and would be backwards when using right-to-left layout. These names are kept for compatibility reasons.
9 </description>
10 <tutorials>
11 <link title="Editor plugins documentation index">$DOCS_URL/tutorials/plugins/editor/index.html</link>
12 </tutorials>
13 <methods>
14 <method name="_apply_changes" qualifiers="virtual">
15 <return type="void" />
16 <description>
17 This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency.
18 This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object.
19 </description>
20 </method>
21 <method name="_build" qualifiers="virtual">
22 <return type="bool" />
23 <description>
24 This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs.
25 This method must return a boolean. If this method returns [code]false[/code], the project will not run. The run is aborted immediately, so this also prevents all other plugins' [method _build] methods from running.
26 </description>
27 </method>
28 <method name="_clear" qualifiers="virtual">
29 <return type="void" />
30 <description>
31 Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene.
32 </description>
33 </method>
34 <method name="_disable_plugin" qualifiers="virtual">
35 <return type="void" />
36 <description>
37 Called by the engine when the user disables the [EditorPlugin] in the Plugin tab of the project settings window.
38 </description>
39 </method>
40 <method name="_edit" qualifiers="virtual">
41 <return type="void" />
42 <param index="0" name="object" type="Object" />
43 <description>
44 This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
45 [param object] can be [code]null[/code] if the plugin was editing an object, but there is no longer any selected object handled by this plugin. It can be used to cleanup editing state.
46 </description>
47 </method>
48 <method name="_enable_plugin" qualifiers="virtual">
49 <return type="void" />
50 <description>
51 Called by the engine when the user enables the [EditorPlugin] in the Plugin tab of the project settings window.
52 </description>
53 </method>
54 <method name="_forward_3d_draw_over_viewport" qualifiers="virtual">
55 <return type="void" />
56 <param index="0" name="viewport_control" type="Control" />
57 <description>
58 Called by the engine when the 3D editor's viewport is updated. [param viewport_control] is an overlay on top of the viewport and it can be used for drawing. You can update the viewport manually by calling [method update_overlays].
59 [codeblocks]
60 [gdscript]
61 func _forward_3d_draw_over_viewport(overlay):
62 # Draw a circle at the cursor's position.
63 overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.WHITE)
64
65 func _forward_3d_gui_input(camera, event):
66 if event is InputEventMouseMotion:
67 # Redraw the viewport when the cursor is moved.
68 update_overlays()
69 return EditorPlugin.AFTER_GUI_INPUT_STOP
70 return EditorPlugin.AFTER_GUI_INPUT_PASS
71 [/gdscript]
72 [csharp]
73 public override void _Forward3DDrawOverViewport(Control viewportControl)
74 {
75 // Draw a circle at the cursor's position.
76 viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
77 }
78
79 public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D viewportCamera, InputEvent @event)
80 {
81 if (@event is InputEventMouseMotion)
82 {
83 // Redraw the viewport when the cursor is moved.
84 UpdateOverlays();
85 return EditorPlugin.AfterGuiInput.Stop;
86 }
87 return EditorPlugin.AfterGuiInput.Pass;
88 }
89 [/csharp]
90 [/codeblocks]
91 </description>
92 </method>
93 <method name="_forward_3d_force_draw_over_viewport" qualifiers="virtual">
94 <return type="void" />
95 <param index="0" name="viewport_control" type="Control" />
96 <description>
97 This method is the same as [method _forward_3d_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
98 You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled].
99 </description>
100 </method>
101 <method name="_forward_3d_gui_input" qualifiers="virtual">
102 <return type="int" />
103 <param index="0" name="viewport_camera" type="Camera3D" />
104 <param index="1" name="event" type="InputEvent" />
105 <description>
106 Called when there is a root node in the current edited scene, [method _handles] is implemented, and an [InputEvent] happens in the 3D viewport. The return value decides whether the [InputEvent] is consumed or forwarded to other [EditorPlugin]s. See [enum AfterGUIInput] for options.
107 [codeblocks]
108 [gdscript]
109 # Prevents the InputEvent from reaching other Editor classes.
110 func _forward_3d_gui_input(camera, event):
111 return EditorPlugin.AFTER_GUI_INPUT_STOP
112 [/gdscript]
113 [csharp]
114 // Prevents the InputEvent from reaching other Editor classes.
115 public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
116 {
117 return EditorPlugin.AfterGuiInput.Stop;
118 }
119 [/csharp]
120 [/codeblocks]
121 This method must return [constant AFTER_GUI_INPUT_PASS] in order to forward the [InputEvent] to other Editor classes.
122 [codeblocks]
123 [gdscript]
124 # Consumes InputEventMouseMotion and forwards other InputEvent types.
125 func _forward_3d_gui_input(camera, event):
126 return EditorPlugin.AFTER_GUI_INPUT_STOP if event is InputEventMouseMotion else EditorPlugin.AFTER_GUI_INPUT_PASS
127 [/gdscript]
128 [csharp]
129 // Consumes InputEventMouseMotion and forwards other InputEvent types.
130 public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
131 {
132 return @event is InputEventMouseMotion ? EditorPlugin.AfterGuiInput.Stop : EditorPlugin.AfterGuiInput.Pass;
133 }
134 [/csharp]
135 [/codeblocks]
136 </description>
137 </method>
138 <method name="_forward_canvas_draw_over_viewport" qualifiers="virtual">
139 <return type="void" />
140 <param index="0" name="viewport_control" type="Control" />
141 <description>
142 Called by the engine when the 2D editor's viewport is updated. [param viewport_control] is an overlay on top of the viewport and it can be used for drawing. You can update the viewport manually by calling [method update_overlays].
143 [codeblocks]
144 [gdscript]
145 func _forward_canvas_draw_over_viewport(overlay):
146 # Draw a circle at the cursor's position.
147 overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.WHITE)
148
149 func _forward_canvas_gui_input(event):
150 if event is InputEventMouseMotion:
151 # Redraw the viewport when the cursor is moved.
152 update_overlays()
153 return true
154 return false
155 [/gdscript]
156 [csharp]
157 public override void _ForwardCanvasDrawOverViewport(Control viewportControl)
158 {
159 // Draw a circle at the cursor's position.
160 viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
161 }
162
163 public override bool _ForwardCanvasGuiInput(InputEvent @event)
164 {
165 if (@event is InputEventMouseMotion)
166 {
167 // Redraw the viewport when the cursor is moved.
168 UpdateOverlays();
169 return true;
170 }
171 return false;
172 }
173 [/csharp]
174 [/codeblocks]
175 </description>
176 </method>
177 <method name="_forward_canvas_force_draw_over_viewport" qualifiers="virtual">
178 <return type="void" />
179 <param index="0" name="viewport_control" type="Control" />
180 <description>
181 This method is the same as [method _forward_canvas_draw_over_viewport], except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
182 You need to enable calling of this method by using [method set_force_draw_over_forwarding_enabled].
183 </description>
184 </method>
185 <method name="_forward_canvas_gui_input" qualifiers="virtual">
186 <return type="bool" />
187 <param index="0" name="event" type="InputEvent" />
188 <description>
189 Called when there is a root node in the current edited scene, [method _handles] is implemented, and an [InputEvent] happens in the 2D viewport. If this method returns [code]true[/code], [param event] is intercepted by this [EditorPlugin], otherwise [param event] is forwarded to other Editor classes.
190 [codeblocks]
191 [gdscript]
192 # Prevents the InputEvent from reaching other Editor classes.
193 func _forward_canvas_gui_input(event):
194 return true
195 [/gdscript]
196 [csharp]
197 // Prevents the InputEvent from reaching other Editor classes.
198 public override bool ForwardCanvasGuiInput(InputEvent @event)
199 {
200 return true;
201 }
202 [/csharp]
203 [/codeblocks]
204 This method must return [code]false[/code] in order to forward the [InputEvent] to other Editor classes.
205 [codeblocks]
206 [gdscript]
207 # Consumes InputEventMouseMotion and forwards other InputEvent types.
208 func _forward_canvas_gui_input(event):
209 if (event is InputEventMouseMotion):
210 return true
211 return false
212 [/gdscript]
213 [csharp]
214 // Consumes InputEventMouseMotion and forwards other InputEvent types.
215 public override bool _ForwardCanvasGuiInput(InputEvent @event)
216 {
217 if (@event is InputEventMouseMotion)
218 {
219 return true;
220 }
221 return false;
222 }
223 [/csharp]
224 [/codeblocks]
225 </description>
226 </method>
227 <method name="_get_breakpoints" qualifiers="virtual const">
228 <return type="PackedStringArray" />
229 <description>
230 This is for editors that edit script-based objects. You can return a list of breakpoints in the format ([code]script:line[/code]), for example: [code]res://path_to_script.gd:25[/code].
231 </description>
232 </method>
233 <method name="_get_plugin_icon" qualifiers="virtual const">
234 <return type="Texture2D" />
235 <description>
236 Override this method in your plugin to return a [Texture2D] in order to give it an icon.
237 For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", "Game", and "AssetLib" buttons.
238 Ideally, the plugin icon should be white with a transparent background and 16×16 pixels in size.
239 [codeblocks]
240 [gdscript]
241 func _get_plugin_icon():
242 # You can use a custom icon:
243 return preload("res://addons/my_plugin/my_plugin_icon.svg")
244 # Or use a built-in icon:
245 return EditorInterface.get_editor_theme().get_icon("Node", "EditorIcons")
246 [/gdscript]
247 [csharp]
248 public override Texture2D _GetPluginIcon()
249 {
250 // You can use a custom icon:
251 return ResourceLoader.Load&lt;Texture2D&gt;("res://addons/my_plugin/my_plugin_icon.svg");
252 // Or use a built-in icon:
253 return EditorInterface.Singleton.GetEditorTheme().GetIcon("Node", "EditorIcons");
254 }
255 [/csharp]
256 [/codeblocks]
257 </description>
258 </method>
259 <method name="_get_plugin_name" qualifiers="virtual const">
260 <return type="String" />
261 <description>
262 Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor.
263 For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", "Game", and "AssetLib" buttons.
264 </description>
265 </method>
266 <method name="_get_state" qualifiers="virtual const">
267 <return type="Dictionary" />
268 <description>
269 Override this method to provide a state data you want to be saved, like view position, grid settings, folding, etc. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns). This data is automatically saved for each scene in an [code]editstate[/code] file in the editor metadata folder. If you want to store global (scene-independent) editor data for your plugin, you can use [method _get_window_layout] instead.
270 Use [method _set_state] to restore your saved state.
271 [b]Note:[/b] This method should not be used to save important settings that should persist with the project.
272 [b]Note:[/b] You must implement [method _get_plugin_name] for the state to be stored and restored correctly.
273 [codeblock]
274 func _get_state():
275 var state = { "zoom": zoom, "preferred_color": my_color }
276 return state
277 [/codeblock]
278 </description>
279 </method>
280 <method name="_get_unsaved_status" qualifiers="virtual const">
281 <return type="String" />
282 <param index="0" name="for_scene" type="String" />
283 <description>
284 Override this method to provide a custom message that lists unsaved changes. The editor will call this method when exiting or when closing a scene, and display the returned string in a confirmation dialog. Return empty string if the plugin has no unsaved changes.
285 When closing a scene, [param for_scene] is the path to the scene being closed. You can use it to handle built-in resources in that scene.
286 If the user confirms saving, [method _save_external_data] will be called, before closing the editor.
287 [codeblock]
288 func _get_unsaved_status(for_scene):
289 if not unsaved:
290 return ""
291
292 if for_scene.is_empty():
293 return "Save changes in MyCustomPlugin before closing?"
294 else:
295 return "Scene %s has changes from MyCustomPlugin. Save before closing?" % for_scene.get_file()
296
297 func _save_external_data():
298 unsaved = false
299 [/codeblock]
300 If the plugin has no scene-specific changes, you can ignore the calls when closing scenes:
301 [codeblock]
302 func _get_unsaved_status(for_scene):
303 if not for_scene.is_empty():
304 return ""
305 [/codeblock]
306 </description>
307 </method>
308 <method name="_get_window_layout" qualifiers="virtual">
309 <return type="void" />
310 <param index="0" name="configuration" type="ConfigFile" />
311 <description>
312 Override this method to provide the GUI layout of the plugin or any other data you want to be stored. This is used to save the project's editor layout when [method queue_save_layout] is called or the editor layout was changed (for example changing the position of a dock). The data is stored in the [code]editor_layout.cfg[/code] file in the editor metadata directory.
313 Use [method _set_window_layout] to restore your saved layout.
314 [codeblock]
315 func _get_window_layout(configuration):
316 configuration.set_value("MyPlugin", "window_position", $Window.position)
317 configuration.set_value("MyPlugin", "icon_color", $Icon.modulate)
318 [/codeblock]
319 </description>
320 </method>
321 <method name="_handles" qualifiers="virtual const">
322 <return type="bool" />
323 <param index="0" name="object" type="Object" />
324 <description>
325 Implement this function if your plugin edits a specific type of object (Resource or Node). If you return [code]true[/code], then you will get the functions [method _edit] and [method _make_visible] called when the editor requests them. If you have declared the methods [method _forward_canvas_gui_input] and [method _forward_3d_gui_input] these will be called too.
326 [b]Note:[/b] Each plugin should handle only one type of objects at a time. If a plugin handles more types of objects and they are edited at the same time, it will result in errors.
327 </description>
328 </method>
329 <method name="_has_main_screen" qualifiers="virtual const">
330 <return type="bool" />
331 <description>
332 Returns [code]true[/code] if this is a main screen editor plugin (it goes in the workspace selector together with [b]2D[/b], [b]3D[/b], [b]Script[/b], [b]Game[/b], and [b]AssetLib[/b]).
333 When the plugin's workspace is selected, other main screen plugins will be hidden, but your plugin will not appear automatically. It needs to be added as a child of [method EditorInterface.get_editor_main_screen] and made visible inside [method _make_visible].
334 Use [method _get_plugin_name] and [method _get_plugin_icon] to customize the plugin button's appearance.
335 [codeblock]
336 var plugin_control
337
338 func _enter_tree():
339 plugin_control = preload("my_plugin_control.tscn").instantiate()
340 EditorInterface.get_editor_main_screen().add_child(plugin_control)
341 plugin_control.hide()
342
343 func _has_main_screen():
344 return true
345
346 func _make_visible(visible):
347 plugin_control.visible = visible
348
349 func _get_plugin_name():
350 return "My Super Cool Plugin 3000"
351
352 func _get_plugin_icon():
353 return EditorInterface.get_editor_theme().get_icon("Node", "EditorIcons")
354 [/codeblock]
355 </description>
356 </method>
357 <method name="_make_visible" qualifiers="virtual">
358 <return type="void" />
359 <param index="0" name="visible" type="bool" />
360 <description>
361 This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
362 Remember that you have to manage the visibility of all your editor controls manually.
363 </description>
364 </method>
365 <method name="_run_scene" qualifiers="virtual const">
366 <return type="PackedStringArray" />
367 <param index="0" name="scene" type="String" />
368 <param index="1" name="args" type="PackedStringArray" />
369 <description>
370 This function is called when an individual scene is about to be played in the editor. [param args] is a list of command line arguments that will be passed to the new Godot instance, which will be replaced by the list returned by this function.
371 [codeblock]
372 func _run_scene(scene, args):
373 args.append("--an-extra-argument")
374 return args
375 [/codeblock]
376 [b]Note:[/b] Text that is printed in this method will not be visible in the editor's Output panel unless [member EditorSettings.run/output/always_clear_output_on_play] is [code]false[/code].
377 </description>
378 </method>
379 <method name="_save_external_data" qualifiers="virtual">
380 <return type="void" />
381 <description>
382 This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.
383 </description>
384 </method>
385 <method name="_set_state" qualifiers="virtual">
386 <return type="void" />
387 <param index="0" name="state" type="Dictionary" />
388 <description>
389 Restore the state saved by [method _get_state]. This method is called when the current scene tab is changed in the editor.
390 [b]Note:[/b] Your plugin must implement [method _get_plugin_name], otherwise it will not be recognized and this method will not be called.
391 [codeblock]
392 func _set_state(data):
393 zoom = data.get("zoom", 1.0)
394 preferred_color = data.get("my_color", Color.WHITE)
395 [/codeblock]
396 </description>
397 </method>
398 <method name="_set_window_layout" qualifiers="virtual">
399 <return type="void" />
400 <param index="0" name="configuration" type="ConfigFile" />
401 <description>
402 Restore the plugin GUI layout and data saved by [method _get_window_layout]. This method is called for every plugin on editor startup. Use the provided [param configuration] file to read your saved data.
403 [codeblock]
404 func _set_window_layout(configuration):
405 $Window.position = configuration.get_value("MyPlugin", "window_position", Vector2())
406 $Icon.modulate = configuration.get_value("MyPlugin", "icon_color", Color.WHITE)
407 [/codeblock]
408 </description>
409 </method>
410 <method name="add_autoload_singleton">
411 <return type="void" />
412 <param index="0" name="name" type="String" />
413 <param index="1" name="path" type="String" />
414 <description>
415 Adds a script at [param path] to the Autoload list as [param name].
416 </description>
417 </method>
418 <method name="add_context_menu_plugin">
419 <return type="void" />
420 <param index="0" name="slot" type="int" enum="EditorContextMenuPlugin.ContextMenuSlot" />
421 <param index="1" name="plugin" type="EditorContextMenuPlugin" />
422 <description>
423 Adds a plugin to the context menu. [param slot] is the context menu where the plugin will be added.
424 [b]Note:[/b] A plugin instance can belong only to a single context menu slot.
425 </description>
426 </method>
427 <method name="add_control_to_bottom_panel" deprecated="Use [method add_dock] instead, with [member EditorDock.default_slot] set to [constant DOCK_SLOT_BOTTOM].">
428 <return type="Button" />
429 <param index="0" name="control" type="Control" />
430 <param index="1" name="title" type="String" />
431 <param index="2" name="shortcut" type="Shortcut" default="null" />
432 <description>
433 Adds a control to the bottom panel (together with Output, Debug, Animation, etc.). Returns a reference to a button that is outside the scene tree. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [method Node.queue_free].
434 [param shortcut] is a shortcut that, when activated, will toggle the bottom panel's visibility. The shortcut object is only set when this control is added to the bottom panel.
435 [b]Note[/b] See the default editor bottom panel shortcuts in the Editor Settings for inspiration. By convention, they all use [kbd]Alt[/kbd] modifier.
436 </description>
437 </method>
438 <method name="add_control_to_container">
439 <return type="void" />
440 <param index="0" name="container" type="int" enum="EditorPlugin.CustomControlContainer" />
441 <param index="1" name="control" type="Control" />
442 <description>
443 Adds a custom control to a container in the editor UI.
444 Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
445 When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_container] and free it with [method Node.queue_free].
446 </description>
447 </method>
448 <method name="add_control_to_dock" deprecated="Use [method add_dock] instead.">
449 <return type="void" />
450 <param index="0" name="slot" type="int" enum="EditorPlugin.DockSlot" />
451 <param index="1" name="control" type="Control" />
452 <param index="2" name="shortcut" type="Shortcut" default="null" />
453 <description>
454 Adds the control to a specific dock slot.
455 If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
456 When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_docks] and free it with [method Node.queue_free].
457 Optionally, you can specify a shortcut parameter. When pressed, this shortcut will open and focus the dock.
458 </description>
459 </method>
460 <method name="add_custom_type">
461 <return type="void" />
462 <param index="0" name="type" type="String" />
463 <param index="1" name="base" type="String" />
464 <param index="2" name="script" type="Script" />
465 <param index="3" name="icon" type="Texture2D" />
466 <description>
467 Adds a custom type, which will appear in the list of nodes or resources.
468 When a given node or resource is selected, the base type will be instantiated (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object.
469 [b]Note:[/b] The base type is the base engine class which this type's class hierarchy inherits, not any custom type parent classes.
470 You can use the virtual method [method _handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword.
471 During run-time, this will be a simple object with a script so this function does not need to be called then.
472 [b]Note:[/b] Custom types added this way are not true classes. They are just a helper to create a node with specific script.
473 </description>
474 </method>
475 <method name="add_debugger_plugin">
476 <return type="void" />
477 <param index="0" name="script" type="EditorDebuggerPlugin" />
478 <description>
479 Adds a [Script] as debugger plugin to the Debugger. The script must extend [EditorDebuggerPlugin].
480 </description>
481 </method>
482 <method name="add_dock">
483 <return type="void" />
484 <param index="0" name="dock" type="EditorDock" />
485 <description>
486 Adds a new dock.
487 When your plugin is deactivated, make sure to remove your custom dock with [method remove_dock] and free it with [method Node.queue_free].
488 </description>
489 </method>
490 <method name="add_export_platform">
491 <return type="void" />
492 <param index="0" name="platform" type="EditorExportPlatform" />
493 <description>
494 Registers a new [EditorExportPlatform]. Export platforms provides functionality of exporting to the specific platform.
495 </description>
496 </method>
497 <method name="add_export_plugin">
498 <return type="void" />
499 <param index="0" name="plugin" type="EditorExportPlugin" />
500 <description>
501 Registers a new [EditorExportPlugin]. Export plugins are used to perform tasks when the project is being exported.
502 See [method add_inspector_plugin] for an example of how to register a plugin.
503 </description>
504 </method>
505 <method name="add_import_plugin">
506 <return type="void" />
507 <param index="0" name="importer" type="EditorImportPlugin" />
508 <param index="1" name="first_priority" type="bool" default="false" />
509 <description>
510 Registers a new [EditorImportPlugin]. Import plugins are used to import custom and unsupported assets as a custom [Resource] type.
511 If [param first_priority] is [code]true[/code], the new import plugin is inserted first in the list and takes precedence over pre-existing plugins.
512 [b]Note:[/b] If you want to import custom 3D asset formats use [method add_scene_format_importer_plugin] instead.
513 See [method add_inspector_plugin] for an example of how to register a plugin.
514 </description>
515 </method>
516 <method name="add_inspector_plugin">
517 <return type="void" />
518 <param index="0" name="plugin" type="EditorInspectorPlugin" />
519 <description>
520 Registers a new [EditorInspectorPlugin]. Inspector plugins are used to extend [EditorInspector] and provide custom configuration tools for your object's properties.
521 [b]Note:[/b] Always use [method remove_inspector_plugin] to remove the registered [EditorInspectorPlugin] when your [EditorPlugin] is disabled to prevent leaks and an unexpected behavior.
522 [codeblocks]
523 [gdscript]
524 const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd")
525 var inspector_plugin = MyInspectorPlugin.new()
526
527 func _enter_tree():
528 add_inspector_plugin(inspector_plugin)
529
530 func _exit_tree():
531 remove_inspector_plugin(inspector_plugin)
532 [/gdscript]
533 [/codeblocks]
534 </description>
535 </method>
536 <method name="add_node_3d_gizmo_plugin">
537 <return type="void" />
538 <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" />
539 <description>
540 Registers a new [EditorNode3DGizmoPlugin]. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a [Node3D].
541 See [method add_inspector_plugin] for an example of how to register a plugin.
542 </description>
543 </method>
544 <method name="add_resource_conversion_plugin">
545 <return type="void" />
546 <param index="0" name="plugin" type="EditorResourceConversionPlugin" />
547 <description>
548 Registers a new [EditorResourceConversionPlugin]. Resource conversion plugins are used to add custom resource converters to the editor inspector.
549 See [EditorResourceConversionPlugin] for an example of how to create a resource conversion plugin.
550 </description>
551 </method>
552 <method name="add_scene_format_importer_plugin">
553 <return type="void" />
554 <param index="0" name="scene_format_importer" type="EditorSceneFormatImporter" />
555 <param index="1" name="first_priority" type="bool" default="false" />
556 <description>
557 Registers a new [EditorSceneFormatImporter]. Scene importers are used to import custom 3D asset formats as scenes.
558 If [param first_priority] is [code]true[/code], the new import plugin is inserted first in the list and takes precedence over pre-existing plugins.
559 </description>
560 </method>
561 <method name="add_scene_post_import_plugin">
562 <return type="void" />
563 <param index="0" name="scene_import_plugin" type="EditorScenePostImportPlugin" />
564 <param index="1" name="first_priority" type="bool" default="false" />
565 <description>
566 Add an [EditorScenePostImportPlugin]. These plugins allow customizing the import process of 3D assets by adding new options to the import dialogs.
567 If [param first_priority] is [code]true[/code], the new import plugin is inserted first in the list and takes precedence over pre-existing plugins.
568 </description>
569 </method>
570 <method name="add_tool_menu_item">
571 <return type="void" />
572 <param index="0" name="name" type="String" />
573 <param index="1" name="callable" type="Callable" />
574 <description>
575 Adds a custom menu item to [b]Project &gt; Tools[/b] named [param name]. When clicked, the provided [param callable] will be called.
576 </description>
577 </method>
578 <method name="add_tool_submenu_item">
579 <return type="void" />
580 <param index="0" name="name" type="String" />
581 <param index="1" name="submenu" type="PopupMenu" />
582 <description>
583 Adds a custom [PopupMenu] submenu under [b]Project &gt; Tools &gt;[/b] [param name]. Use [method remove_tool_menu_item] on plugin clean up to remove the menu.
584 </description>
585 </method>
586 <method name="add_translation_parser_plugin">
587 <return type="void" />
588 <param index="0" name="parser" type="EditorTranslationParserPlugin" />
589 <description>
590 Registers a custom translation parser plugin for extracting translatable strings from custom files.
591 </description>
592 </method>
593 <method name="add_undo_redo_inspector_hook_callback">
594 <return type="void" />
595 <param index="0" name="callable" type="Callable" />
596 <description>
597 Hooks a callback into the undo/redo action creation when a property is modified in the inspector. This allows, for example, to save other properties that may be lost when a given property is modified.
598 The callback should have 4 arguments: [Object] [code]undo_redo[/code], [Object] [code]modified_object[/code], [String] [code]property[/code] and [Variant] [code]new_value[/code]. They are, respectively, the [UndoRedo] object used by the inspector, the currently modified object, the name of the modified property and the new value the property is about to take.
599 </description>
600 </method>
601 <method name="get_editor_interface" deprecated="[EditorInterface] is a global singleton and can be accessed directly by its name.">
602 <return type="EditorInterface" />
603 <description>
604 Returns the [EditorInterface] singleton instance.
605 </description>
606 </method>
607 <method name="get_export_as_menu">
608 <return type="PopupMenu" />
609 <description>
610 Returns the [PopupMenu] under [b]Scene &gt; Export As...[/b].
611 </description>
612 </method>
613 <method name="get_plugin_version" qualifiers="const">
614 <return type="String" />
615 <description>
616 Provide the version of the plugin declared in the [code]plugin.cfg[/code] config file.
617 </description>
618 </method>
619 <method name="get_script_create_dialog">
620 <return type="ScriptCreateDialog" />
621 <description>
622 Gets the Editor's dialog used for making scripts.
623 [b]Note:[/b] Users can configure it before use.
624 [b]Warning:[/b] Removing and freeing this node will render a part of the editor useless and may cause a crash.
625 </description>
626 </method>
627 <method name="get_undo_redo">
628 <return type="EditorUndoRedoManager" />
629 <description>
630 Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.
631 </description>
632 </method>
633 <method name="hide_bottom_panel">
634 <return type="void" />
635 <description>
636 Minimizes the bottom panel.
637 </description>
638 </method>
639 <method name="make_bottom_panel_item_visible">
640 <return type="void" />
641 <param index="0" name="item" type="Control" />
642 <description>
643 Makes a specific item in the bottom panel visible.
644 </description>
645 </method>
646 <method name="queue_save_layout">
647 <return type="void" />
648 <description>
649 Queue save the project's editor layout.
650 </description>
651 </method>
652 <method name="remove_autoload_singleton">
653 <return type="void" />
654 <param index="0" name="name" type="String" />
655 <description>
656 Removes an Autoload [param name] from the list.
657 </description>
658 </method>
659 <method name="remove_context_menu_plugin">
660 <return type="void" />
661 <param index="0" name="plugin" type="EditorContextMenuPlugin" />
662 <description>
663 Removes the specified context menu plugin.
664 </description>
665 </method>
666 <method name="remove_control_from_bottom_panel" deprecated="Use [method remove_dock] instead.">
667 <return type="void" />
668 <param index="0" name="control" type="Control" />
669 <description>
670 Removes the control from the bottom panel. You have to manually [method Node.queue_free] the control.
671 </description>
672 </method>
673 <method name="remove_control_from_container">
674 <return type="void" />
675 <param index="0" name="container" type="int" enum="EditorPlugin.CustomControlContainer" />
676 <param index="1" name="control" type="Control" />
677 <description>
678 Removes the control from the specified container. You have to manually [method Node.queue_free] the control.
679 </description>
680 </method>
681 <method name="remove_control_from_docks" deprecated="Use [method remove_dock] instead.">
682 <return type="void" />
683 <param index="0" name="control" type="Control" />
684 <description>
685 Removes the control from the dock. You have to manually [method Node.queue_free] the control.
686 </description>
687 </method>
688 <method name="remove_custom_type">
689 <return type="void" />
690 <param index="0" name="type" type="String" />
691 <description>
692 Removes a custom type added by [method add_custom_type].
693 </description>
694 </method>
695 <method name="remove_debugger_plugin">
696 <return type="void" />
697 <param index="0" name="script" type="EditorDebuggerPlugin" />
698 <description>
699 Removes the debugger plugin with given script from the Debugger.
700 </description>
701 </method>
702 <method name="remove_dock">
703 <return type="void" />
704 <param index="0" name="dock" type="EditorDock" />
705 <description>
706 Removes [param dock] from the available docks. You should manually call [method Node.queue_free] to free it.
707 </description>
708 </method>
709 <method name="remove_export_platform">
710 <return type="void" />
711 <param index="0" name="platform" type="EditorExportPlatform" />
712 <description>
713 Removes an export platform registered by [method add_export_platform].
714 </description>
715 </method>
716 <method name="remove_export_plugin">
717 <return type="void" />
718 <param index="0" name="plugin" type="EditorExportPlugin" />
719 <description>
720 Removes an export plugin registered by [method add_export_plugin].
721 </description>
722 </method>
723 <method name="remove_import_plugin">
724 <return type="void" />
725 <param index="0" name="importer" type="EditorImportPlugin" />
726 <description>
727 Removes an import plugin registered by [method add_import_plugin].
728 </description>
729 </method>
730 <method name="remove_inspector_plugin">
731 <return type="void" />
732 <param index="0" name="plugin" type="EditorInspectorPlugin" />
733 <description>
734 Removes an inspector plugin registered by [method add_inspector_plugin].
735 </description>
736 </method>
737 <method name="remove_node_3d_gizmo_plugin">
738 <return type="void" />
739 <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" />
740 <description>
741 Removes a gizmo plugin registered by [method add_node_3d_gizmo_plugin].
742 </description>
743 </method>
744 <method name="remove_resource_conversion_plugin">
745 <return type="void" />
746 <param index="0" name="plugin" type="EditorResourceConversionPlugin" />
747 <description>
748 Removes a resource conversion plugin registered by [method add_resource_conversion_plugin].
749 </description>
750 </method>
751 <method name="remove_scene_format_importer_plugin">
752 <return type="void" />
753 <param index="0" name="scene_format_importer" type="EditorSceneFormatImporter" />
754 <description>
755 Removes a scene format importer registered by [method add_scene_format_importer_plugin].
756 </description>
757 </method>
758 <method name="remove_scene_post_import_plugin">
759 <return type="void" />
760 <param index="0" name="scene_import_plugin" type="EditorScenePostImportPlugin" />
761 <description>
762 Remove the [EditorScenePostImportPlugin], added with [method add_scene_post_import_plugin].
763 </description>
764 </method>
765 <method name="remove_tool_menu_item">
766 <return type="void" />
767 <param index="0" name="name" type="String" />
768 <description>
769 Removes a menu [param name] from [b]Project &gt; Tools[/b].
770 </description>
771 </method>
772 <method name="remove_translation_parser_plugin">
773 <return type="void" />
774 <param index="0" name="parser" type="EditorTranslationParserPlugin" />
775 <description>
776 Removes a custom translation parser plugin registered by [method add_translation_parser_plugin].
777 </description>
778 </method>
779 <method name="remove_undo_redo_inspector_hook_callback">
780 <return type="void" />
781 <param index="0" name="callable" type="Callable" />
782 <description>
783 Removes a callback previously added by [method add_undo_redo_inspector_hook_callback].
784 </description>
785 </method>
786 <method name="set_dock_tab_icon" deprecated="Use [member EditorDock.dock_icon] instead.">
787 <return type="void" />
788 <param index="0" name="control" type="Control" />
789 <param index="1" name="icon" type="Texture2D" />
790 <description>
791 Sets the tab icon for the given control in a dock slot. Setting to [code]null[/code] removes the icon.
792 </description>
793 </method>
794 <method name="set_force_draw_over_forwarding_enabled">
795 <return type="void" />
796 <description>
797 Enables calling of [method _forward_canvas_force_draw_over_viewport] for the 2D editor and [method _forward_3d_force_draw_over_viewport] for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.
798 </description>
799 </method>
800 <method name="set_input_event_forwarding_always_enabled">
801 <return type="void" />
802 <description>
803 Use this method if you always want to receive inputs from 3D view screen inside [method _forward_3d_gui_input]. It might be especially usable if your plugin will want to use raycast in the scene.
804 </description>
805 </method>
806 <method name="update_overlays" qualifiers="const">
807 <return type="int" />
808 <description>
809 Updates the overlays of the 2D and 3D editor viewport. Causes methods [method _forward_canvas_draw_over_viewport], [method _forward_canvas_force_draw_over_viewport], [method _forward_3d_draw_over_viewport] and [method _forward_3d_force_draw_over_viewport] to be called.
810 </description>
811 </method>
812 </methods>
813 <signals>
814 <signal name="main_screen_changed">
815 <param index="0" name="screen_name" type="String" />
816 <description>
817 Emitted when user changes the workspace ([b]2D[/b], [b]3D[/b], [b]Script[/b], [b]Game[/b], [b]AssetLib[/b]). Also works with custom screens defined by plugins.
818 </description>
819 </signal>
820 <signal name="project_settings_changed" deprecated="Use [signal ProjectSettings.settings_changed] instead.">
821 <description>
822 Emitted when any project setting has changed.
823 </description>
824 </signal>
825 <signal name="resource_saved">
826 <param index="0" name="resource" type="Resource" />
827 <description>
828 Emitted when the given [param resource] was saved on disc. See also [signal scene_saved].
829 </description>
830 </signal>
831 <signal name="scene_changed">
832 <param index="0" name="scene_root" type="Node" />
833 <description>
834 Emitted when the scene is changed in the editor. The argument will return the root node of the scene that has just become active. If this scene is new and empty, the argument will be [code]null[/code].
835 </description>
836 </signal>
837 <signal name="scene_closed">
838 <param index="0" name="filepath" type="String" />
839 <description>
840 Emitted when user closes a scene. The argument is a file path to the closed scene.
841 </description>
842 </signal>
843 <signal name="scene_saved">
844 <param index="0" name="filepath" type="String" />
845 <description>
846 Emitted when a scene was saved on disc. The argument is a file path to the saved scene. See also [signal resource_saved].
847 </description>
848 </signal>
849 </signals>
850 <constants>
851 <constant name="CONTAINER_TOOLBAR" value="0" enum="CustomControlContainer">
852 Main editor toolbar, next to play buttons.
853 </constant>
854 <constant name="CONTAINER_SPATIAL_EDITOR_MENU" value="1" enum="CustomControlContainer">
855 The toolbar that appears when 3D editor is active.
856 </constant>
857 <constant name="CONTAINER_SPATIAL_EDITOR_SIDE_LEFT" value="2" enum="CustomControlContainer">
858 Left sidebar of the 3D editor.
859 </constant>
860 <constant name="CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT" value="3" enum="CustomControlContainer">
861 Right sidebar of the 3D editor.
862 </constant>
863 <constant name="CONTAINER_SPATIAL_EDITOR_BOTTOM" value="4" enum="CustomControlContainer">
864 Bottom panel of the 3D editor.
865 </constant>
866 <constant name="CONTAINER_CANVAS_EDITOR_MENU" value="5" enum="CustomControlContainer">
867 The toolbar that appears when 2D editor is active.
868 </constant>
869 <constant name="CONTAINER_CANVAS_EDITOR_SIDE_LEFT" value="6" enum="CustomControlContainer">
870 Left sidebar of the 2D editor.
871 </constant>
872 <constant name="CONTAINER_CANVAS_EDITOR_SIDE_RIGHT" value="7" enum="CustomControlContainer">
873 Right sidebar of the 2D editor.
874 </constant>
875 <constant name="CONTAINER_CANVAS_EDITOR_BOTTOM" value="8" enum="CustomControlContainer">
876 Bottom panel of the 2D editor.
877 </constant>
878 <constant name="CONTAINER_INSPECTOR_BOTTOM" value="9" enum="CustomControlContainer">
879 Bottom section of the inspector.
880 </constant>
881 <constant name="CONTAINER_PROJECT_SETTING_TAB_LEFT" value="10" enum="CustomControlContainer">
882 Tab of Project Settings dialog, to the left of other tabs.
883 </constant>
884 <constant name="CONTAINER_PROJECT_SETTING_TAB_RIGHT" value="11" enum="CustomControlContainer">
885 Tab of Project Settings dialog, to the right of other tabs.
886 </constant>
887 <constant name="DOCK_SLOT_NONE" value="-1" enum="DockSlot">
888 The dock is closed.
889 </constant>
890 <constant name="DOCK_SLOT_LEFT_UL" value="0" enum="DockSlot">
891 Dock slot, left side, upper-left (empty in default layout).
892 </constant>
893 <constant name="DOCK_SLOT_LEFT_BL" value="1" enum="DockSlot">
894 Dock slot, left side, bottom-left (empty in default layout).
895 </constant>
896 <constant name="DOCK_SLOT_LEFT_UR" value="2" enum="DockSlot">
897 Dock slot, left side, upper-right (in default layout includes Scene and Import docks).
898 </constant>
899 <constant name="DOCK_SLOT_LEFT_BR" value="3" enum="DockSlot">
900 Dock slot, left side, bottom-right (in default layout includes FileSystem dock).
901 </constant>
902 <constant name="DOCK_SLOT_RIGHT_UL" value="4" enum="DockSlot">
903 Dock slot, right side, upper-left (in default layout includes Inspector, Node, and History docks).
904 </constant>
905 <constant name="DOCK_SLOT_RIGHT_BL" value="5" enum="DockSlot">
906 Dock slot, right side, bottom-left (empty in default layout).
907 </constant>
908 <constant name="DOCK_SLOT_RIGHT_UR" value="6" enum="DockSlot">
909 Dock slot, right side, upper-right (empty in default layout).
910 </constant>
911 <constant name="DOCK_SLOT_RIGHT_BR" value="7" enum="DockSlot">
912 Dock slot, right side, bottom-right (empty in default layout).
913 </constant>
914 <constant name="DOCK_SLOT_BOTTOM" value="8" enum="DockSlot">
915 Bottom panel.
916 </constant>
917 <constant name="DOCK_SLOT_MAX" value="9" enum="DockSlot">
918 Represents the size of the [enum DockSlot] enum.
919 </constant>
920 <constant name="AFTER_GUI_INPUT_PASS" value="0" enum="AfterGUIInput">
921 Forwards the [InputEvent] to other EditorPlugins.
922 </constant>
923 <constant name="AFTER_GUI_INPUT_STOP" value="1" enum="AfterGUIInput">
924 Prevents the [InputEvent] from reaching other Editor classes.
925 </constant>
926 <constant name="AFTER_GUI_INPUT_CUSTOM" value="2" enum="AfterGUIInput">
927 Pass the [InputEvent] to other editor plugins except the main [Node3D] one. This can be used to prevent node selection changes and work with sub-gizmos instead.
928 </constant>
929 </constants>
930 </class>