-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Fix folder color not showing up in file dialogs #84837
Fix folder color not showing up in file dialogs #84837
Conversation
616762f
to
a247eec
Compare
Btw, is force-pushing an only option to add new changes to PR? You either squash or amend, but you'll always have to force-push after that, is that right? |
Indeed, or it will force you to merge with the upstream commits, unless you just add new commits at the end |
Should I mark my PRs as drafts when there are situations like this when I need to add some changes? Or should I just re-request review when I'm ready? What's the workflow here? |
Unless you're expecting to have to do a major rework there's no need, unless it's been approved, though if you just communicate you need to fix some things there should be no issue |
28b7276
to
973327b
Compare
Oh, yeah, I missed that with subfolders. I'll fix that. And is there a way to make a folder appear in the recent tab? It's empty for me. |
When you open some file (e.g. a scene), its directory will appear in recent. |
973327b
to
797e6a3
Compare
Should be it now o(* ̄︶ ̄*)o |
797e6a3
to
aa0963a
Compare
Is there any tutorial on how to set up this code style GitHub action locally? |
Yes see here |
aa0963a
to
d2c3384
Compare
d2c3384
to
99f91b4
Compare
99f91b4
to
5388423
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works correctly now. I was a bit worried about the performance impact of recursively checking folder colors, but I tested the PR in a big project and didn't see any issues (although it's not like I have thousands of deeply nested folders).
If it is a concern maybe there could be some caching or other lookups, unsure how though, but I think the nesting should be shallow enough, though not sure how often it is queried |
5388423
to
0d6300d
Compare
I've compiled the source and verified that everything still works. I think this can be safely merged now! \( ̄︶ ̄*\)) |
I think the entire implementation is a bit iffy. This information seems like a perfect fit for the EditorFileSystem data structure rather than being limited to the FileSystemDock. EFS would also act as a cache and should make iterations easier. |
Thanks! I've decided we can merge this as is to address the existing problem. But I still think we can look into refactoring the implementation and moving color information to the editor file system. So if you're interested, feel free to look into it 🙂 |
This caused a crash for me on Linux, 6.6.3-arch1-1 Reproduction is simple: Project Manager -> New Project -> Browse project path
Edit: Is it because FileSystemDock doesn't exist in project manager? |
No, your stack trace doesn't show it crashing on the singleton or even on the previous line where we access another member of the dock class. It probably crashes because of this assignment: assigned_folder_colors = ProjectSettings::get_singleton()->get_setting("file_customization/folder_colors"); Project settings don't exist outside of a project, so this probably assigns some gibberish to the member. Edit: Well, this is pretty weird. I don't quite see why it doesn't crash on accessing the singleton, because yeah, of course there is no FileSystemDock in the PM. But somehow we can use the garbage returned by In any case, the fix would indeed be to check if |
@adamscott Your problem is different, you get an infinite loop in this: String parent_dir = p_dir_path;
while (parent_dir != "res://" && folder_icon_color == theme_cache.folder_icon_color) {
if (!parent_dir.ends_with("/")) {
parent_dir += "/";
}
if (assigned_folder_colors.has(parent_dir)) {
folder_icon_color = folder_colors[assigned_folder_colors[parent_dir]];
}
parent_dir = parent_dir.trim_suffix("/").get_base_dir();
} Because |
Fixes #83366.
Here is an example project with a bunch of colored folders to verify that my changes work: preview_project.zip.
I can also provide a compiled Windows 10 executable of the editor if someone needs it.
Screenshots:
