diff options
Diffstat (limited to 'doc/classes/EditorPlugin.xml')
-rw-r--r-- | doc/classes/EditorPlugin.xml | 112 |
1 files changed, 64 insertions, 48 deletions
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index ab41c1c493..806588d100 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -64,8 +64,8 @@ if event is InputEventMouseMotion: # Redraw viewport when cursor is moved. update_overlays() - return true - return false + return EditorPlugin.AFTER_GUI_INPUT_STOP + return EditorPlugin.AFTER_GUI_INPUT_PASS [/gdscript] [csharp] public override void _Forward3dDrawOverViewport(Godot.Control overlay) @@ -74,15 +74,15 @@ overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White); } - public override bool _Forward3dGuiInput(Godot.Camera3D camera, InputEvent @event) + public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Godot.Camera3D camera, InputEvent @event) { if (@event is InputEventMouseMotion) { // Redraw viewport when cursor is moved. UpdateOverlays(); - return true; + return EditorPlugin.AFTER_GUI_INPUT_STOP; } - return false; + return EditorPlugin.AFTER_GUI_INPUT_PASS; [/csharp] [/codeblocks] </description> @@ -100,33 +100,35 @@ <param index="0" name="viewport_camera" type="Camera3D" /> <param index="1" name="event" type="InputEvent" /> <description> - Called when there is a root node in the current edited scene, [method _handles] is implemented and an [InputEvent] happens in the 3D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example: + 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. + [b]Example:[/b] [codeblocks] [gdscript] - # Prevents the InputEvent to reach other Editor classes. + # Prevents the InputEvent from reaching other Editor classes. func _forward_3d_gui_input(camera, event): return EditorPlugin.AFTER_GUI_INPUT_STOP [/gdscript] [csharp] - // Prevents the InputEvent to reach other Editor classes. - public override bool _Forward3dGuiInput(Camera3D camera, InputEvent @event) + // Prevents the InputEvent from reaching other Editor classes. + public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Camera3D camera, InputEvent @event) { return EditorPlugin.AFTER_GUI_INPUT_STOP; } [/csharp] [/codeblocks] - Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example: + Must [code]return EditorPlugin.AFTER_GUI_INPUT_PASS[/code] in order to forward the [InputEvent] to other Editor classes. + [b]Example:[/b] [codeblocks] [gdscript] # Consumes InputEventMouseMotion and forwards other InputEvent types. func _forward_3d_gui_input(camera, event): - return event is InputEventMouseMotion + return EditorPlugin.AFTER_GUI_INPUT_STOP if event is InputEventMouseMotion else EditorPlugin.AFTER_GUI_INPUT_PASS [/gdscript] [csharp] // Consumes InputEventMouseMotion and forwards other InputEvent types. - public override bool _Forward3dGuiInput(Camera3D camera, InputEvent @event) + public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Camera3D camera, InputEvent @event) { - return @event is InputEventMouseMotion; + return @event is InputEventMouseMotion ? EditorPlugin.AFTER_GUI_INPUT_STOP : EditorPlugin.AFTER_GUI_INPUT_PASS; } [/csharp] [/codeblocks] @@ -182,22 +184,24 @@ <return type="bool" /> <param index="0" name="event" type="InputEvent" /> <description> - Called when there is a root node in the current edited scene, [method _handles] is implemented and an [InputEvent] happens in the 2D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [code]event[/code], otherwise forwards [code]event[/code] to other Editor classes. Example: + Called when there is a root node in the current edited scene, [method _handles] is implemented and an [InputEvent] happens in the 2D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [param event], otherwise forwards [param event] to other Editor classes. + [b]Example:[/b] [codeblocks] [gdscript] - # Prevents the InputEvent to reach other Editor classes. + # Prevents the InputEvent from reaching other Editor classes. func _forward_canvas_gui_input(event): return true [/gdscript] [csharp] - // Prevents the InputEvent to reach other Editor classes. + // Prevents the InputEvent from reaching other Editor classes. public override bool ForwardCanvasGuiInput(InputEvent @event) { return true; } [/csharp] [/codeblocks] - Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. Example: + Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes. + [b]Example:[/b] [codeblocks] [gdscript] # Consumes InputEventMouseMotion and forwards other InputEvent types. @@ -237,7 +241,7 @@ # You can use a custom icon: return preload("res://addons/my_plugin/my_plugin_icon.svg") # Or use a built-in icon: - return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons") + return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons") [/gdscript] [csharp] public override Texture2D GetPluginIcon() @@ -245,7 +249,7 @@ // You can use a custom icon: return ResourceLoader.Load<Texture2D>("res://addons/my_plugin/my_plugin_icon.svg"); // Or use a built-in icon: - return GetEditorInterface().GetBaseControl().GetIcon("Node", "EditorIcons"); + return GetEditorInterface().GetBaseControl().GetThemeIcon("Node", "EditorIcons"); } [/csharp] [/codeblocks] @@ -303,7 +307,7 @@ func _enter_tree(): plugin_control = preload("my_plugin_control.tscn").instantiate() - get_editor_interface().get_editor_main_control().add_child(plugin_control) + get_editor_interface().get_editor_main_screen().add_child(plugin_control) plugin_control.hide() func _has_main_screen(): @@ -351,7 +355,7 @@ <return type="void" /> <param index="0" name="configuration" type="ConfigFile" /> <description> - 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 [code]configuration[/code] file to read your saved data. + 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. [codeblock] func _set_window_layout(configuration): $Window.position = configuration.get_value("MyPlugin", "window_position", Vector2()) @@ -364,7 +368,7 @@ <param index="0" name="name" type="String" /> <param index="1" name="path" type="String" /> <description> - Adds a script at [code]path[/code] to the Autoload list as [code]name[/code]. + Adds a script at [param path] to the Autoload list as [param name]. </description> </method> <method name="add_control_to_bottom_panel"> @@ -406,11 +410,12 @@ 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. 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. During run-time, this will be a simple object with a script so this function does not need to be called then. + [b]Note:[/b] Custom types added this way are not true classes. They are just a helper to create a node with specific script. </description> </method> <method name="add_debugger_plugin"> <return type="void" /> - <param index="0" name="script" type="Script" /> + <param index="0" name="script" type="EditorDebuggerPlugin" /> <description> Adds a [Script] as debugger plugin to the Debugger. The script must extend [EditorDebuggerPlugin]. </description> @@ -429,7 +434,7 @@ <param index="1" name="first_priority" type="bool" default="false" /> <description> Registers a new [EditorImportPlugin]. Import plugins are used to import custom and unsupported assets as a custom [Resource] type. - If [code]first_priority[/code] is [code]true[/code], the new import plugin is inserted first in the list and takes precedence over pre-existing plugins. + 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. [b]Note:[/b] If you want to import custom 3D asset formats use [method add_scene_format_importer_plugin] instead. See [method add_inspector_plugin] for an example of how to register a plugin. </description> @@ -454,13 +459,21 @@ [/codeblocks] </description> </method> + <method name="add_node_3d_gizmo_plugin"> + <return type="void" /> + <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" /> + <description> + Registers a new [EditorNode3DGizmoPlugin]. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a [Node3D]. + See [method add_inspector_plugin] for an example of how to register a plugin. + </description> + </method> <method name="add_scene_format_importer_plugin"> <return type="void" /> <param index="0" name="scene_format_importer" type="EditorSceneFormatImporter" /> <param index="1" name="first_priority" type="bool" default="false" /> <description> Registers a new [EditorSceneFormatImporter]. Scene importers are used to import custom 3D asset formats as scenes. - If [code]first_priority[/code] is [code]true[/code], the new import plugin is inserted first in the list and takes precedence over pre-existing plugins. + 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. </description> </method> <method name="add_scene_post_import_plugin"> @@ -469,15 +482,7 @@ <param index="1" name="first_priority" type="bool" default="false" /> <description> Add a [EditorScenePostImportPlugin]. These plugins allow customizing the import process of 3D assets by adding new options to the import dialogs. - If [code]first_priority[/code] is [code]true[/code], the new import plugin is inserted first in the list and takes precedence over pre-existing plugins. - </description> - </method> - <method name="add_spatial_gizmo_plugin"> - <return type="void" /> - <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" /> - <description> - Registers a new [EditorNode3DGizmoPlugin]. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for a [Node3D]. - See [method add_inspector_plugin] for an example of how to register a plugin. + 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. </description> </method> <method name="add_tool_menu_item"> @@ -485,7 +490,7 @@ <param index="0" name="name" type="String" /> <param index="1" name="callable" type="Callable" /> <description> - Adds a custom menu item to [b]Project > Tools[/b] named [code]name[/code]. When clicked, the provided [code]callable[/code] will be called. + Adds a custom menu item to [b]Project > Tools[/b] named [param name]. When clicked, the provided [param callable] will be called. </description> </method> <method name="add_tool_submenu_item"> @@ -493,7 +498,7 @@ <param index="0" name="name" type="String" /> <param index="1" name="submenu" type="PopupMenu" /> <description> - Adds a custom [PopupMenu] submenu under [b]Project > Tools >[/b] [code]name[/code]. Use [code]remove_tool_menu_item(name)[/code] on plugin clean up to remove the menu. + Adds a custom [PopupMenu] submenu under [b]Project > Tools >[/b] [param name]. Use [code]remove_tool_menu_item(name)[/code] on plugin clean up to remove the menu. </description> </method> <method name="add_translation_parser_plugin"> @@ -532,7 +537,7 @@ </description> </method> <method name="get_undo_redo"> - <return type="UndoRedo" /> + <return type="EditorUndoRedoManager" /> <description> 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. </description> @@ -560,7 +565,7 @@ <return type="void" /> <param index="0" name="name" type="String" /> <description> - Removes an Autoload [code]name[/code] from the list. + Removes an Autoload [param name] from the list. </description> </method> <method name="remove_control_from_bottom_panel"> @@ -594,7 +599,7 @@ </method> <method name="remove_debugger_plugin"> <return type="void" /> - <param index="0" name="script" type="Script" /> + <param index="0" name="script" type="EditorDebuggerPlugin" /> <description> Removes the debugger plugin with given script from the Debugger. </description> @@ -620,6 +625,13 @@ Removes an inspector plugin registered by [method add_import_plugin] </description> </method> + <method name="remove_node_3d_gizmo_plugin"> + <return type="void" /> + <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" /> + <description> + Removes a gizmo plugin registered by [method add_node_3d_gizmo_plugin]. + </description> + </method> <method name="remove_scene_format_importer_plugin"> <return type="void" /> <param index="0" name="scene_format_importer" type="EditorSceneFormatImporter" /> @@ -634,18 +646,11 @@ Remove the [EditorScenePostImportPlugin], added with [method add_scene_post_import_plugin]. </description> </method> - <method name="remove_spatial_gizmo_plugin"> - <return type="void" /> - <param index="0" name="plugin" type="EditorNode3DGizmoPlugin" /> - <description> - Removes a gizmo plugin registered by [method add_spatial_gizmo_plugin]. - </description> - </method> <method name="remove_tool_menu_item"> <return type="void" /> <param index="0" name="name" type="String" /> <description> - Removes a menu [code]name[/code] from [b]Project > Tools[/b]. + Removes a menu [param name] from [b]Project > Tools[/b]. </description> </method> <method name="remove_translation_parser_plugin"> @@ -690,11 +695,13 @@ </signal> <signal name="project_settings_changed"> <description> + Emitted when any project setting has changed. </description> </signal> <signal name="resource_saved"> <param index="0" name="resource" type="Resource" /> <description> + Emitted when the given [param resource] was saved on disc. </description> </signal> <signal name="scene_changed"> @@ -729,7 +736,7 @@ </constant> <constant name="CONTAINER_CANVAS_EDITOR_BOTTOM" value="8" enum="CustomControlContainer"> </constant> - <constant name="CONTAINER_PROPERTY_EDITOR_BOTTOM" value="9" enum="CustomControlContainer"> + <constant name="CONTAINER_INSPECTOR_BOTTOM" value="9" enum="CustomControlContainer"> </constant> <constant name="CONTAINER_PROJECT_SETTING_TAB_LEFT" value="10" enum="CustomControlContainer"> </constant> @@ -754,5 +761,14 @@ <constant name="DOCK_SLOT_MAX" value="8" enum="DockSlot"> Represents the size of the [enum DockSlot] enum. </constant> + <constant name="AFTER_GUI_INPUT_PASS" value="0" enum="AfterGUIInput"> + Forwards the [InputEvent] to other EditorPlugins. + </constant> + <constant name="AFTER_GUI_INPUT_STOP" value="1" enum="AfterGUIInput"> + Prevents the [InputEvent] from reaching other Editor classes. + </constant> + <constant name="AFTER_GUI_INPUT_CUSTOM" value="2" enum="AfterGUIInput"> + 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. + </constant> </constants> </class> |