From f742dabafee7f54e1b77148d547e2031d7cc535e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 21 Feb 2020 23:26:13 +0100 Subject: Signals: Manually port most of remaining connect_compat uses It's tedious work... Some can't be ported as they depend on private or protected methods of different classes, which is not supported by callable_mp (even if it's a class inherited by the current one). --- scene/main/node.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'scene/main/node.cpp') diff --git a/scene/main/node.cpp b/scene/main/node.cpp index a0159c3858..973dff07d2 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -30,8 +30,6 @@ #include "node.h" -#include - #include "core/core_string_names.h" #include "core/io/resource_loader.h" #include "core/message_queue.h" @@ -46,6 +44,8 @@ #include "editor/editor_settings.h" #endif +#include + VARIANT_ENUM_CAST(Node::PauseMode); int Node::orphan_node_count = 0; @@ -2346,15 +2346,18 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { Node *copytarget = target; - // Atempt to find a path to the duplicate target, if it seems it's not part + // Attempt to find a path to the duplicate target, if it seems it's not part // of the duplicated and not yet parented hierarchy then at least try to connect // to the same target as the original if (p_copy->has_node(ptarget)) copytarget = p_copy->get_node(ptarget); - if (copy && copytarget && !copy->is_connected_compat(E->get().signal.get_name(), copytarget, E->get().callable.get_method())) { - copy->connect_compat(E->get().signal.get_name(), copytarget, E->get().callable.get_method(), E->get().binds, E->get().flags); + if (copy && copytarget) { + const Callable copy_callable = Callable(copytarget, E->get().callable.get_method()); + if (!copy->is_connected(E->get().signal.get_name(), copy_callable)) { + copy->connect(E->get().signal.get_name(), copy_callable, E->get().binds, E->get().flags); + } } } } @@ -2509,10 +2512,10 @@ void Node::_replace_connections_target(Node *p_new_target) { Connection &c = E->get(); if (c.flags & CONNECT_PERSIST) { - c.signal.get_object()->disconnect_compat(c.signal.get_name(), this, c.callable.get_method()); + c.signal.get_object()->disconnect(c.signal.get_name(), Callable(this, c.callable.get_method())); bool valid = p_new_target->has_method(c.callable.get_method()) || Ref