You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
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.
(cherry picked from commit 421ea09195)
This commit is contained in:
committed by
Rémi Verschelde
parent
a7ff22ea6d
commit
0a3bf2b627
@@ -197,7 +197,7 @@ void GroupDialog::_add_group(String p_name) {
|
||||
}
|
||||
|
||||
String name = p_name.strip_edges();
|
||||
if (name == "" || groups->search_item_text(name)) {
|
||||
if (name.empty() || groups->get_item_with_text(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -577,7 +577,10 @@ public:
|
||||
Rect2 get_item_rect(TreeItem *p_item, int p_column = -1) const;
|
||||
bool edit_selected();
|
||||
|
||||
// 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 = NULL, bool p_selectable = false);
|
||||
// First item that matches the whole text, from the first item down.
|
||||
TreeItem *get_item_with_text(const String &p_find) const;
|
||||
|
||||
Point2 get_scroll() const;
|
||||
void scroll_to_item(TreeItem *p_item);
|
||||
|
||||
Reference in New Issue
Block a user