Skip to content

Commit

Permalink
Merge pull request #75382 from AThousandShips/duplicate_bind
Browse files Browse the repository at this point in the history
Ensure binds are duplicated with `Node` signals
  • Loading branch information
akien-mga committed Sep 1, 2023
2 parents 549fcce + 9cf13ce commit 39b1d86
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scene/main/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2722,9 +2722,15 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const {
copytarget = p_copy->get_node(ptarget);
}

if (copy && copytarget) {
const Callable copy_callable = Callable(copytarget, E.callable.get_method());
if (copy && copytarget && E.callable.get_method() != StringName()) {
Callable copy_callable = Callable(copytarget, E.callable.get_method());
if (!copy->is_connected(E.signal.get_name(), copy_callable)) {
int arg_count = E.callable.get_bound_arguments_count();
if (arg_count > 0) {
copy_callable = copy_callable.bindv(E.callable.get_bound_arguments());
} else if (arg_count < 0) {
copy_callable = copy_callable.unbind(-arg_count);
}
copy->connect(E.signal.get_name(), copy_callable, E.flags);
}
}
Expand Down

0 comments on commit 39b1d86

Please sign in to comment.