From 01afc442c73661df677c2b93f4037a21992ee45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 21 Feb 2020 18:28:45 +0100 Subject: Signals: Port connect calls to use callable_mp Remove now unnecessary bindings of signal callbacks in the public API. There might be some false positives that need rebinding if they were meant to be public. No regular expressions were harmed in the making of this commit. (Nah, just kidding.) --- modules/visual_script/visual_script_property_selector.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'modules/visual_script/visual_script_property_selector.cpp') diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index 20bad364dc..f8b8a9f00b 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -522,7 +522,7 @@ void VisualScriptPropertySelector::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { - connect_compat("confirmed", this, "_confirmed"); + connect("confirmed", callable_mp(this, &VisualScriptPropertySelector::_confirmed)); } } @@ -690,11 +690,6 @@ void VisualScriptPropertySelector::show_window(float p_screen_ratio) { void VisualScriptPropertySelector::_bind_methods() { - ClassDB::bind_method(D_METHOD("_text_changed"), &VisualScriptPropertySelector::_text_changed); - ClassDB::bind_method(D_METHOD("_confirmed"), &VisualScriptPropertySelector::_confirmed); - ClassDB::bind_method(D_METHOD("_sbox_input"), &VisualScriptPropertySelector::_sbox_input); - ClassDB::bind_method(D_METHOD("_item_selected"), &VisualScriptPropertySelector::_item_selected); - ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::STRING, "category"), PropertyInfo(Variant::BOOL, "connecting"))); } @@ -705,16 +700,16 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() { //set_child_rect(vbc); search_box = memnew(LineEdit); vbc->add_margin_child(TTR("Search:"), search_box); - search_box->connect_compat("text_changed", this, "_text_changed"); - search_box->connect_compat("gui_input", this, "_sbox_input"); + search_box->connect("text_changed", callable_mp(this, &VisualScriptPropertySelector::_text_changed)); + search_box->connect("gui_input", callable_mp(this, &VisualScriptPropertySelector::_sbox_input)); search_options = memnew(Tree); vbc->add_margin_child(TTR("Matches:"), search_options, true); get_ok()->set_text(TTR("Open")); get_ok()->set_disabled(true); register_text_enter(search_box); set_hide_on_ok(false); - search_options->connect_compat("item_activated", this, "_confirmed"); - search_options->connect_compat("cell_selected", this, "_item_selected"); + search_options->connect("item_activated", callable_mp(this, &VisualScriptPropertySelector::_confirmed)); + search_options->connect("cell_selected", callable_mp(this, &VisualScriptPropertySelector::_item_selected)); search_options->set_hide_root(true); search_options->set_hide_folding(true); virtuals_only = false; -- cgit v1.2.3 From 09a6a2d8f83473b4893b4dd04ff31972e267d5d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 27 Feb 2020 22:49:16 +0100 Subject: Signals: Port more uses of connect_compat Those were problematic as they call a method of their parent class, but callable_mp does not allow that unless it's public. To solve it, we declare a local class that calls the parent class' method, which now needs to be protected to be accessible in the derived class. --- modules/visual_script/visual_script_property_selector.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/visual_script/visual_script_property_selector.cpp') diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index f8b8a9f00b..a2baacb619 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -518,6 +518,10 @@ void VisualScriptPropertySelector::_item_selected() { help_bit->set_text(text); } +void VisualScriptPropertySelector::_hide_requested() { + _closed(); // From WindowDialog. +} + void VisualScriptPropertySelector::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE) { @@ -716,7 +720,7 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() { seq_connect = false; help_bit = memnew(EditorHelpBit); vbc->add_margin_child(TTR("Description:"), help_bit); - help_bit->connect_compat("request_hide", this, "_closed"); + help_bit->connect("request_hide", callable_mp(this, &VisualScriptPropertySelector::_hide_requested)); search_options->set_columns(3); search_options->set_column_expand(1, false); search_options->set_column_expand(2, false); -- cgit v1.2.3