Godot Engine – Multi-platform 2D and 3D game engine
Suppress item selection events when updating script outline.
Pāvels Nadtočajevse6a4274722ab
diff --git a/editor/script/script_editor_plugin.cpp b/editor/script/script_editor_plugin.cppindex 7f6fe36d509..2c53a1e58da 100644--- a/editor/script/script_editor_plugin.cpp+++ b/editor/script/script_editor_plugin.cpp@@ -682,6 +682,9 @@ void DocumentOutline::_notification(int p_what) {}void DocumentOutline::_tree_selected() {+ if (updating_outline) {+ return;+ }Control *active_editor = script_editor->get_active_editor();int line = tree->get_selected()->get_metadata(0);if (TextEditorBase *teb = Object::cast_to<TextEditorBase>(active_editor)) {@@ -714,6 +717,8 @@ void DocumentOutline::update_outline() {}current_editor = active_editor;+ updating_outline = true;+tree->clear();tree->create_item();@@ -818,6 +823,7 @@ void DocumentOutline::update_outline() {}}}+ updating_outline = false;}void DocumentOutline::update_visibility() {diff --git a/editor/script/script_editor_plugin.h b/editor/script/script_editor_plugin.hindex d81483250d1..bf73b06b7e8 100644--- a/editor/script/script_editor_plugin.h+++ b/editor/script/script_editor_plugin.h@@ -130,6 +130,7 @@ class DocumentOutline : public VBoxContainer {bool help_overview_enabled = false;Control *current_editor = nullptr;+ bool updating_outline = false;void _toggle_sort(bool p_alphabetic_sort);void _tree_selected();