diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-24 10:53:37 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-24 10:53:37 +0200 |
commit | f41e07bfe6e2ead2f2d0c2248b40c5c2cf799056 (patch) | |
tree | fee5697edb1a2279f96c4ee7a7a5e747caf77305 /editor/scene_tree_dock.cpp | |
parent | 50d17f6b8c5cfc6e225c67a7699a5d5f8ebe5654 (diff) | |
parent | 021d92fece0ebc3622f5a931b3561524e8e4ffe8 (diff) | |
download | redot-engine-f41e07bfe6e2ead2f2d0c2248b40c5c2cf799056.tar.gz |
Merge pull request #81737 from Mickeon/fix-connection-inherited-packed-scene
Fix internal `CONNECT_INHERITED` being saved in PackedScene & Make Local
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r-- | editor/scene_tree_dock.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 7a96aaf59b..0d106bf842 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -29,6 +29,7 @@ /**************************************************************************/ #include "scene_tree_dock.h" +#include "node_dock.h" #include "core/config/project_settings.h" #include "core/input/input.h" @@ -1081,6 +1082,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { undo_redo->add_do_method(node, "set_scene_file_path", ""); undo_redo->add_undo_method(node, "set_scene_file_path", node->get_scene_file_path()); _node_replace_owner(node, node, root); + _node_strip_signal_inheritance(node); + NodeDock::get_singleton()->set_node(node); // Refresh. undo_redo->add_do_method(scene_tree, "update_tree"); undo_redo->add_undo_method(scene_tree, "update_tree"); undo_redo->commit_action(); @@ -1479,6 +1482,19 @@ void SceneTreeDock::_node_replace_owner(Node *p_base, Node *p_node, Node *p_root } } +void SceneTreeDock::_node_strip_signal_inheritance(Node *p_node) { + List<Object::Connection> conns; + p_node->get_all_signal_connections(&conns); + + for (Object::Connection conn : conns) { + conn.signal.disconnect(conn.callable); + conn.signal.connect(conn.callable, conn.flags & ~CONNECT_INHERITED); + } + for (int i = 0; i < p_node->get_child_count(); i++) { + _node_strip_signal_inheritance(p_node->get_child(i)); + } +} + void SceneTreeDock::_load_request(const String &p_path) { EditorNode::get_singleton()->open_request(p_path); _local_tree_selected(); |