diff options
author | Rindbee <idleman@yeah.net> | 2022-04-13 07:56:45 +0800 |
---|---|---|
committer | Rindbee <idleman@yeah.net> | 2022-04-28 08:05:16 +0800 |
commit | fbba40f04d20c711cf8f8093b8df77534034725c (patch) | |
tree | 95dccfb071033debfa4264131613460a39e67392 | |
parent | 504708ae21b9722ddbf33a2d557a6a9ed0d70855 (diff) |
Limit the maximum value of unbinds to signal_argument_size
Update editor/connections_dialog.cpp
Co-authored-by: Tomek <kobewi4e@gmail.com>
-rw-r--r-- | editor/connections_dialog.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 0f8667f81a..c9d612d4dd 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -365,6 +365,24 @@ void ConnectDialog::init(ConnectionData p_cd, bool p_edit) { deferred->set_pressed(b_deferred); oneshot->set_pressed(b_oneshot); + + MethodInfo r_signal; + Ref<Script> source_script = source->get_script(); + if (source_script.is_valid() && source_script->has_script_signal(signal)) { + List<MethodInfo> signals; + source_script->get_script_signal_list(&signals); + for (MethodInfo &mi : signals) { + if (mi.name == signal) { + r_signal = mi; + break; + } + } + } else { + ClassDB::get_signal(source->get_class(), signal, &r_signal); + } + + unbind_count->set_max(r_signal.arguments.size()); + unbind_count->set_value(p_cd.unbinds); _unbind_count_changed(p_cd.unbinds); @@ -619,6 +637,7 @@ void ConnectionsDock::_make_or_edit_connection() { if (add_script_function) { // Pick up args here before "it" is deleted by update_tree. script_function_args = it->get_metadata(0).operator Dictionary()["args"]; + script_function_args.resize(script_function_args.size() - cd.unbinds); for (int i = 0; i < cd.binds.size(); i++) { script_function_args.push_back("extra_arg_" + itos(i) + ":" + Variant::get_type_name(cd.binds[i].get_type())); } |