Skip to content
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

Project manager improvements #30735

Merged
merged 1 commit into from
Jul 23, 2019

Conversation

Zylann
Copy link
Contributor

@Zylann Zylann commented Jul 21, 2019

The project manager was reloading all files and formatting their icons every time it started or any change was made to the list. So when you have 100 projects, it takes a long time and causes lag, especially when the OS didn't cache those files yet.

This PR loads files once on startup, and further operations are done on information which is already loaded instead. This makes sorting, fav'ing, filtering much faster.

Also, icons are now loaded iteratively in a coroutine, which allows a faster start time.

In order to accomplish this, I refactored the project list to have its own class. Structuring it more explicitely made my work easier and I believe it's easier to understand what the code aims to do now, which may help for future changes.

I also changed this icon:
image

Closes #26233

Note 1:
the way we save registered projects and their favorite status complicates things a bit.
They are mixed with other editor settings and it looks like this:

...
projects/D:::PROJETS::INFO::GODOT::Plugins::HTerrain::hterrain = "D:/PROJETS/INFO/GODOT/Plugins/HTerrain/hterrain"
favorite_projects/D:::PROJETS::INFO::GODOT::Plugins::HTerrain::hterrain = "D:/PROJETS/INFO/GODOT/Plugins/HTerrain/hterrain"
projects/D:::PROJETS::INFO::GODOT::TESTS::Godot31::DrawCalls = "D:/PROJETS/INFO/GODOT/TESTS/Godot31/DrawCalls"
...

I would like to change it to be a simple dictionary like this:

projects: {
    "D:/PROJETS/INFO/GODOT/Plugins/HTerrain/hterrain": { "favorite": true },
    "D:/PROJETS/INFO/GODOT/TESTS/Godot31/DrawCalls": { }
}

And eventually move those to their own file. However it would break compatibility, unless some migration code is added. It's not hard to do, but I preferred to not do it in this PR as it's just improvements, not features.

Note 2:
The .cpp diff is hard to read, so I'd suggest to just focus on lines from 925 to 2576, which is where I did the changes. Some of the code remained the same, just moved elsewhere.

- Faster launch time by loading icons in a coroutine
- Faster sorting, filtering, fav'ing etc
- Refactored project list with a proper structured class
@Zylann Zylann force-pushed the project_manager_improvement branch from 42cf0a5 to d365288 Compare July 21, 2019 19:47
@Calinou
Copy link
Member

Calinou commented Jul 21, 2019

I would like to change it to be a simple dictionary like this:

For that future change, the favorite projects dictionary could be saved to a separate file using ConfigFile. It'd probably look a bit different, but the idea is the same 😉

@Zylann
Copy link
Contributor Author

Zylann commented Jul 21, 2019

@Calinou I actually meant putting favorite in the same dictionary as one attribute of a project, because it maps better to how the list works. Also no need to repeat the same path somewhere else ;)

@Calinou
Copy link
Member

Calinou commented Jul 21, 2019

@Zylann Good point. This could also be reused for future metadata additions like categories 🙂

@akien-mga akien-mga added this to the 3.2 milestone Jul 22, 2019
@akien-mga akien-mga merged commit c7a4272 into godotengine:master Jul 23, 2019
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The ProjectManager takes a long time to open due to loading project icons
4 participants