diff --git a/core/io/resource.cpp b/core/io/resource.cpp index d089732c2e4a..1ffa4d826287 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -37,6 +37,11 @@ #include "core/os/os.h" #include "scene/main/node.h" //only so casting works +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#include "editor/editor_string_names.h" +#endif // TOOLS_ENABLED + #include void Resource::emit_changed() { @@ -536,8 +541,9 @@ Array Resource::get_configuration_info() const { void Resource::update_configuration_info() { #ifdef TOOLS_ENABLED - // REDMSER TODO: Signal has to be moved elsewhere. It doesn't even belong in SceneTree due to being editor-centric... EditorNode perhaps? - OS::get_singleton()->get_main_loop()->emit_signal(SceneStringName(configuration_info_changed), this); + if (Engine::get_singleton()->is_editor_hint()) { + EditorNode::get_singleton()->emit_signal(EditorStringName(configuration_info_changed), this); + } #endif } diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index 2d859aadf8b0..bcf0eedc67bc 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -278,19 +278,13 @@ - - - - Emitted when the [param object]'s [code]update_configuration_info[/code] method is called. Only emitted in the editor. - - Emitted when the [param node] enters this tree. - + Emitted when the [param node]'s [method Node.update_configuration_warnings] is called. Only emitted in the editor. diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 45fb5d6bf4da..30786ffe1bd4 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -4171,14 +4171,14 @@ void EditorInspector::_notification(int p_what) { add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree"))); if (!sub_inspector) { get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed)); - get_tree()->connect(SceneStringName(configuration_info_changed), callable_mp(this, &EditorInspector::_configuration_info_changed)); + EditorNode::get_singleton()->connect(EditorStringName(configuration_info_changed), callable_mp(this, &EditorInspector::_configuration_info_changed)); } } break; case NOTIFICATION_PREDELETE: { if (!sub_inspector && is_inside_tree()) { get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed)); - get_tree()->disconnect(SceneStringName(configuration_info_changed), callable_mp(this, &EditorInspector::_configuration_info_changed)); + EditorNode::get_singleton()->disconnect(EditorStringName(configuration_info_changed), callable_mp(this, &EditorInspector::_configuration_info_changed)); } edit(nullptr); } break; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 68fcc613eea0..7bba980a504c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6156,6 +6156,7 @@ void EditorNode::_bind_methods() { ADD_SIGNAL(MethodInfo("scene_saved", PropertyInfo(Variant::STRING, "path"))); ADD_SIGNAL(MethodInfo("scene_changed")); ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "path"))); + ADD_SIGNAL(MethodInfo("configuration_info_changed", PropertyInfo(Variant::OBJECT, "object"))); } static Node *_resource_get_edited_scene() { diff --git a/editor/editor_string_names.cpp b/editor/editor_string_names.cpp index bd31d32b2dfd..dd50ababb872 100644 --- a/editor/editor_string_names.cpp +++ b/editor/editor_string_names.cpp @@ -33,6 +33,7 @@ EditorStringNames *EditorStringNames::singleton = nullptr; EditorStringNames::EditorStringNames() { + configuration_info_changed = StaticCString::create("configuration_info_changed"); Editor = StaticCString::create("Editor"); EditorFonts = StaticCString::create("EditorFonts"); EditorIcons = StaticCString::create("EditorIcons"); diff --git a/editor/editor_string_names.h b/editor/editor_string_names.h index 55d8a9c1ec0a..3fd2556ace04 100644 --- a/editor/editor_string_names.h +++ b/editor/editor_string_names.h @@ -47,6 +47,7 @@ class EditorStringNames { _FORCE_INLINE_ static EditorStringNames *get_singleton() { return singleton; } + StringName configuration_info_changed; StringName Editor; StringName EditorFonts; StringName EditorIcons; diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index f6dd77c3f516..fbcd3a62a9de 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -877,7 +877,7 @@ void SceneTreeEditor::_notification(int p_what) { get_tree()->connect("tree_process_mode_changed", callable_mp(this, &SceneTreeEditor::_tree_process_mode_changed)); get_tree()->connect("node_removed", callable_mp(this, &SceneTreeEditor::_node_removed)); get_tree()->connect("node_renamed", callable_mp(this, &SceneTreeEditor::_node_renamed)); - get_tree()->connect(SceneStringName(configuration_info_changed), callable_mp(this, &SceneTreeEditor::_config_info_changed)); + EditorNode::get_singleton()->connect(EditorStringName(configuration_info_changed), callable_mp(this, &SceneTreeEditor::_config_info_changed)); tree->connect("item_collapsed", callable_mp(this, &SceneTreeEditor::_cell_collapsed)); @@ -890,7 +890,7 @@ void SceneTreeEditor::_notification(int p_what) { get_tree()->disconnect("node_removed", callable_mp(this, &SceneTreeEditor::_node_removed)); get_tree()->disconnect("node_renamed", callable_mp(this, &SceneTreeEditor::_node_renamed)); tree->disconnect("item_collapsed", callable_mp(this, &SceneTreeEditor::_cell_collapsed)); - get_tree()->disconnect(SceneStringName(configuration_info_changed), callable_mp(this, &SceneTreeEditor::_config_info_changed)); + EditorNode::get_singleton()->disconnect(EditorStringName(configuration_info_changed), callable_mp(this, &SceneTreeEditor::_config_info_changed)); } break; case NOTIFICATION_THEME_CHANGED: { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index c0c2abd60514..f035de7e9965 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -43,6 +43,11 @@ #include "scene/resources/packed_scene.h" #include "viewport.h" +#ifdef TOOLS_ENABLED +#include "editor/editor_node.h" +#include "editor/editor_string_names.h" +#endif // TOOLS_ENABLED + #include int Node::orphan_node_count = 0; @@ -3305,7 +3310,9 @@ void Node::update_configuration_warnings() { } if (get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { get_tree()->emit_signal(SceneStringName(node_configuration_warning_changed), this); - get_tree()->emit_signal(SceneStringName(configuration_info_changed), this); + if (Engine::get_singleton()->is_editor_hint()) { + EditorNode::get_singleton()->emit_signal(EditorStringName(configuration_info_changed), this); + } } #endif } @@ -3329,8 +3336,8 @@ void Node::update_configuration_info() { if (!is_inside_tree()) { return; } - if (get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_ancestor_of(this))) { - get_tree()->emit_signal(SceneStringName(configuration_info_changed), this); + if (is_part_of_edited_scene()) { + EditorNode::get_singleton()->emit_signal(EditorStringName(configuration_info_changed), this); } #endif } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 314d20bfc7d5..752405cea6ee 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1677,7 +1677,6 @@ void SceneTree::_bind_methods() { #ifndef DISABLE_DEPRECATED ADD_SIGNAL(MethodInfo("node_configuration_warning_changed", PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node"))); #endif - ADD_SIGNAL(MethodInfo("configuration_info_changed", PropertyInfo(Variant::OBJECT, "object"))); ADD_SIGNAL(MethodInfo("process_frame")); ADD_SIGNAL(MethodInfo("physics_frame")); diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp index f4c28c3c852b..baf57bd7a500 100644 --- a/scene/scene_string_names.cpp +++ b/scene/scene_string_names.cpp @@ -112,7 +112,6 @@ SceneStringNames::SceneStringNames() { #ifndef DISABLE_DEPRECATED node_configuration_warning_changed = StaticCString::create("node_configuration_warning_changed"); #endif - configuration_info_changed = StaticCString::create("configuration_info_changed"); output = StaticCString::create("output"); diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h index b251e9dd6a70..cf3ff8f5b109 100644 --- a/scene/scene_string_names.h +++ b/scene/scene_string_names.h @@ -131,7 +131,6 @@ class SceneStringNames { #ifndef DISABLE_DEPRECATED StringName node_configuration_warning_changed; #endif - StringName configuration_info_changed; StringName output;