|
@@ -1988,7 +1988,7 @@ void EditorFileSystem::_update_scene_groups() {
|
|
|
}
|
|
|
|
|
|
if (ep) {
|
|
|
- ep->step(efd->files[index]->file, step_count++);
|
|
|
+ ep->step(efd->files[index]->file, step_count++, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2706,6 +2706,16 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
|
|
|
|
|
|
EditorProgress *ep = memnew(EditorProgress("reimport", TTR("(Re)Importing Assets"), p_files.size()));
|
|
|
|
|
|
+ // The method reimport_files runs on the main thread, and if VSync is enabled
|
|
|
+ // or Update Continuously is disabled, Main::Iteration takes longer each frame.
|
|
|
+ // Each EditorProgress::step can trigger a redraw, and when there are many files to import,
|
|
|
+ // this could lead to a slow import process, especially when the editor is unfocused.
|
|
|
+ // Temporarily disabling VSync and low_processor_usage_mode while reimporting fixes this.
|
|
|
+ const bool old_low_processor_usage_mode = OS::get_singleton()->is_in_low_processor_usage_mode();
|
|
|
+ const DisplayServer::VSyncMode old_vsync_mode = DisplayServer::get_singleton()->window_get_vsync_mode(DisplayServer::MAIN_WINDOW_ID);
|
|
|
+ OS::get_singleton()->set_low_processor_usage_mode(false);
|
|
|
+ DisplayServer::get_singleton()->window_set_vsync_mode(DisplayServer::VSyncMode::VSYNC_DISABLED);
|
|
|
+
|
|
|
Vector<ImportFile> reimport_files;
|
|
|
|
|
|
HashSet<String> groups_to_reimport;
|
|
@@ -2836,6 +2846,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ ep->step(TTR("Finalizing Asset Import..."), p_files.size());
|
|
|
|
|
|
ResourceUID::get_singleton()->update_cache(); // After reimporting, update the cache.
|
|
|
_save_filesystem_cache();
|
|
@@ -2843,6 +2854,11 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
|
|
|
memdelete_notnull(ep);
|
|
|
|
|
|
_process_update_pending();
|
|
|
+
|
|
|
+ // Revert to previous values to restore editor settings for VSync and Update Continuously.
|
|
|
+ OS::get_singleton()->set_low_processor_usage_mode(old_low_processor_usage_mode);
|
|
|
+ DisplayServer::get_singleton()->window_set_vsync_mode(old_vsync_mode);
|
|
|
+
|
|
|
importing = false;
|
|
|
|
|
|
ep = memnew(EditorProgress("reimport", TTR("(Re)Importing Assets"), p_files.size()));
|