Merge pull request #94854 from ianmccleary/custom-resource-icon-fix

Fix custom resources using incorrect icons
This commit is contained in:
Rémi Verschelde 2024-08-16 14:32:38 +02:00
commit 58020c8e0d
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1779,7 +1779,9 @@ String EditorFileSystem::_get_global_script_class(const String &p_type, const St
void EditorFileSystem::_update_file_icon_path(EditorFileSystemDirectory::FileInfo *file_info) {
String icon_path;
if (file_info->script_class_icon_path.is_empty() && !file_info->deps.is_empty()) {
if (file_info->resource_script_class != StringName()) {
icon_path = EditorNode::get_editor_data().script_class_get_icon_path(file_info->resource_script_class);
} else if (file_info->script_class_icon_path.is_empty() && !file_info->deps.is_empty()) {
const String &script_dep = file_info->deps[0]; // Assuming the first dependency is a script.
const String &script_path = script_dep.contains("::") ? script_dep.get_slice("::", 2) : script_dep;
if (!script_path.is_empty()) {