You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Replace find with contains/has where applicable
* Replaces `find(...) != -1` with `contains` for `String` * Replaces `find(...) == -1` with `!contains` for `String` * Replaces `find(...) != -1` with `has` for containers * Replaces `find(...) == -1` with `!has` for containers
This commit is contained in:
@@ -261,7 +261,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
|
||||
if (p_unfold_path && current_path.begins_with(lpath) && current_path != lpath) {
|
||||
subdirectory_item->set_collapsed(false);
|
||||
} else {
|
||||
subdirectory_item->set_collapsed(uncollapsed_paths.find(lpath) < 0);
|
||||
subdirectory_item->set_collapsed(!uncollapsed_paths.has(lpath));
|
||||
}
|
||||
if (!searched_tokens.is_empty() && _matches_all_search_tokens(dname)) {
|
||||
parent_should_expand = true;
|
||||
@@ -407,7 +407,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
|
||||
favorites_item->set_icon(0, get_editor_theme_icon(SNAME("Favorites")));
|
||||
favorites_item->set_text(0, TTR("Favorites:"));
|
||||
favorites_item->set_metadata(0, "Favorites");
|
||||
favorites_item->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0);
|
||||
favorites_item->set_collapsed(!p_uncollapsed_paths.has("Favorites"));
|
||||
|
||||
Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
|
||||
|
||||
@@ -2300,7 +2300,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
|
||||
TreeItem *selected = tree->get_root();
|
||||
selected = tree->get_next_selected(selected);
|
||||
while (selected) {
|
||||
if (p_selected.find(selected->get_metadata(0)) >= 0) {
|
||||
if (p_selected.has(selected->get_metadata(0))) {
|
||||
selected->set_collapsed(false);
|
||||
}
|
||||
selected = tree->get_next_selected(selected);
|
||||
|
||||
Reference in New Issue
Block a user