From 5b7021434f27145550ddb5de74dc66e9273d4dcb Mon Sep 17 00:00:00 2001 From: Andreas Haas Date: Tue, 4 Oct 2016 13:27:08 +0200 Subject: ConnectionDialog: Don't allow connecting to a Node without a script if target method is invalid. Shows a warning now. Fixes #6656 --- tools/editor/connections_dialog.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/editor/connections_dialog.cpp') diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index c4f2435675..1baad2c6b3 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(); -- cgit v1.2.3