Skip to content

Commit

Permalink
Merge pull request #89642 from permelin/fix-favorite-icon
Browse files Browse the repository at this point in the history
Resource file not found error when loading Favorite icon
  • Loading branch information
akien-mga committed Mar 24, 2024
2 parents c9c0205 + ae6410b commit dd66853
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
int index;
EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(favorite, &index);
if (dir) {
icon = _get_tree_item_icon(dir->get_file_import_is_valid(index), dir->get_file_path(index), dir->get_file_type(index));
icon = _get_tree_item_icon(dir->get_file_import_is_valid(index), dir->get_file_type(index), _get_entry_script_icon(dir, index));
} else {
icon = get_editor_theme_icon(SNAME("File"));
}
Expand Down Expand Up @@ -1004,6 +1004,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
fi.path = favorite;
if (efd) {
fi.type = efd->get_file_type(index);
fi.icon_path = _get_entry_script_icon(efd, index);
fi.import_broken = !efd->get_file_import_is_valid(index);
fi.modified_time = efd->get_file_modified_time(index);
} else {
Expand Down Expand Up @@ -1096,6 +1097,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
fi.name = efd->get_file(i);
fi.path = directory.path_join(fi.name);
fi.type = efd->get_file_type(i);
fi.icon_path = _get_entry_script_icon(efd, i);
fi.import_broken = !efd->get_file_import_is_valid(i);
fi.modified_time = efd->get_file_modified_time(i);

Expand All @@ -1113,19 +1115,17 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
FileInfo *finfo = &(E);
String fname = finfo->name;
String fpath = finfo->path;
String ftype = finfo->type;

Ref<Texture2D> type_icon;
Ref<Texture2D> big_icon;

String tooltip = fpath;

// Select the icons.
type_icon = _get_tree_item_icon(!finfo->import_broken, finfo->type, finfo->icon_path);
if (!finfo->import_broken) {
type_icon = (has_theme_icon(ftype, EditorStringName(EditorIcons))) ? get_editor_theme_icon(ftype) : get_editor_theme_icon(SNAME("Object"));
big_icon = file_thumbnail;
} else {
type_icon = get_editor_theme_icon(SNAME("ImportFail"));
big_icon = file_thumbnail_broken;
tooltip += "\n" + TTR("Status: Import of file failed. Please fix file and reimport manually.");
}
Expand Down

0 comments on commit dd66853

Please sign in to comment.