From bfc1679f14e4c4278e55d3945d7444dbf977537a Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 23 Aug 2022 13:21:09 +0200 Subject: [PATCH] Actually register EditorInterface, SpatialEditor, CanvasItemEditor, and WebNodeEditor as globals. --- editor/editor_node.cpp | 3 +++ editor/plugins/canvas_item_editor_plugin.cpp | 3 +++ editor/plugins/spatial_editor_plugin.cpp | 3 +++ modules/web/editor/web_editor_plugin.cpp | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6f20d27db..74ef413cd 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6786,6 +6786,7 @@ EditorNode::EditorNode() { editor_interface = memnew(EditorInterface); add_child(editor_interface); + Engine::get_singleton()->add_global("EditorInterface", editor_interface); //more visually meaningful to have this later raise_bottom_panel_item(AnimationPlayerEditor::get_singleton()); @@ -6992,6 +6993,8 @@ EditorNode::EditorNode() { } EditorNode::~EditorNode() { + Engine::get_singleton()->remove_global("EditorInterface"); + EditorInspector::cleanup_plugins(); remove_print_handler(&print_handler); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 64df1b1b7..ff5b547d6 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5818,9 +5818,12 @@ CanvasItemEditorPlugin::CanvasItemEditorPlugin(EditorNode *p_node) { editor->get_viewport()->add_child(canvas_item_editor); canvas_item_editor->set_anchors_and_margins_preset(Control::PRESET_WIDE); canvas_item_editor->hide(); + + Engine::get_singleton()->add_global("CanvasItemEditor", canvas_item_editor); } CanvasItemEditorPlugin::~CanvasItemEditorPlugin() { + Engine::get_singleton()->remove_global("CanvasItemEditor"); } void CanvasItemEditorViewport::_on_mouse_exit() { diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 424bac046..078bab4a4 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -7590,7 +7590,10 @@ SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) { spatial_editor->hide(); spatial_editor->connect("transform_key_request", editor->get_inspector_dock(), "_transform_keyed"); + + Engine::get_singleton()->add_global("SpatialEditor", spatial_editor); } SpatialEditorPlugin::~SpatialEditorPlugin() { + Engine::get_singleton()->remove_global("SpatialEditor"); } diff --git a/modules/web/editor/web_editor_plugin.cpp b/modules/web/editor/web_editor_plugin.cpp index f3f19c275..14dcef43c 100644 --- a/modules/web/editor/web_editor_plugin.cpp +++ b/modules/web/editor/web_editor_plugin.cpp @@ -21,6 +21,7 @@ SOFTWARE. */ #include "web_editor_plugin.h" +#include "core/config/engine.h" #include "../http/web_node.h" #include "web_editor.h" @@ -139,9 +140,12 @@ WebEditorPlugin::WebEditorPlugin(EditorNode *p_node) { make_visible(false); _scene_has_webnode = false; + + Engine::get_singleton()->add_global("WebNodeEditor", window); } WebEditorPlugin::~WebEditorPlugin() { + Engine::get_singleton()->remove_global("WebNodeEditor"); } void WebEditorPlugin::_notification(int p_what) {