summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-02 19:27:51 +0100
committerGitHub <noreply@github.com>2019-11-02 19:27:51 +0100
commit0a9df181af2281eedc2f481caec505fd746b71df (patch)
treedc63e41266a3376b3324cd0cf8e4c8b2e639e6d3
parent7210bed2b123865555fad25ed5420a8345513a43 (diff)
parent362d38ea675f56cf56230605dd5ff6114c6bb2af (diff)
Merge pull request #33268 from Paulb23/33128_connection_info_validate
Update connection info on script validation rather then saved copy
-rw-r--r--editor/plugins/script_text_editor.cpp21
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--scene/gui/text_edit.cpp4
3 files changed, 20 insertions, 6 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;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 5e6e038f38..c818633f48 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -3928,7 +3928,9 @@ void TextEdit::_base_insert_text(int p_line, int p_char, const String &p_text, i
if (shift_first_line) {
text.set_breakpoint(p_line + 1, text.is_breakpoint(p_line));
text.set_hidden(p_line + 1, text.is_hidden(p_line));
- text.set_info_icon(p_line + 1, text.get_info_icon(p_line), text.get_info(p_line));
+ if (text.has_info_icon(p_line)) {
+ text.set_info_icon(p_line + 1, text.get_info_icon(p_line), text.get_info(p_line));
+ }
text.set_breakpoint(p_line, false);
text.set_hidden(p_line, false);