diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2019-11-02 13:38:25 +0000 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2019-11-02 14:41:59 +0000 |
commit | 362d38ea675f56cf56230605dd5ff6114c6bb2af (patch) | |
tree | 1a37f0d8bd723309c8c9d5e0632b5150ffd5aaf1 /editor/plugins | |
parent | 4569f5ec82964e0abe543337c9537e0af9164c11 (diff) |
Update connection info on script validation rather then saved copy
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/script_text_editor.cpp | 21 | ||||
-rw-r--r-- | editor/plugins/script_text_editor.h | 1 |
2 files changed, 17 insertions, 5 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 603a2365c1..f63445dab8 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -571,6 +571,7 @@ void ScriptTextEditor::_validate_script() { String error_text = "error(" + itos(line) + "," + itos(col) + "): " + errortxt; code_editor->set_error(error_text); code_editor->set_error_pos(line - 1, col - 1); + script_is_valid = false; } else { code_editor->set_error(""); line = -1; @@ -585,6 +586,7 @@ void ScriptTextEditor::_validate_script() { functions.push_back(E->get()); } + script_is_valid = true; } _update_connected_methods(); @@ -967,7 +969,7 @@ void ScriptTextEditor::_update_connected_methods() { text_edit->clear_info_icons(); missing_connections.clear(); - if (!script->is_valid()) { + if (!script_is_valid) { return; } @@ -1000,10 +1002,18 @@ void ScriptTextEditor::_update_connected_methods() { if (!ClassDB::has_method(script->get_instance_base_type(), connection.method)) { int line = -1; - if (script->has_method(connection.method)) { - line = script->get_member_line(connection.method); - text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); - methods_found.insert(connection.method); + + for (int j = 0; j < functions.size(); j++) { + String name = functions[j].get_slice(":", 0); + if (name == connection.method) { + line = functions[j].get_slice(":", 1).to_int(); + text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method); + methods_found.insert(connection.method); + break; + } + } + + if (line >= 0) { continue; } @@ -1728,6 +1738,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p ScriptTextEditor::ScriptTextEditor() { theme_loaded = false; + script_is_valid = false; VSplitContainer *editor_box = memnew(VSplitContainer); add_child(editor_box); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index eba75befd4..2ba0be8feb 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -59,6 +59,7 @@ class ScriptTextEditor : public ScriptEditorBase { RichTextLabel *warnings_panel; Ref<Script> script; + bool script_is_valid; Vector<String> functions; |