diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-04 10:10:01 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-04 10:10:01 +0200 |
commit | d522c201860d743ce9ba4da68a9edb2400823b0b (patch) | |
tree | 1d6edf0fc141358a2501f347ac485e6f4b90adda | |
parent | 5f1184e93fe1021c86520460dc0a6619bff3c1fb (diff) | |
parent | 989056b85e694dc1800be0c814af08f41d79bf56 (diff) | |
download | redot-engine-d522c201860d743ce9ba4da68a9edb2400823b0b.tar.gz |
Merge pull request #92465 from Frefreak/signal-connection-dialog-enhance
Make signal connections dialog method picker respect bind/unbind
-rw-r--r-- | editor/connections_dialog.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 4f669c774b..1145a10f71 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -281,20 +281,32 @@ List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_me bool check_signal = compatible_methods_only->is_pressed(); List<MethodInfo> ret; + List<Pair<Variant::Type, StringName>> effective_args; + int unbind = get_unbinds(); + for (int i = 0; i < p_signal.arguments.size() - unbind; i++) { + PropertyInfo pi = p_signal.arguments.get(i); + effective_args.push_back(Pair(pi.type, pi.class_name)); + } + if (unbind == 0) { + for (const Variant &variant : get_binds()) { + effective_args.push_back(Pair(variant.get_type(), StringName())); + } + } + for (const MethodInfo &mi : p_methods) { if (!p_search_string.is_empty() && !mi.name.containsn(p_search_string)) { continue; } if (check_signal) { - if (mi.arguments.size() != p_signal.arguments.size()) { + if (mi.arguments.size() != effective_args.size()) { continue; } bool type_mismatch = false; - const List<PropertyInfo>::Element *E = p_signal.arguments.front(); + const List<Pair<Variant::Type, StringName>>::Element *E = effective_args.front(); for (const List<PropertyInfo>::Element *F = mi.arguments.front(); F; F = F->next(), E = E->next()) { - Variant::Type stype = E->get().type; + Variant::Type stype = E->get().first; Variant::Type mtype = F->get().type; if (stype != Variant::NIL && mtype != Variant::NIL && stype != mtype) { @@ -302,7 +314,7 @@ List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_me break; } - if (stype == Variant::OBJECT && mtype == Variant::OBJECT && !ClassDB::is_parent_class(E->get().class_name, F->get().class_name)) { + if (stype == Variant::OBJECT && mtype == Variant::OBJECT && !ClassDB::is_parent_class(E->get().second, F->get().class_name)) { type_mismatch = true; break; } |