-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scenes preview icon (not thumbnail image) may be wrongly set when the root node has no script #89937
Comments
Where is the scene thumbnail you are looking at? I have some issues with the scene icons in FileSystem in 4.3 dev 5, I haven't been able to make a good replication project for it, and I'm guessing it is related to this. |
I'm not sure I understand what you mean, but this issue is about this specifically:
here's an mrp that showcases the wrong icon assignment: |
OK, I have figured out something. The issue is related to the order of the resources in the scene file (which is based on the generated ids). I found that for the scenes that have the issue, the first resource is NOT the script that has the icon. And when the first resource is the script that has the icon, it works correctly. For example I might have a scene with a resource with id I have been able to fix scene files by opening them, modifying the id of the script to be before other ids. For the example above, I would, with an external editor, modify the id to - for example - So we have that:
So the fix could be on the id generation, on the way Godot looks for the icon, or both. As far as I can tell, Godot is looking for the icon only on the first resource for performance. And it is not modifying the ids to keep the diff simple (also I imagine this could make the code that generates the ids harder to mantain). Anyway, @KoBeWi I summon thee. |
I believe that avoiding iterating over all resources is a good idea. Btw, I have also found that if the root node does not have a script, but a child node has a script with a icon, sometimes Godot picks that one, which I do not believe is instended. |
I think the only reliable and performant way to achieve this is storing file icon path in EditorFileSystemCache. |
I found another wrinkle: When a scene extends another scene (scene inheritance) it does not take the parent scene icon. Addendum: In this case the scene would not list a script attached to its root node, while but the parent scene might. |
If you store the type (either script or not) instead of the icon, then it should be possible to resolve the icon from there, plus, it make these easy:
Addendum: This also avoids the need of propagating changes of the script icon to the scenes, and any issues that might come from that. |
Tested versions
v4.3.dev.custom_build [7d151c8]
System information
linux
Issue description
Steps to reproduce
Minimal reproduction project (MRP)
any
The text was updated successfully, but these errors were encountered: