diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-02-02 11:07:01 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-02-02 11:11:20 +0800 |
commit | 421ea09195d7d8dcd904eed764d62e956233e7cd (patch) | |
tree | b7c6fe00e2bc089b7502b99633f258d6f4078a72 /scene/gui/tree.cpp | |
parent | 0edcb8ed58be8bf6a5145ceaae5ff96778afb2a2 (diff) |
Fixes add group in Group Editor dialog
Before this fix, new group can't be created if any existing group starts
with the new name.
Diffstat (limited to 'scene/gui/tree.cpp')
-rw-r--r-- | scene/gui/tree.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 964f376dbd..da431d2a78 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3630,6 +3630,17 @@ TreeItem *Tree::search_item_text(const String &p_find, int *r_col, bool p_select return _search_item_text(from->get_next_visible(true), p_find, r_col, p_selectable); } +TreeItem *Tree::get_item_with_text(const String &p_find) const { + for (TreeItem *current = root; current; current = current->get_next_visible()) { + for (int i = 0; i < columns.size(); i++) { + if (current->get_text(i) == p_find) { + return current; + } + } + } + return NULL; +} + void Tree::_do_incr_search(const String &p_add) { uint64_t time = OS::get_singleton()->get_ticks_usec() / 1000; // convert to msec |