Fix FileSystemDock thumbnails sometimes not displaying

There were (at least) three cases where thumbnails would not display, if they were generated while the FileSystemDock was not visible:
	- current_path == "Favorites", due to p_path not starting with "Favorites"
	- current_path == "res://", due to current_path having last "/" trimmed for comparison
	- current_path pointing to a selected file instead of folder, since it no longer matches p_path's base directory

This change removes the current_path and is_visible_in_tree checks when determining whether to update the file's icon.

Fixes #90801
Fixes #91432
This commit is contained in:
aaronp64 2024-05-02 13:05:53 -04:00
parent 4e9543d849
commit 831a085f67

View File

@ -778,7 +778,7 @@ void FileSystemDock::navigate_to_path(const String &p_path) {
}
void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata) {
if ((file_list_vb->is_visible_in_tree() || current_path.trim_suffix("/") == p_path.get_base_dir()) && p_preview.is_valid()) {
if (p_preview.is_valid()) {
Array uarr = p_udata;
int idx = uarr[0];
String file = uarr[1];