You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a saved custom resource file contains an exported subresource, and that subresource script appears first in the list of dependencies, then the subresource icon will be shown in the FileSystem dock instead of the customized resource icon.
It looks like there's an assumption that the resource's own script would always be the first listed external dependency, but that's not the case, the order seems to shuffle unpredictably whenever the file is overwritten. Manually correcting the order in the .tscn file fixes the problem temporarily, but doesn't prevent the editor from suddenly changing it again later on.
Only the FileSystem dock is affected, the correct icon is still shown elsewhere in the editor.
I couldn't find steps that would predictably make the editor reverse the dependency order of a file, but it's happening to me frequently with normal editing, so I assume the order just isn't guaranteed.
I looked a bit into this problem and I don't see an easy way to use the dependencies correctly to find the right custom icon. If we loop on all deps, how can we find the right one?
I suggest using the script class which is already available in EditorFileSystemDirectory::FileInfo.resource_script_class. Based on this class name, the icon path should be available with EditorData::script_class_get_icon_path. I think that before 4.3 it was not mandatory to have a class name for custom resource with icon, but how, I think it is? Maybe a fallback could be to use the first dependency when the resource does not have a class name?
Seems reasonable to me to for icons to require a class_name. In that case I think it would be better not to use the first dependency as a fallback, since it can give misleading results, and show a warning instead.
Tested with v4.3.beta2.official [b75f048], no changes to this behavior from #93147.
Tested versions
v4.3.beta2.official [b75f048]
System information
Godot v4.3.beta2 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2060 (NVIDIA; 31.0.15.3623) - Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz (4 Threads)
Issue description
If a saved custom resource file contains an exported subresource, and that subresource script appears first in the list of dependencies, then the subresource icon will be shown in the FileSystem dock instead of the customized resource icon.
It looks like there's an assumption that the resource's own script would always be the first listed external dependency, but that's not the case, the order seems to shuffle unpredictably whenever the file is overwritten. Manually correcting the order in the .tscn file fixes the problem temporarily, but doesn't prevent the editor from suddenly changing it again later on.
Only the FileSystem dock is affected, the correct icon is still shown elsewhere in the editor.
This file shows the correct custom resource icon:
This file mistakenly shows the icon of the subresource, note the ext_resource order:
Steps to reproduce
I couldn't find steps that would predictably make the editor reverse the dependency order of a file, but it's happening to me frequently with normal editing, so I assume the order just isn't guaranteed.
Minimal reproduction project (MRP)
file_icon_subresource_issue.zip
The text was updated successfully, but these errors were encountered: