Skip to content
0.2.0-dev Download ZIP
910 lines ·43.7 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="EditorPlugin" inherits="Node" api_type="editor" 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" deprecated="Use [member EditorDock.dock_icon] of a main screen dock.">
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 "Asset Store" 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 "Asset Store" buttons.
264 [b]Note:[/b] Main screen plugins should instead use [member EditorDock.title] of a main screen dock.
265 </description>
266 </method>
267 <method name="_get_state" qualifiers="virtual const">
268 <return type="Dictionary" />
269 <description>
270 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.
271 Use [method _set_state] to restore your saved state.
272 [b]Note:[/b] This method should not be used to save important settings that should persist with the project.
273 [b]Note:[/b] You must implement [method _get_plugin_name] for the state to be stored and restored correctly.
274 [codeblock]
275 func _get_state():
276 var state = { "zoom": zoom, "preferred_color": my_color }
277 return state
278 [/codeblock]
279 </description>
280 </method>
281 <method name="_get_unsaved_status" qualifiers="virtual const">
282 <return type="String" />
283 <param index="0" name="for_scene" type="String" />
284 <description>
285 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.
286 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.
287 If the user confirms saving, [method _save_external_data] will be called, before closing the editor.
288 [codeblock]
289 func _get_unsaved_status(for_scene):
290 if not unsaved:
291 return ""
292
293 if for_scene.is_empty():
294 return "Save changes in MyCustomPlugin before closing?"
295 else:
296 return "Scene %s has changes from MyCustomPlugin. Save before closing?" % for_scene.get_file()
297
298 func _save_external_data():
299 unsaved = false
300 [/codeblock]
301 If the plugin has no scene-specific changes, you can ignore the calls when closing scenes:
302 [codeblock]
303 func _get_unsaved_status(for_scene):
304 if not for_scene.is_empty():
305 return ""
306 [/codeblock]
307 </description>
308 </method>
309 <method name="_get_window_layout" qualifiers="virtual">
310 <return type="void" />
311 <param index="0" name="configuration" type="ConfigFile" />
312 <description>
313 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.
314 Use [method _set_window_layout] to restore your saved layout.
315 [codeblock]
316 func _get_window_layout(configuration):
317 configuration.set_value("MyPlugin", "window_position", $Window.position)
318 configuration.set_value("MyPlugin", "icon_color", $Icon.modulate)
319 [/codeblock]
320 </description>
321 </method>
322 <method name="_handles" qualifiers="virtual const">
323 <return type="bool" />
324 <param index="0" name="object" type="Object" />
325 <description>
326 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.
327 [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.
328 </description>
329 </method>
330 <method name="_has_main_screen" qualifiers="virtual const" deprecated="Use [method add_dock] instead, with [member EditorDock.default_slot] set to [constant EditorDock.DOCK_SLOT_MAIN_SCREEN].">
331 <return type="bool" />
332 <description>
333 Return [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]Asset Store[/b]).
334 You can add a main screen dock by using [EditorDock] with [constant EditorDock.DOCK_LAYOUT_MAIN_SCREEN] as available layout.
335 </description>
336 </method>
337 <method name="_make_visible" qualifiers="virtual">
338 <return type="void" />
339 <param index="0" name="visible" type="bool" />
340 <description>
341 This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
342 Remember that you have to manage the visibility of all your editor controls manually.
343 </description>
344 </method>
345 <method name="_run_scene" qualifiers="virtual const">
346 <return type="PackedStringArray" />
347 <param index="0" name="scene" type="String" />
348 <param index="1" name="args" type="PackedStringArray" />
349 <description>
350 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.
351 [codeblock]
352 func _run_scene(scene, args):
353 args.append("--an-extra-argument")
354 return args
355 [/codeblock]
356 [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].
357 </description>
358 </method>
359 <method name="_save_external_data" qualifiers="virtual">
360 <return type="void" />
361 <description>
362 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.
363 </description>
364 </method>
365 <method name="_set_state" qualifiers="virtual">
366 <return type="void" />
367 <param index="0" name="state" type="Dictionary" />
368 <description>
369 Restore the state saved by [method _get_state]. This method is called when the current scene tab is changed in the editor.
370 [b]Note:[/b] Your plugin must implement [method _get_plugin_name], otherwise it will not be recognized and this method will not be called.
371 [codeblock]
372 func _set_state(data):
373 zoom = data.get("zoom", 1.0)
374 preferred_color = data.get("my_color", Color.WHITE)
375 [/codeblock]
376 </description>
377 </method>
378 <method name="_set_window_layout" qualifiers="virtual">
379 <return type="void" />
380 <param index="0" name="configuration" type="ConfigFile" />
381 <description>
382 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.
383 [codeblock]
384 func _set_window_layout(configuration):
385 $Window.position = configuration.get_value("MyPlugin", "window_position", Vector2())
386 $Icon.modulate = configuration.get_value("MyPlugin", "icon_color", Color.WHITE)
387 [/codeblock]
388 </description>
389 </method>
390 <method name="add_autoload_singleton">
391 <return type="void" />
392 <param index="0" name="name" type="String" />
393 <param index="1" name="path" type="String" />
394 <description>
395 Adds a script at [param path] to the Autoload list as [param name].
396 </description>
397 </method>
398 <method name="add_context_menu_plugin">
399 <return type="void" />
400 <param index="0" name="slot" type="int" enum="EditorContextMenuPlugin.ContextMenuSlot" />
401 <param index="1" name="plugin" type="EditorContextMenuPlugin" />
402 <description>
403 Adds a plugin to the context menu. [param slot] is the context menu where the plugin will be added.
404 [b]Note:[/b] A plugin instance can belong only to a single context menu slot.
405 </description>
406 </method>
407 <method name="add_control_to_bottom_panel" deprecated="Use [method add_dock] instead, with [member EditorDock.default_slot] set to [constant EditorDock.DOCK_SLOT_BOTTOM].">
408 <return type="Button" />
409 <param index="0" name="control" type="Control" />
410 <param index="1" name="title" type="String" />
411 <param index="2" name="shortcut" type="Shortcut" default="null" />
412 <description>
413 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].
414 [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.
415 [b]Note:[/b] See the default editor bottom panel shortcuts in the Editor Settings for inspiration. By convention, they all use the [kbd]Alt[/kbd] modifier.
416 </description>
417 </method>
418 <method name="add_control_to_container">
419 <return type="void" />
420 <param index="0" name="container" type="int" enum="EditorPlugin.CustomControlContainer" />
421 <param index="1" name="control" type="Control" />
422 <description>
423 Adds a custom control to a container in the editor UI.
424 Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
425 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].
426 </description>
427 </method>
428 <method name="add_control_to_dock" deprecated="Use [method add_dock] instead.">
429 <return type="void" />
430 <param index="0" name="slot" type="int" enum="EditorPlugin.DockSlot" />
431 <param index="1" name="control" type="Control" />
432 <param index="2" name="shortcut" type="Shortcut" default="null" />
433 <description>
434 Adds the control to a specific dock slot.
435 If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
436 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].
437 Optionally, you can specify a shortcut parameter. When pressed, this shortcut will open and focus the dock.
438 </description>
439 </method>
440 <method name="add_custom_type">
441 <return type="void" />
442 <param index="0" name="type" type="String" />
443 <param index="1" name="base" type="String" />
444 <param index="2" name="script" type="Script" />
445 <param index="3" name="icon" type="Texture2D" />
446 <description>
447 Adds a custom type, which will appear in the list of nodes or resources.
448 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.
449 [b]Note:[/b] The base type is the base engine class which this type's class hierarchy inherits, not any custom type parent classes.
450 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.
451 During run-time, this will be a simple object with a script so this function does not need to be called then.
452 [b]Note:[/b] Custom types added this way are not true classes. They are just a helper to create a node with specific script.
453 </description>
454 </method>
455 <method name="add_debugger_plugin">
456 <return type="void" />
457 <param index="0" name="script" type="EditorDebuggerPlugin" />
458 <description>
459 Adds a [Script] as debugger plugin to the Debugger. The script must extend [EditorDebuggerPlugin].
460 </description>
461 </method>
462 <method name="add_dock">
463 <return type="void" />
464 <param index="0" name="dock" type="EditorDock" />
465 <description>
466 Adds a new dock.
467 When your plugin is deactivated, make sure to remove your custom dock with [method remove_dock] and free it with [method Node.queue_free].
468 </description>
469 </method>
470 <method name="add_export_platform">
471 <return type="void" />
472 <param index="0" name="platform" type="EditorExportPlatform" />
473 <description>
474 Registers a new [EditorExportPlatform]. Export platforms provides functionality of exporting to the specific platform.
475 </description>
476 </method>
477 <method name="add_export_plugin">
478 <return type="void" />
479 <param index="0" name="plugin" type="EditorExportPlugin" />
480 <description>
481 Registers a new [EditorExportPlugin]. Export plugins are used to perform tasks when the project is being exported.
482 See [method add_inspector_plugin] for an example of how to register a plugin.
483 </description>
484 </method>
485 <method name="add_import_plugin">
486 <return type="void" />
487 <param index="0" name="importer" type="EditorImportPlugin" />
488 <param index="1" name="first_priority" type="bool" default="false" />
489 <description>
490 Registers a new [EditorImportPlugin]. Import plugins are used to import custom and unsupported assets as a custom [Resource] type.
491 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.
492 [b]Note:[/b] If you want to import custom 3D asset formats use [method add_scene_format_importer_plugin] instead.
493 See [method add_inspector_plugin] for an example of how to register a plugin.
494 </description>
495 </method>
496 <method name="add_inspector_plugin">
497 <return type="void" />
498 <param index="0" name="plugin" type="EditorInspectorPlugin" />
499 <description>
500 Registers a new [EditorInspectorPlugin]. Inspector plugins are used to extend [EditorInspector] and provide custom configuration tools for your object's properties.
501 [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.
502 [codeblocks]
503 [gdscript]
504 const MyInspectorPlugin = preload("res://addons/your_addon/path/to/your/script.gd")
505 var inspector_plugin = MyInspectorPlugin.new()
506
507 func _enter_tree():
508 add_inspector_plugin(inspector_plugin)
509
510 func _exit_tree():
511 remove_inspector_plugin(inspector_plugin)
512 [/gdscript]
513 [/codeblocks]
514 </description>
515 </method>
516 <method name="add_node_3d_gizmo_plugin">
517 <return type="void" />
518 <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" />
519 <description>
520 Registers a new [EditorNode3DGizmoPlugin]. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a [Node3D].
521 See [method add_inspector_plugin] for an example of how to register a plugin.
522 </description>
523 </method>
524 <method name="add_resource_conversion_plugin">
525 <return type="void" />
526 <param index="0" name="plugin" type="EditorResourceConversionPlugin" />
527 <description>
528 Registers a new [EditorResourceConversionPlugin]. Resource conversion plugins are used to add custom resource converters to the editor inspector.
529 See [EditorResourceConversionPlugin] for an example of how to create a resource conversion plugin.
530 </description>
531 </method>
532 <method name="add_scene_format_importer_plugin">
533 <return type="void" />
534 <param index="0" name="scene_format_importer" type="EditorSceneFormatImporter" />
535 <param index="1" name="first_priority" type="bool" default="false" />
536 <description>
537 Registers a new [EditorSceneFormatImporter]. Scene importers are used to import custom 3D asset formats as scenes.
538 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.
539 </description>
540 </method>
541 <method name="add_scene_post_import_plugin">
542 <return type="void" />
543 <param index="0" name="scene_import_plugin" type="EditorScenePostImportPlugin" />
544 <param index="1" name="first_priority" type="bool" default="false" />
545 <description>
546 Add an [EditorScenePostImportPlugin]. These plugins allow customizing the import process of 3D assets by adding new options to the import dialogs.
547 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.
548 </description>
549 </method>
550 <method name="add_tool_menu_item">
551 <return type="void" />
552 <param index="0" name="name" type="String" />
553 <param index="1" name="callable" type="Callable" />
554 <description>
555 Adds a custom menu item to [b]Project &gt; Tools[/b] named [param name]. When clicked, the provided [param callable] will be called.
556 </description>
557 </method>
558 <method name="add_tool_submenu_item">
559 <return type="void" />
560 <param index="0" name="name" type="String" />
561 <param index="1" name="submenu" type="PopupMenu" />
562 <description>
563 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.
564 </description>
565 </method>
566 <method name="add_translation_parser_plugin">
567 <return type="void" />
568 <param index="0" name="parser" type="EditorTranslationParserPlugin" />
569 <description>
570 Registers a custom translation parser plugin for extracting translatable strings from custom files.
571 </description>
572 </method>
573 <method name="add_undo_redo_inspector_hook_callback">
574 <return type="void" />
575 <param index="0" name="callable" type="Callable" />
576 <description>
577 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.
578 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.
579 </description>
580 </method>
581 <method name="get_editor_interface" deprecated="[EditorInterface] is a global singleton and can be accessed directly by its name.">
582 <return type="EditorInterface" />
583 <description>
584 Returns the [EditorInterface] singleton instance.
585 </description>
586 </method>
587 <method name="get_export_as_menu">
588 <return type="PopupMenu" />
589 <description>
590 Returns the [PopupMenu] under [b]Scene &gt; Export As...[/b].
591 </description>
592 </method>
593 <method name="get_plugin_version" qualifiers="const">
594 <return type="String" />
595 <description>
596 Provide the version of the plugin declared in the [code]plugin.cfg[/code] config file.
597 </description>
598 </method>
599 <method name="get_script_create_dialog">
600 <return type="ScriptCreateDialog" />
601 <description>
602 Gets the Editor's dialog used for making scripts.
603 [b]Note:[/b] Users can configure it before use.
604 [b]Warning:[/b] Removing and freeing this node will render a part of the editor useless and may cause a crash.
605 </description>
606 </method>
607 <method name="get_undo_redo">
608 <return type="EditorUndoRedoManager" />
609 <description>
610 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.
611 </description>
612 </method>
613 <method name="hide_bottom_panel">
614 <return type="void" />
615 <description>
616 Minimizes the bottom panel.
617 </description>
618 </method>
619 <method name="make_bottom_panel_item_visible">
620 <return type="void" />
621 <param index="0" name="item" type="Control" />
622 <description>
623 Makes a specific item in the bottom panel visible.
624 </description>
625 </method>
626 <method name="queue_save_layout">
627 <return type="void" />
628 <description>
629 Queue save the project's editor layout.
630 </description>
631 </method>
632 <method name="remove_autoload_singleton">
633 <return type="void" />
634 <param index="0" name="name" type="String" />
635 <description>
636 Removes an Autoload [param name] from the list.
637 </description>
638 </method>
639 <method name="remove_context_menu_plugin">
640 <return type="void" />
641 <param index="0" name="plugin" type="EditorContextMenuPlugin" />
642 <description>
643 Removes the specified context menu plugin.
644 </description>
645 </method>
646 <method name="remove_control_from_bottom_panel" deprecated="Use [method remove_dock] instead.">
647 <return type="void" />
648 <param index="0" name="control" type="Control" />
649 <description>
650 Removes the control from the bottom panel. You have to manually [method Node.queue_free] the control.
651 </description>
652 </method>
653 <method name="remove_control_from_container">
654 <return type="void" />
655 <param index="0" name="container" type="int" enum="EditorPlugin.CustomControlContainer" />
656 <param index="1" name="control" type="Control" />
657 <description>
658 Removes the control from the specified container. You have to manually [method Node.queue_free] the control.
659 </description>
660 </method>
661 <method name="remove_control_from_docks" deprecated="Use [method remove_dock] instead.">
662 <return type="void" />
663 <param index="0" name="control" type="Control" />
664 <description>
665 Removes the control from the dock. You have to manually [method Node.queue_free] the control.
666 </description>
667 </method>
668 <method name="remove_custom_type">
669 <return type="void" />
670 <param index="0" name="type" type="String" />
671 <description>
672 Removes a custom type added by [method add_custom_type].
673 </description>
674 </method>
675 <method name="remove_debugger_plugin">
676 <return type="void" />
677 <param index="0" name="script" type="EditorDebuggerPlugin" />
678 <description>
679 Removes the debugger plugin with given script from the Debugger.
680 </description>
681 </method>
682 <method name="remove_dock">
683 <return type="void" />
684 <param index="0" name="dock" type="EditorDock" />
685 <description>
686 Removes [param dock] from the available docks. You should manually call [method Node.queue_free] to free it.
687 </description>
688 </method>
689 <method name="remove_export_platform">
690 <return type="void" />
691 <param index="0" name="platform" type="EditorExportPlatform" />
692 <description>
693 Removes an export platform registered by [method add_export_platform].
694 </description>
695 </method>
696 <method name="remove_export_plugin">
697 <return type="void" />
698 <param index="0" name="plugin" type="EditorExportPlugin" />
699 <description>
700 Removes an export plugin registered by [method add_export_plugin].
701 </description>
702 </method>
703 <method name="remove_import_plugin">
704 <return type="void" />
705 <param index="0" name="importer" type="EditorImportPlugin" />
706 <description>
707 Removes an import plugin registered by [method add_import_plugin].
708 </description>
709 </method>
710 <method name="remove_inspector_plugin">
711 <return type="void" />
712 <param index="0" name="plugin" type="EditorInspectorPlugin" />
713 <description>
714 Removes an inspector plugin registered by [method add_inspector_plugin].
715 </description>
716 </method>
717 <method name="remove_node_3d_gizmo_plugin">
718 <return type="void" />
719 <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" />
720 <description>
721 Removes a gizmo plugin registered by [method add_node_3d_gizmo_plugin].
722 </description>
723 </method>
724 <method name="remove_resource_conversion_plugin">
725 <return type="void" />
726 <param index="0" name="plugin" type="EditorResourceConversionPlugin" />
727 <description>
728 Removes a resource conversion plugin registered by [method add_resource_conversion_plugin].
729 </description>
730 </method>
731 <method name="remove_scene_format_importer_plugin">
732 <return type="void" />
733 <param index="0" name="scene_format_importer" type="EditorSceneFormatImporter" />
734 <description>
735 Removes a scene format importer registered by [method add_scene_format_importer_plugin].
736 </description>
737 </method>
738 <method name="remove_scene_post_import_plugin">
739 <return type="void" />
740 <param index="0" name="scene_import_plugin" type="EditorScenePostImportPlugin" />
741 <description>
742 Remove the [EditorScenePostImportPlugin], added with [method add_scene_post_import_plugin].
743 </description>
744 </method>
745 <method name="remove_tool_menu_item">
746 <return type="void" />
747 <param index="0" name="name" type="String" />
748 <description>
749 Removes a menu [param name] from [b]Project &gt; Tools[/b].
750 </description>
751 </method>
752 <method name="remove_translation_parser_plugin">
753 <return type="void" />
754 <param index="0" name="parser" type="EditorTranslationParserPlugin" />
755 <description>
756 Removes a custom translation parser plugin registered by [method add_translation_parser_plugin].
757 </description>
758 </method>
759 <method name="remove_undo_redo_inspector_hook_callback">
760 <return type="void" />
761 <param index="0" name="callable" type="Callable" />
762 <description>
763 Removes a callback previously added by [method add_undo_redo_inspector_hook_callback].
764 </description>
765 </method>
766 <method name="set_dock_tab_icon" deprecated="Use [member EditorDock.dock_icon] instead.">
767 <return type="void" />
768 <param index="0" name="control" type="Control" />
769 <param index="1" name="icon" type="Texture2D" />
770 <description>
771 Sets the tab icon for the given control in a dock slot. Setting to [code]null[/code] removes the icon.
772 </description>
773 </method>
774 <method name="set_force_draw_over_forwarding_enabled">
775 <return type="void" />
776 <description>
777 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.
778 </description>
779 </method>
780 <method name="set_input_event_forwarding_always_enabled">
781 <return type="void" />
782 <description>
783 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.
784 </description>
785 </method>
786 <method name="update_overlays" qualifiers="const">
787 <return type="int" />
788 <description>
789 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.
790 </description>
791 </method>
792 </methods>
793 <signals>
794 <signal name="main_screen_changed">
795 <param index="0" name="screen_name" type="String" />
796 <description>
797 Emitted when user changes the workspace ([b]2D[/b], [b]3D[/b], [b]Script[/b], [b]Game[/b], [b]Asset Store[/b]). Also works with custom screens defined by plugins.
798 </description>
799 </signal>
800 <signal name="project_settings_changed" deprecated="Use [signal ProjectSettings.settings_changed] instead.">
801 <description>
802 Emitted when any project setting has changed.
803 </description>
804 </signal>
805 <signal name="resource_saved">
806 <param index="0" name="resource" type="Resource" />
807 <description>
808 Emitted when the given [param resource] was saved on disc. See also [signal scene_saved].
809 </description>
810 </signal>
811 <signal name="scene_changed">
812 <param index="0" name="scene_root" type="Node" />
813 <description>
814 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].
815 </description>
816 </signal>
817 <signal name="scene_closed">
818 <param index="0" name="filepath" type="String" />
819 <description>
820 Emitted when user closes a scene. The argument is a file path to the closed scene.
821 </description>
822 </signal>
823 <signal name="scene_saved">
824 <param index="0" name="filepath" type="String" />
825 <description>
826 Emitted when a scene was saved on disc. The argument is a file path to the saved scene. See also [signal resource_saved].
827 </description>
828 </signal>
829 </signals>
830 <constants>
831 <constant name="CONTAINER_TOOLBAR" value="0" enum="CustomControlContainer">
832 Main editor toolbar, next to play buttons.
833 </constant>
834 <constant name="CONTAINER_SPATIAL_EDITOR_MENU" value="1" enum="CustomControlContainer">
835 The toolbar that appears when 3D editor is active.
836 </constant>
837 <constant name="CONTAINER_SPATIAL_EDITOR_SIDE_LEFT" value="2" enum="CustomControlContainer">
838 Left sidebar of the 3D editor.
839 </constant>
840 <constant name="CONTAINER_SPATIAL_EDITOR_SIDE_RIGHT" value="3" enum="CustomControlContainer">
841 Right sidebar of the 3D editor.
842 </constant>
843 <constant name="CONTAINER_SPATIAL_EDITOR_BOTTOM" value="4" enum="CustomControlContainer">
844 Bottom panel of the 3D editor.
845 </constant>
846 <constant name="CONTAINER_CANVAS_EDITOR_MENU" value="5" enum="CustomControlContainer">
847 The toolbar that appears when 2D editor is active.
848 </constant>
849 <constant name="CONTAINER_CANVAS_EDITOR_SIDE_LEFT" value="6" enum="CustomControlContainer">
850 Left sidebar of the 2D editor.
851 </constant>
852 <constant name="CONTAINER_CANVAS_EDITOR_SIDE_RIGHT" value="7" enum="CustomControlContainer">
853 Right sidebar of the 2D editor.
854 </constant>
855 <constant name="CONTAINER_CANVAS_EDITOR_BOTTOM" value="8" enum="CustomControlContainer">
856 Bottom panel of the 2D editor.
857 </constant>
858 <constant name="CONTAINER_INSPECTOR_BOTTOM" value="9" enum="CustomControlContainer">
859 Bottom section of the inspector.
860 </constant>
861 <constant name="CONTAINER_PROJECT_SETTING_TAB_LEFT" value="10" enum="CustomControlContainer">
862 Tab of Project Settings dialog, to the left of other tabs.
863 </constant>
864 <constant name="CONTAINER_PROJECT_SETTING_TAB_RIGHT" value="11" enum="CustomControlContainer">
865 Tab of Project Settings dialog, to the right of other tabs.
866 </constant>
867 <constant name="DOCK_SLOT_NONE" value="-1" enum="DockSlot">
868 The dock is closed.
869 </constant>
870 <constant name="DOCK_SLOT_LEFT_UL" value="0" enum="DockSlot">
871 Dock slot, left side, upper-left (empty in default layout).
872 </constant>
873 <constant name="DOCK_SLOT_LEFT_BL" value="1" enum="DockSlot">
874 Dock slot, left side, bottom-left (empty in default layout).
875 </constant>
876 <constant name="DOCK_SLOT_LEFT_UR" value="2" enum="DockSlot">
877 Dock slot, left side, upper-right (in default layout includes Scene and Import docks).
878 </constant>
879 <constant name="DOCK_SLOT_LEFT_BR" value="3" enum="DockSlot">
880 Dock slot, left side, bottom-right (in default layout includes FileSystem dock).
881 </constant>
882 <constant name="DOCK_SLOT_RIGHT_UL" value="4" enum="DockSlot">
883 Dock slot, right side, upper-left (in default layout includes Inspector, Node, and History docks).
884 </constant>
885 <constant name="DOCK_SLOT_RIGHT_BL" value="5" enum="DockSlot">
886 Dock slot, right side, bottom-left (empty in default layout).
887 </constant>
888 <constant name="DOCK_SLOT_RIGHT_UR" value="6" enum="DockSlot">
889 Dock slot, right side, upper-right (empty in default layout).
890 </constant>
891 <constant name="DOCK_SLOT_RIGHT_BR" value="7" enum="DockSlot">
892 Dock slot, right side, bottom-right (empty in default layout).
893 </constant>
894 <constant name="DOCK_SLOT_BOTTOM" value="8" enum="DockSlot">
895 Bottom panel.
896 </constant>
897 <constant name="DOCK_SLOT_MAX" value="9" enum="DockSlot">
898 Represents the size of the [enum DockSlot] enum.
899 </constant>
900 <constant name="AFTER_GUI_INPUT_PASS" value="0" enum="AfterGUIInput">
901 Forwards the [InputEvent] to other EditorPlugins.
902 </constant>
903 <constant name="AFTER_GUI_INPUT_STOP" value="1" enum="AfterGUIInput">
904 Prevents the [InputEvent] from reaching other Editor classes.
905 </constant>
906 <constant name="AFTER_GUI_INPUT_CUSTOM" value="2" enum="AfterGUIInput">
907 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.
908 </constant>
909 </constants>
910</class>