Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
640b197
D3D12: Avoid validation warnings about zero-sized barrier groups
DarioSamo Jul 25, 2024
3ae633a
Report shader arrays sized after spec constants as zero-sized
RandomShaper Jul 31, 2024
cc6dbfa
Add bounds function to NavigationMeshSourceGeometryData
smix8 Aug 4, 2024
55cba2e
OpenXR - Support for the Logitech MxInk Stylus
Kimau Aug 8, 2024
c8754d1
Add Russian translation to Linux .desktop file
OlesyaGerasimenko Aug 8, 2024
d5ac846
Remove unnecessary DLL export attributes.
bruvzg Aug 12, 2024
219fe64
[Windows] Add Intel Gen7.5/Gen8/Gen9 GPUs to Angle blocklist.
bruvzg Aug 14, 2024
45b00cb
Add hint for oneshot & warning when it will be updated continuously
TokageItLab Aug 17, 2024
1b319d8
macOS/iOS: Fix various warnings when targeting newer SDKs
stuartcarnie Feb 19, 2024
ef92269
WorkerThreadPool: Print info about thread count at startup
RandomShaper Aug 30, 2024
da931b5
[mbedTLS] Update to 3.6.1
Faless Aug 31, 2024
05d171e
TranslationServer: Add fast path for comparison of equal locales
RandomShaper Sep 2, 2024
0e760b3
Use antialiased line drawing in animation Bezier editor
Calinou Sep 4, 2024
98185cf
miniupnpc: Update to 2.2.8 (new major 18)
akien-mga Sep 18, 2024
00895fb
Mention display driver and window mode in Copy System Info text
Calinou Sep 20, 2024
879f84e
Discard additional redo on commiting actions
KoBeWi Sep 24, 2024
d3826e3
[TextServer] Silently skip invalid system fallback fonts.
bruvzg Oct 1, 2024
48b7db4
Cache results for `TranslationServer.compare_locales()`
timothyqiu Oct 16, 2024
d1ed0b4
Fix FileSystem dock won't show any file folders (v2)
Hilderin Jun 12, 2024
3f4c085
Rationalize busy waits
RandomShaper Oct 31, 2024
22c2604
CI: Update Linux runners to Ubuntu 24.04
Repiteo Nov 6, 2024
1e727b2
Raise the amount of file handles on Windows
RandomShaper Nov 7, 2024
bba9af1
[Linux] Use safe IDs for native file dialog options.
bruvzg Nov 12, 2024
b29802d
Sync controller mappings DB with SDL2 community repo [Nov 2024]
emanvidmaker Nov 16, 2024
b9d5e5d
libpng: Update to upstream 1.6.44
akien-mga Dec 3, 2024
b813100
Linux: Relax interdependency between freetype, libpng, and zlib for u…
akien-mga Dec 5, 2024
d30d5de
Unconditionally use env.Decider("MD5-timestamp")
hpvb Dec 9, 2024
0087672
Don't set Variant::Type in destructor
hpvb Dec 25, 2024
907619a
Optimize Thread::get_caller_id()
hpvb Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix FileSystem dock won't show any file folders (v2)
(cherry picked from commit 1b0c5cb)
  • Loading branch information
Hilderin authored and Spartan322 committed Jan 18, 2025
commit d1ed0b45fbb7c37619cf73e91ce1cc46deefd212
8 changes: 3 additions & 5 deletions core/io/file_access.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ bool FileAccess::exists(const String &p_name) {
return true;
}

Ref<FileAccess> f = open(p_name, READ);
if (f.is_null()) {
return false;
}
return true;
// Using file_exists because it's faster than trying to open the file.
Ref<FileAccess> ret = create_for_path(p_name);
return ret->file_exists(p_name);
}

void FileAccess::_set_access_type(AccessType p_access) {
Expand Down
17 changes: 17 additions & 0 deletions core/io/resource_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,23 @@ ResourceUID::ID ResourceFormatImporter::get_resource_uid(const String &p_path) c
return pat.uid;
}

