1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Fix FileSystem dock won't show any file folders (v2)

This commit is contained in:
Hilderin
2024-06-11 20:11:10 -04:00
parent ee363af0ed
commit 1b0c5cbc01
7 changed files with 147 additions and 63 deletions

View File

@@ -1043,30 +1043,32 @@ void EditorNode::_resources_reimporting(const Vector<String> &p_resources) {
// the inherited scene. Then, get_modified_properties_for_node will return the mesh property,
// which will trigger a recopy of the previous mesh, preventing the reload.
scenes_modification_table.clear();
List<String> scenes;
scenes_reimported.clear();
resources_reimported.clear();
EditorFileSystem *editor_file_system = EditorFileSystem::get_singleton();
for (const String &res_path : p_resources) {
if (ResourceLoader::get_resource_type(res_path) == "PackedScene") {
scenes.push_back(res_path);
// It's faster to use EditorFileSystem::get_file_type than fetching the resource type from disk.
// This makes a big difference when reimporting many resources.
String file_type = editor_file_system->get_file_type(res_path);
if (file_type.is_empty()) {
file_type = ResourceLoader::get_resource_type(res_path);
}
if (file_type == "PackedScene") {
scenes_reimported.push_back(res_path);
} else {
resources_reimported.push_back(res_path);
}
}
if (scenes.size() > 0) {
preload_reimporting_with_path_in_edited_scenes(scenes);
if (scenes_reimported.size() > 0) {
preload_reimporting_with_path_in_edited_scenes(scenes_reimported);
}
}
void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
List<String> scenes;
int current_tab = scene_tabs->get_current_tab();
for (const String &res_path : p_resources) {
String file_type = ResourceLoader::get_resource_type(res_path);
if (file_type == "PackedScene") {
scenes.push_back(res_path);
// Reload later if needed, first go with normal resources.
continue;
}
for (const String &res_path : resources_reimported) {
if (!ResourceCache::has(res_path)) {
// Not loaded, no need to reload.
continue;
@@ -1080,16 +1082,20 @@ void EditorNode::_resources_reimported(const Vector<String> &p_resources) {
// Editor may crash when related animation is playing while re-importing GLTF scene, stop it in advance.
AnimationPlayer *ap = AnimationPlayerEditor::get_singleton()->get_player();
if (ap && scenes.size() > 0) {
if (ap && scenes_reimported.size() > 0) {
ap->stop(true);
}
for (const String &E : scenes) {
for (const String &E : scenes_reimported) {
reload_scene(E);
}
reload_instances_with_path_in_edited_scenes();
scenes_modification_table.clear();
scenes_reimported.clear();
resources_reimported.clear();
_set_current_scene_nocheck(current_tab);
}
@@ -5198,6 +5204,8 @@ void EditorNode::save_editor_layout_delayed() {
}
void EditorNode::_load_editor_layout() {
EditorProgress ep("loading_editor_layout", TTR("Loading editor"), 5);
ep.step(TTR("Loading editor layout..."), 0, true);
Ref<ConfigFile> config;
config.instantiate();
Error err = config->load(EditorPaths::get_singleton()->get_project_settings_dir().path_join("editor_layout.cfg"));
@@ -5219,11 +5227,19 @@ void EditorNode::_load_editor_layout() {
return;
}
ep.step(TTR("Loading docks..."), 1, true);
editor_dock_manager->load_docks_from_config(config, "docks");
ep.step(TTR("Reopening scenes..."), 2, true);
_load_open_scenes_from_config(config);
ep.step(TTR("Loading central editor layout..."), 3, true);
_load_central_editor_layout_from_config(config);
ep.step(TTR("Loading plugin window layout..."), 4, true);
editor_data.set_plugin_window_layout(config);
ep.step(TTR("Editor layout ready."), 5, true);
}
void EditorNode::_save_central_editor_layout_to_config(Ref<ConfigFile> p_config_file) {
@@ -6287,8 +6303,6 @@ void EditorNode::reload_instances_with_path_in_edited_scenes() {
editor_data.restore_edited_scene_state(editor_selection, &editor_history);
scenes_modification_table.clear();
progress.step(TTR("Reloading done."), editor_data.get_edited_scene_count());
}