From bb867d41ee84c6ed979d5876556ab729205e76f8 Mon Sep 17 00:00:00 2001 From: gongpha Date: Thu, 31 Dec 2020 14:43:03 +0700 Subject: [PATCH] Blocking updating in SceneTreeEditor when editing an item --- editor/scene_tree_editor.cpp | 4 ++++ scene/gui/tree.cpp | 4 ++++ scene/gui/tree.h | 1 + 3 files changed, 9 insertions(+) diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index b8475656eed..7a9e0f7a3c1 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -531,6 +531,10 @@ void SceneTreeEditor::_update_tree() { return; } + if (tree->is_editing()) { + return; + } + updating_tree = true; tree->clear(); if (get_scene_node()) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index a968a83dad3..5d5770897e1 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2981,6 +2981,10 @@ bool Tree::edit_selected() { return false; } +bool Tree::is_editing() { + return popup_editor->is_visible(); +} + Size2 Tree::get_internal_min_size() const { Size2i size = cache.bg->get_offset(); if (root) { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index dfc02f760df..6db8d3f5bc0 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -622,6 +622,7 @@ public: int get_item_offset(TreeItem *p_item) const; Rect2 get_item_rect(TreeItem *p_item, int p_column = -1) const; bool edit_selected(); + bool is_editing(); // First item that starts with the text, from the current focused item down and wraps around. TreeItem *search_item_text(const String &p_find, int *r_col = nullptr, bool p_selectable = false);