From 585d9663d60cdf80222c2fa33359a9d6edcd1a02 Mon Sep 17 00:00:00 2001 From: Alexander Montag Date: Sun, 29 Sep 2024 18:12:18 +0200 Subject: [PATCH] Fix optimization through which the parent count is not drawn --- editor/tree_search.cpp | 5 +++-- editor/tree_search.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/editor/tree_search.cpp b/editor/tree_search.cpp index 4249dfa..599544e 100644 --- a/editor/tree_search.cpp +++ b/editor/tree_search.cpp @@ -93,8 +93,9 @@ void TreeSearch::_clear_filter() { void TreeSearch::_highlight_tree() { ERR_FAIL_COND(!tree_reference); - for (int i = 0; i < matching_entries.size(); i++) { - TreeItem *tree_item = matching_entries[i]; + // This might not be the prettiest, but it is the most efficient solution probably. + for (HashMap::Iterator it = number_matches.begin(); it != number_matches.end(); ++it) { + TreeItem *tree_item = it->key; _highlight_tree_item(tree_item); } tree_reference->queue_redraw(); diff --git a/editor/tree_search.h b/editor/tree_search.h index 6e6ea32..676ccc7 100644 --- a/editor/tree_search.h +++ b/editor/tree_search.h @@ -56,6 +56,7 @@ private: // linearized ordering of tree items. Vector ordered_tree_items; // entires that match the search mask. + // TODO: Decide if this can be removed. It can be implicitly infered from number_matches. Vector matching_entries; // number of descendant matches for each tree item. HashMap number_matches; @@ -122,7 +123,7 @@ private: CheckBox *check_button_filter_highlight; void _initialize_controls(); void _add_spacer(float width_multiplier = 1.f); - + void _notification(int p_what); protected: