Skip to content

Use a Thread for loading multiple paths in ImportDock - #124844

Draft
NoNormalDev wants to merge 1 commit into
godotengine:masterfrom
NoNormalDev:finally
Draft

NoNormalDev wants to merge 1 commit into
godotengine:masterfrom
NoNormalDev:finally

Conversation

@NoNormalDev

@NoNormalDev NoNormalDev commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What problem(s) does this PR solve?

Editor freeze when selecting a big folder / many files (of the same type) in the FileSystem dock.

Most (98%) of that time during the freeze is spent reading .import files from the disk in ImportDock::set_edit_multiple_files(), so the solution is to do that on a Thread.

The rest of the issue is in the FileSystem dock, in FileAccess functions, which this PR doesn't cover.

More details

image

Overview

Before After
2026-10-24.19-50-58.mp4
2026-10-24.19-51-48.mp4

Changes

Moved the ImportDockParamters definition into the .h file, while keeping the implementation in the .cpp.
Replaced some includes with forward-declaration.

Created a new class - ImportDockLoader. It's job is to read .import ConfigFiles and gather information from it, basically the first half of the old set_edit_multiple_paths(). The class uses WorkerThreadPool to run the function asyncrhonously, but it also provides a way to run it on the current thread, which is used in set_edit_path().

Joined the ends of set_edit_multiple_paths() / set_edit_path() into _finish_set_edit(), to remove code duplication, and to fix some inconsistencies/bugs in the multiple paths scenario.

When the ImportDockLoader is running, a progress bar is shown. To avoid flickers if the loader completes very quickly (most of the time), I added a minimum display timer, set to 0.2 seconds.

Extended the clear() function a bit.

Some general cleanups.

Additional information

No AI was used.

For comparison, here's the profiler view (in red is marked the work that is now done on the thread, and blue is the little that remains on the main thread):
image

Mainly used https://store.godotengine.org/asset/voxy/at-icons/ for testing (contains many .svg files).

This is my biggest PR yet, so any feedback is welcome!

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.

3 participants