You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Merge pull request #108236 from timothyqiu/simplify-while
EditorFileSystem: Simplify resource loading logic on startup
This commit is contained in:
@@ -3420,26 +3420,19 @@ Ref<Resource> EditorFileSystem::_load_resource_on_startup(ResourceFormatImporter
|
|||||||
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("Failed loading resource: %s. The file doesn't seem to exist.", p_path));
|
ERR_FAIL_V_MSG(Ref<Resource>(), vformat("Failed loading resource: %s. The file doesn't seem to exist.", p_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Resource> res;
|
// Fail silently. Hopefully the resource is not yet imported.
|
||||||
bool can_retry = true;
|
Ref<Resource> res = p_importer->load_internal(p_path, r_error, p_use_sub_threads, r_progress, p_cache_mode, true);
|
||||||
bool retry = true;
|
if (res.is_valid()) {
|
||||||
while (retry) {
|
|
||||||
retry = false;
|
|
||||||
|
|
||||||
res = p_importer->load_internal(p_path, r_error, p_use_sub_threads, r_progress, p_cache_mode, can_retry);
|
|
||||||
|
|
||||||
if (res.is_null() && can_retry) {
|
|
||||||
can_retry = false;
|
|
||||||
Error err = singleton->_reimport_file(p_path, HashMap<StringName, Variant>(), "", nullptr, false);
|
|
||||||
if (err == OK) {
|
|
||||||
retry = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retry after importing the resource.
|
||||||
|
if (singleton->_reimport_file(p_path, HashMap<StringName, Variant>(), "", nullptr, false) != OK) {
|
||||||
|
return Ref<Resource>();
|
||||||
|
}
|
||||||
|
return p_importer->load_internal(p_path, r_error, p_use_sub_threads, r_progress, p_cache_mode, false);
|
||||||
|
}
|
||||||
|
|
||||||
bool EditorFileSystem::_should_skip_directory(const String &p_path) {
|
bool EditorFileSystem::_should_skip_directory(const String &p_path) {
|
||||||
String project_data_path = ProjectSettings::get_singleton()->get_project_data_path();
|
String project_data_path = ProjectSettings::get_singleton()->get_project_data_path();
|
||||||
if (p_path == project_data_path || p_path.begins_with(project_data_path + "/")) {
|
if (p_path == project_data_path || p_path.begins_with(project_data_path + "/")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user