From 9593863a92915c4e0816ac4af013be2983f56ca5 Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Tue, 4 Oct 2016 13:27:08 +0200 Subject: [PATCH] ConnectionDialog: Don't allow connecting to a Node without a script if target method is invalid. Shows a warning now. Fixes #6656 (cherry picked from commit 5b7021434f27145550ddb5de74dc66e9273d4dcb) --- tools/editor/connections_dialog.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index bdc420c70f7..6725103bdae 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -181,6 +181,14 @@ void ConnectDialog::ok_pressed() { error->popup_centered_minsize(); return; } + Node* target = tree->get_selected(); + if (target->get_script().is_null()) { + if (!target->has_method(dst_method->get_text())) { + error->set_text(TTR("Target method not found! Specify a valid method or attach a script to target Node.")); + error->popup_centered_minsize(); + return; + } + } emit_signal("connected"); hide();