Blocking updating in SceneTreeEditor when editing an item

This commit is contained in:
gongpha 2020-12-31 14:43:03 +07:00
parent 8a1c37dc22
commit bb867d41ee
3 changed files with 9 additions and 0 deletions

View File

@ -531,6 +531,10 @@ void SceneTreeEditor::_update_tree() {
return; return;
} }
if (tree->is_editing()) {
return;
}
updating_tree = true; updating_tree = true;
tree->clear(); tree->clear();
if (get_scene_node()) { if (get_scene_node()) {

View File

@ -2981,6 +2981,10 @@ bool Tree::edit_selected() {
return false; return false;
} }
bool Tree::is_editing() {
return popup_editor->is_visible();
}
Size2 Tree::get_internal_min_size() const { Size2 Tree::get_internal_min_size() const {
Size2i size = cache.bg->get_offset(); Size2i size = cache.bg->get_offset();
if (root) { if (root) {

View File

@ -622,6 +622,7 @@ public:
int get_item_offset(TreeItem *p_item) const; int get_item_offset(TreeItem *p_item) const;
Rect2 get_item_rect(TreeItem *p_item, int p_column = -1) const; Rect2 get_item_rect(TreeItem *p_item, int p_column = -1) const;
bool edit_selected(); bool edit_selected();
bool is_editing();
// First item that starts with the text, from the current focused item down and wraps around. // 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); TreeItem *search_item_text(const String &p_find, int *r_col = nullptr, bool p_selectable = false);