diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-06-14 15:18:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-14 15:18:54 +0200 |
commit | 578f8d7c43fca84fee51eb6e450907f89ba61dcb (patch) | |
tree | c73a2ecf20cef5079f21f0bc143aa75aa723f9ed /editor/plugins | |
parent | 2f0f7db42b2f2011d6d8a759b89a1be5c795d264 (diff) | |
parent | 28683237c511eca729dbccb39107e49200f66544 (diff) |
Merge pull request #29757 from YeldhamDev/signal_detect_inherited_methods
Check for inherited methods before attempting to create one when connecting a signal
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index cea65bb9b4..c7a438948d 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -882,26 +882,29 @@ void ScriptTextEditor::_update_connected_methods() { continue; } - int line = script->get_language()->find_function(connection.method, text_edit->get_text()); - if (line < 0) { - // There is a chance that the method is inherited from another script. - bool found_inherited_function = false; - Ref<Script> inherited_script = script->get_base_script(); - while (!inherited_script.is_null()) { - line = inherited_script->get_language()->find_function(connection.method, inherited_script->get_source_code()); - if (line != -1) { - found_inherited_function = true; - break; + if (!ClassDB::has_method(script->get_instance_base_type(), connection.method)) { + + int line = script->get_language()->find_function(connection.method, text_edit->get_text()); + if (line < 0) { + // There is a chance that the method is inherited from another script. + bool found_inherited_function = false; + Ref<Script> inherited_script = script->get_base_script(); + while (!inherited_script.is_null()) { + line = inherited_script->get_language()->find_function(connection.method, inherited_script->get_source_code()); + if (line != -1) { + found_inherited_function = true; + break; + } + + inherited_script = inherited_script->get_base_script(); } - inherited_script = inherited_script->get_base_script(); - } - - if (!found_inherited_function) { - missing_connections.push_back(connection); + if (!found_inherited_function) { + missing_connections.push_back(connection); + } + } else { + text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); } - } else { - text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); } } } |