diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 6b008838e5c..7ada3350076 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -860,6 +860,14 @@ Node *SceneTreeDock::_duplicate(Node *p_node, Map &duplimap) { node->set(name, value); } + List conns; + p_node->get_all_signal_connections(&conns); + for (List::Element *E = conns.front(); E; E = E->next()) { + if (E->get().flags & CONNECT_PERSIST) { + node->connect(E->get().signal, E->get().target, E->get().method, E->get().binds, E->get().flags); + } + } + List group_info; p_node->get_groups(&group_info); for (List::Element *E = group_info.front(); E; E = E->next()) { diff --git a/scene/main/node.cpp b/scene/main/node.cpp index e6e11de1771..1889c09d9e8 100755 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2067,7 +2067,7 @@ int Node::get_position_in_parent() const { return data.pos; } -Node *Node::_duplicate(int p_flags) const { +Node *Node::duplicate(int p_flags) const { Node *node = NULL; @@ -2170,17 +2170,6 @@ Node *Node::_duplicate(int p_flags) const { return node; } -Node *Node::duplicate(int p_flags) const { - - Node *dupe = _duplicate(p_flags); - - if (dupe && (p_flags & DUPLICATE_SIGNALS)) { - _duplicate_signals(this, dupe); - } - - return dupe; -} - void Node::_duplicate_and_reown(Node *p_new_parent, const Map &p_reown_map) const { if (get_owner() != get_parent()->get_owner()) diff --git a/scene/main/node.h b/scene/main/node.h index c43e96063f0..e8901f7b6ee 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -169,7 +169,6 @@ private: void _duplicate_signals(const Node *p_original, Node *p_copy) const; void _duplicate_and_reown(Node *p_new_parent, const Map &p_reown_map) const; - Node *_duplicate(int p_flags) const; Array _get_children() const; Array _get_groups() const;