From 3199c294f9cb8e70fe62a19c2e0f5848376a783e Mon Sep 17 00:00:00 2001
From: passivestar <60579014+passivestar@users.noreply.github.com>
Date: Thu, 7 Mar 2024 17:28:26 +0400
Subject: [PATCH] Allow connecting signals to existing methods without opening
the script editor
---
doc/classes/EditorSettings.xml | 3 +++
editor/connections_dialog.cpp | 41 +++++++++++++++++++++-------------
editor/editor_settings.cpp | 1 +
3 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index 1c69c487865..f446d5bb1f1 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -1014,6 +1014,9 @@
If [code]true[/code], the caret will be moved when right-clicking somewhere in the script editor (like when left-clicking or middle-clicking). If [code]false[/code], the caret will only be moved when left-clicking or middle-clicking somewhere.
+
+ If [code]true[/code], opens the script editor when connecting a signal to an existing script method from the Node dock.
+
If [code]true[/code], allows scrolling past the end of the file.
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 19474d383d7..f49a373d043 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -906,25 +906,34 @@ void ConnectionsDock::_make_or_edit_connection() {
bool b_oneshot = connect_dialog->get_one_shot();
cd.flags = CONNECT_PERSIST | (b_deferred ? CONNECT_DEFERRED : 0) | (b_oneshot ? CONNECT_ONE_SHOT : 0);
- // Conditions to add function: must have a script and must not have the method already
- // (in the class, the script itself, or inherited).
- bool add_script_function = false;
+ // If the function is found in target's own script, check the editor setting
+ // to determine if the script should be opened.
+ // If the function is found in an inherited class or script no need to do anything
+ // except making a connection.
+ bool add_script_function_request = false;
Ref