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/viewport.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'scene/main/viewport.cpp') 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 &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 &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(memnew(World)); } @@ -2473,7 +2473,7 @@ List::Element *Viewport::_gui_add_root_control(Control *p_control) { List::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::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::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(); 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(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"); -- cgit v1.2.3