mirror of
https://github.com/godotengine/godot.git
synced 2024-11-12 23:24:26 +00:00
Ensure binds are duplicated with Node
signals
(cherry picked from commit 9cf13cedfd
)
This commit is contained in:
parent
e63a7215bb
commit
9c68648d72
@ -2727,9 +2727,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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user