Error ResourceFormatImporter::get_resource_import_info(const String &p_path, StringName &r_type, ResourceUID::ID &r_uid, String &r_import_group_file) const {
PathAndType pat;
Error err = _get_path_and_type(p_path, pat);

if (err == OK) {
r_type = pat.type;
r_uid = pat.uid;
r_import_group_file = pat.group_file;
} else {
r_type = "";
r_uid = ResourceUID::INVALID_ID;
r_import_group_file = "";
}

return err;
}

Variant ResourceFormatImporter::get_resource_metadata(const String &p_path) const {
PathAndType pat;
Error err = _get_path_and_type(p_path, pat);
Expand Down
1 change: 1 addition & 0 deletions core/io/resource_importer.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class ResourceFormatImporter : public ResourceFormatLoader {
String get_import_settings_hash() const;

String get_import_base_path(const String &p_for_file) const;
Error get_resource_import_info(const String &p_path, StringName &r_type, ResourceUID::ID &r_uid, String &r_import_group_file) const;
ResourceFormatImporter();
};

Expand Down
61 changes: 32 additions & 29 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,36 +1203,39 @@ String ResourceLoader::_path_remap(const String &p_path, bool *r_translation_rem
new_path = path_remaps[new_path];
} else {
// Try file remap.
Error err;
Ref<FileAccess> f = FileAccess::open(new_path + ".remap", FileAccess::READ, &err);
if (f.is_valid()) {
VariantParser::StreamFile stream;
stream.f = f;

String assign;
Variant value;
VariantParser::Tag next_tag;

int lines = 0;
String error_text;
while (true) {
assign = Variant();
next_tag.fields.clear();
next_tag.name = String();

err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
ERR_PRINT("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text + ".");
break;
}
// Usually, there's no remap file and FileAccess::exists() is faster than FileAccess::open().
if (FileAccess::exists(new_path + ".remap")) {
Error err;
Ref<FileAccess> f = FileAccess::open(new_path + ".remap", FileAccess::READ, &err);
if (f.is_valid()) {
VariantParser::StreamFile stream;
stream.f = f;

String assign;
Variant value;
VariantParser::Tag next_tag;

int lines = 0;
String error_text;
while (true) {
assign = Variant();
next_tag.fields.clear();
next_tag.name = String();

err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
if (err == ERR_FILE_EOF) {
break;
} else if (err != OK) {
ERR_PRINT("Parse error: " + p_path + ".remap:" + itos(lines) + " error: " + error_text + ".");
break;
}

if (assign == "path") {
new_path = value;
break;
} else if (next_tag.name != "remap") {
break;
if (assign == "path") {
new_path = value;
break;
} else if (next_tag.name != "remap") {
break;
}
}
}
}
Expand Down
79 changes: 64 additions & 15 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,18 @@ EditorFileSystem::ScannedDirectory::~ScannedDirectory() {
}

void EditorFileSystem::_first_scan_filesystem() {
EditorProgress ep = EditorProgress("first_scan_filesystem", TTR("Project initialization"), 5);
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
first_scan_root_dir = memnew(ScannedDirectory);
first_scan_root_dir->full_path = "res://";
HashSet<String> existing_class_names;

ep.step(TTR("Scanning file structure..."), 0, true);
nb_files_total = _scan_new_dir(first_scan_root_dir, d);

// This loads the global class names from the scripts and ensures that even if the
// global_script_class_cache.cfg was missing or invalid, the global class names are valid in ScriptServer.
ep.step(TTR("Loading global class names..."), 1, true);
_first_scan_process_scripts(first_scan_root_dir, existing_class_names);

// Removing invalid global class to prevent having invalid paths in ScriptServer.
Expand All @@ -247,8 +250,13 @@ void EditorFileSystem::_first_scan_filesystem() {
// Now that all the global class names should be loaded, create autoloads and plugins.
// This is done after loading the global class names because autoloads and plugins can use
// global class names.
ep.step(TTR("Creating autoload scripts..."), 3, true);
ProjectSettingsEditor::get_singleton()->init_autoloads();

ep.step(TTR("Initializing plugins..."), 4, true);
EditorNode::get_singleton()->init_plugins();

ep.step(TTR("Starting file scan..."), 5, true);
}

void EditorFileSystem::_first_scan_process_scripts(const ScannedDirectory *p_scan_dir, HashSet<String> &p_existing_class_names) {
Expand Down Expand Up @@ -652,6 +660,12 @@ bool EditorFileSystem::_update_scan_actions() {
Vector<String> reimports;
Vector<String> reloads;

EditorProgress *ep = nullptr;
if (scan_actions.size() > 1) {
ep = memnew(EditorProgress("_update_scan_actions", TTR("Scanning actions..."), scan_actions.size()));
}

int step_count = 0;
for (const ItemAction &ia : scan_actions) {
switch (ia.action) {
case ItemAction::ACTION_NONE: {
Expand Down Expand Up @@ -783,8 +797,14 @@ bool EditorFileSystem::_update_scan_actions() {

} break;
}

if (ep) {
ep->step(ia.file, step_count++, false);
}
}

memdelete_notnull(ep);

if (_scan_extensions()) {
//needs editor restart
//extensions also may provide filetypes to be imported, so they must run before importing
Expand Down Expand Up @@ -874,8 +894,6 @@ void EditorFileSystem::scan() {
scan_total = 0;
s.priority = Thread::PRIORITY_LOW;
thread.start(_thread_func, this, s);
//tree->hide();
//progress->show();
}
}

Expand Down Expand Up @@ -1024,9 +1042,8 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
}

} else {
fi->type = ResourceFormatImporter::get_singleton()->get_resource_type(path);
fi->uid = ResourceFormatImporter::get_singleton()->get_resource_uid(path);
fi->import_group_file = ResourceFormatImporter::get_singleton()->get_import_group_file(path);
// Using get_resource_import_info() to prevent calling 3 times ResourceFormatImporter::_get_path_and_type.
ResourceFormatImporter::get_singleton()->get_resource_import_info(path, fi->type, fi->uid, fi->import_group_file);
fi->script_class_name = _get_global_script_class(fi->type, path, &fi->script_class_extends, &fi->script_class_icon_path);
fi->modified_time = 0;
fi->import_modified_time = 0;
Expand Down Expand Up @@ -1832,10 +1849,21 @@ void EditorFileSystem::_update_script_classes() {

update_script_mutex.lock();

EditorProgress *ep = nullptr;
if (update_script_paths.size() > 1) {
ep = memnew(EditorProgress("update_scripts_classes", TTR("Registering global classes..."), update_script_paths.size()));
}

int step_count = 0;
for (const KeyValue<String, ScriptInfo> &E : update_script_paths) {
_register_global_class_script(E.key, E.key, E.value.type, E.value.script_class_name, E.value.script_class_extends, E.value.script_class_icon_path);
if (ep) {
ep->step(E.value.script_class_name, step_count++, false);
}
}

memdelete_notnull(ep);

update_script_paths.clear();
update_script_mutex.unlock();

Expand All @@ -1860,6 +1888,12 @@ void EditorFileSystem::_update_script_documentation() {

update_script_mutex.lock();

EditorProgress *ep = nullptr;
if (update_script_paths_documentation.size() > 1) {
ep = memnew(EditorProgress("update_script_paths_documentation", TTR("Updating scripts documentation"), update_script_paths_documentation.size()));
}

int step_count = 0;
for (const String &path : update_script_paths_documentation) {
int index = -1;
EditorFileSystemDirectory *efd = find_file(path, &index);
Expand All @@ -1882,8 +1916,14 @@ void EditorFileSystem::_update_script_documentation() {
}
}
}

if (ep) {
ep->step(efd->files[index]->file, step_count++, false);
}
}

memdelete_notnull(ep);

update_script_paths_documentation.clear();
update_script_mutex.unlock();
}
Expand Down Expand Up @@ -1918,7 +1958,7 @@ void EditorFileSystem::_update_scene_groups() {

EditorProgress *ep = nullptr;
if (update_scene_paths.size() > 20) {
ep = memnew(EditorProgress("update_scene_groups", TTR("Update Scene Groups"), update_scene_paths.size()));
ep = memnew(EditorProgress("update_scene_groups", TTR("Updating Scene Groups"), update_scene_paths.size()));
}
int step_count = 0;

Expand All @@ -1940,7 +1980,7 @@ void EditorFileSystem::_update_scene_groups() {
}

if (ep) {
ep->step(TTR("Updating Scene Groups..."), step_count++, false);
ep->step(efd->files[index]->file, step_count++, false);
}
}

Expand Down Expand Up @@ -2656,7 +2696,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {

Vector<String> reloads;

EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size());
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.
Expand All @@ -2673,6 +2713,8 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
HashSet<String> groups_to_reimport;

for (int i = 0; i < p_files.size(); i++) {
ep->step(TTR("Preparing files to reimport..."), i, false);

String file = p_files[i];

ResourceUID::ID uid = ResourceUID::get_singleton()->text_to_id(file);
Expand Down Expand Up @@ -2712,6 +2754,8 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {

reimport_files.sort();

ep->step(TTR("Executing pre-reimport operations..."), 0, true);

// Emit the resource_reimporting signal for the single file before the actual importation.
emit_signal(SNAME("resources_reimporting"), reloads);

Expand All @@ -2732,7 +2776,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
if (i + 1 == reimport_files.size() || reimport_files[i + 1].importer != reimport_files[from].importer || groups_to_reimport.has(reimport_files[i + 1].path)) {
if (from - i == 0) {
// Single file, do not use threads.
pr.step(reimport_files[i].path.get_file(), i);
ep->step(reimport_files[i].path.get_file(), i, false);
_reimport_file(reimport_files[i].path);
} else {
Ref<ResourceImporter> importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(reimport_files[from].importer);
Expand All @@ -2754,7 +2798,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
do {
if (current_index < tdata.max_index.get()) {
current_index = tdata.max_index.get();
pr.step(reimport_files[current_index].path.get_file(), current_index);
ep->step(reimport_files[current_index].path.get_file(), current_index, false);
}
OS::get_singleton()->delay_usec(1);
} while (!WorkerThreadPool::get_singleton()->is_group_task_completed(group_task));
Expand All @@ -2768,7 +2812,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
}

} else {
pr.step(reimport_files[i].path.get_file(), i);
ep->step(reimport_files[i].path.get_file(), i, false);
_reimport_file(reimport_files[i].path);

// We need to increment the counter, maybe the next file is multithreaded
Expand All @@ -2785,7 +2829,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
HashMap<String, Vector<String>> group_files;
_find_group_files(filesystem, group_files, groups_to_reimport);
for (const KeyValue<String, Vector<String>> &E : group_files) {
pr.step(E.key.get_file(), from++);
ep->step(E.key.get_file(), from++, false);
Error err = _reimport_group(E.key, E.value);
reloads.push_back(E.key);
reloads.append_array(E.value);
Expand All @@ -2794,23 +2838,28 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
}
}
}
pr.step(TTR("Finalizing Asset Import..."), p_files.size());
ep->step(TTR("Finalizing Asset Import..."), p_files.size());

ResourceUID::get_singleton()->update_cache(); // After reimporting, update the cache.

_save_filesystem_cache();

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()));
ep->step(TTR("Executing post-reimport operations..."), 0, true);
if (!is_scanning()) {
emit_signal(SNAME("filesystem_changed"));
}

emit_signal(SNAME("resources_reimported"), reloads);
memdelete_notnull(ep);
}

Error EditorFileSystem::reimport_append(const String &p_file, const HashMap<StringName, Variant> &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters) {
Expand Down
Loading