summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/http_request.cpp4
-rw-r--r--scene/main/node.cpp17
-rw-r--r--scene/main/scene_tree.cpp27
-rw-r--r--scene/main/viewport.cpp16
4 files changed, 28 insertions, 36 deletions
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 85bde92851..fee2ada76d 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -539,8 +539,6 @@ void HTTPRequest::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_download_chunk_size"), &HTTPRequest::set_download_chunk_size);
ClassDB::bind_method(D_METHOD("get_download_chunk_size"), &HTTPRequest::get_download_chunk_size);
- ClassDB::bind_method(D_METHOD("_timeout"), &HTTPRequest::_timeout);
-
ADD_PROPERTY(PropertyInfo(Variant::STRING, "download_file", PROPERTY_HINT_FILE), "set_download_file", "get_download_file");
ADD_PROPERTY(PropertyInfo(Variant::INT, "download_chunk_size", PROPERTY_HINT_RANGE, "256,16777216"), "set_download_chunk_size", "get_download_chunk_size");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_threads"), "set_use_threads", "is_using_threads");
@@ -589,7 +587,7 @@ HTTPRequest::HTTPRequest() {
timer = memnew(Timer);
timer->set_one_shot(true);
- timer->connect_compat("timeout", this, "_timeout");
+ timer->connect("timeout", callable_mp(this, &HTTPRequest::_timeout));
add_child(timer);
timeout = 0;
}
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 <stdint.h>
-
#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 <stdint.h>
+
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<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.callable.get_method());
ERR_CONTINUE_MSG(!valid, "Attempt to connect signal '" + c.signal.get_object()->get_class() + "." + c.signal.get_name() + "' to nonexistent method '" + c.callable.get_object()->get_class() + "." + c.callable.get_method() + "'.");
- c.signal.get_object()->connect_compat(c.signal.get_name(), p_new_target, c.callable.get_method(), c.binds, c.flags);
+ c.signal.get_object()->connect(c.signal.get_name(), Callable(p_new_target, c.callable.get_method()), c.binds, c.flags);
}
}
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index ed89b70d65..649f61c1e5 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -88,7 +88,7 @@ void SceneTreeTimer::release_connections() {
for (List<Connection>::Element *E = connections.front(); E; E = E->next()) {
Connection const &connection = E->get();
- disconnect_compat(connection.signal.get_name(), connection.callable.get_object(), connection.callable.get_method());
+ disconnect(connection.signal.get_name(), connection.callable);
}
}
@@ -1393,21 +1393,21 @@ void SceneTree::set_multiplayer(Ref<MultiplayerAPI> p_multiplayer) {
ERR_FAIL_COND(!p_multiplayer.is_valid());
if (multiplayer.is_valid()) {
- multiplayer->disconnect_compat("network_peer_connected", this, "_network_peer_connected");
- multiplayer->disconnect_compat("network_peer_disconnected", this, "_network_peer_disconnected");
- multiplayer->disconnect_compat("connected_to_server", this, "_connected_to_server");
- multiplayer->disconnect_compat("connection_failed", this, "_connection_failed");
- multiplayer->disconnect_compat("server_disconnected", this, "_server_disconnected");
+ multiplayer->disconnect("network_peer_connected", callable_mp(this, &SceneTree::_network_peer_connected));
+ multiplayer->disconnect("network_peer_disconnected", callable_mp(this, &SceneTree::_network_peer_disconnected));
+ multiplayer->disconnect("connected_to_server", callable_mp(this, &SceneTree::_connected_to_server));
+ multiplayer->disconnect("connection_failed", callable_mp(this, &SceneTree::_connection_failed));
+ multiplayer->disconnect("server_disconnected", callable_mp(this, &SceneTree::_server_disconnected));
}
multiplayer = p_multiplayer;
multiplayer->set_root_node(root);
- multiplayer->connect_compat("network_peer_connected", this, "_network_peer_connected");
- multiplayer->connect_compat("network_peer_disconnected", this, "_network_peer_disconnected");
- multiplayer->connect_compat("connected_to_server", this, "_connected_to_server");
- multiplayer->connect_compat("connection_failed", this, "_connection_failed");
- multiplayer->connect_compat("server_disconnected", this, "_server_disconnected");
+ multiplayer->connect("network_peer_connected", callable_mp(this, &SceneTree::_network_peer_connected));
+ multiplayer->connect("network_peer_disconnected", callable_mp(this, &SceneTree::_network_peer_disconnected));
+ multiplayer->connect("connected_to_server", callable_mp(this, &SceneTree::_connected_to_server));
+ multiplayer->connect("connection_failed", callable_mp(this, &SceneTree::_connection_failed));
+ multiplayer->connect("server_disconnected", callable_mp(this, &SceneTree::_server_disconnected));
}
void SceneTree::set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer) {
@@ -1528,11 +1528,6 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_rpc_sender_id"), &SceneTree::get_rpc_sender_id);
ClassDB::bind_method(D_METHOD("set_refuse_new_network_connections", "refuse"), &SceneTree::set_refuse_new_network_connections);
ClassDB::bind_method(D_METHOD("is_refusing_new_network_connections"), &SceneTree::is_refusing_new_network_connections);
- ClassDB::bind_method(D_METHOD("_network_peer_connected"), &SceneTree::_network_peer_connected);
- ClassDB::bind_method(D_METHOD("_network_peer_disconnected"), &SceneTree::_network_peer_disconnected);
- ClassDB::bind_method(D_METHOD("_connected_to_server"), &SceneTree::_connected_to_server);
- ClassDB::bind_method(D_METHOD("_connection_failed"), &SceneTree::_connection_failed);
- ClassDB::bind_method(D_METHOD("_server_disconnected"), &SceneTree::_server_disconnected);
ClassDB::bind_method(D_METHOD("set_use_font_oversampling", "enable"), &SceneTree::set_use_font_oversampling);
ClassDB::bind_method(D_METHOD("is_using_font_oversampling"), &SceneTree::is_using_font_oversampling);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 2f9c9f8a37..e027ec9b4b 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1124,7 +1124,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
_propagate_exit_world(this);
if (own_world.is_valid() && world.is_valid()) {
- world->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed");
+ world->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
}
world = p_world;
@@ -1132,7 +1132,7 @@ void Viewport::set_world(const Ref<World> &p_world) {
if (own_world.is_valid()) {
if (world.is_valid()) {
own_world = world->duplicate();
- world->connect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed");
+ world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
} else {
own_world = Ref<World>(memnew(World));
}
@@ -2473,7 +2473,7 @@ List<Control *>::Element *Viewport::_gui_add_root_control(Control *p_control) {
List<Control *>::Element *Viewport::_gui_add_subwindow_control(Control *p_control) {
- p_control->connect_compat("visibility_changed", this, "_subwindow_visibility_changed");
+ p_control->connect("visibility_changed", callable_mp(this, &Viewport::_subwindow_visibility_changed));
if (p_control->is_visible_in_tree()) {
gui.subwindow_order_dirty = true;
@@ -2568,7 +2568,7 @@ void Viewport::_gui_remove_subwindow_control(List<Control *>::Element *SI) {
Control *control = SI->get();
- control->disconnect_compat("visibility_changed", this, "_subwindow_visibility_changed");
+ control->disconnect("visibility_changed", callable_mp(this, &Viewport::_subwindow_visibility_changed));
List<Control *>::Element *E = gui.subwindows.find(control);
if (E)
@@ -2850,12 +2850,12 @@ void Viewport::set_use_own_world(bool p_world) {
if (!p_world) {
own_world = Ref<World>();
if (world.is_valid()) {
- world->disconnect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed");
+ world->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
}
} else {
if (world.is_valid()) {
own_world = world->duplicate();
- world->connect_compat(CoreStringNames::get_singleton()->changed, this, "_own_world_changed");
+ world->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &Viewport::_own_world_changed));
} else {
own_world = Ref<World>(memnew(World));
}
@@ -3194,10 +3194,6 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_default_canvas_item_texture_repeat", "mode"), &Viewport::set_default_canvas_item_texture_repeat);
ClassDB::bind_method(D_METHOD("get_default_canvas_item_texture_repeat"), &Viewport::get_default_canvas_item_texture_repeat);
- ClassDB::bind_method(D_METHOD("_subwindow_visibility_changed"), &Viewport::_subwindow_visibility_changed);
-
- ClassDB::bind_method(D_METHOD("_own_world_changed"), &Viewport::_own_world_changed);
-
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "arvr"), "set_use_arvr", "use_arvr");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");