Merge pull request #12893 from Chaosus/dupsignals

Duplicate signals fixes
This commit is contained in:
Rémi Verschelde 2017-11-13 17:13:11 +01:00 committed by GitHub
commit 390e957ba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 13 deletions

View file

@ -860,6 +860,14 @@ Node *SceneTreeDock::_duplicate(Node *p_node, Map<Node *, Node *> &duplimap) {
node->set(name, value);
}
List<Connection> conns;
p_node->get_all_signal_connections(&conns);
for (List<Connection>::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<Node::GroupInfo> group_info;
p_node->get_groups(&group_info);
for (List<Node::GroupInfo>::Element *E = group_info.front(); E; E = E->next()) {

View file

@ -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<Node *, Node *> &p_reown_map) const {
if (get_owner() != get_parent()->get_owner())

View file

@ -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<Node *, Node *> &p_reown_map) const;
Node *_duplicate(int p_flags) const;
Array _get_children() const;
Array _get_groups() const;