diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-09 10:49:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 10:49:14 +0100 |
commit | 9ca3d3ec835e12ec686b58bdc2c797c686503e3b (patch) | |
tree | 3536343018c19120403d9c3278a3de23b3ca9db4 /core/io/resource_loader.cpp | |
parent | 84e205b5a17bfe7ace96b78c410ec10aa52241d2 (diff) | |
download | redot-engine-9ca3d3ec835e12ec686b58bdc2c797c686503e3b.tar.gz |
Revert "Fix behavior of ResourceFormatLoader `CACHE_MODE_REPLACE`"
Diffstat (limited to 'core/io/resource_loader.cpp')
-rw-r--r-- | core/io/resource_loader.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 0c7764392a..1fbb6ff2ed 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -340,7 +340,7 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { if (load_task.resource.is_valid()) { if (load_task.cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) { - load_task.resource->set_path(load_task.local_path, load_task.cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE); + load_task.resource->set_path(load_task.local_path); } else if (!load_task.local_path.is_resource_file()) { load_task.resource->set_path_cache(load_task.local_path); } @@ -361,17 +361,6 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { if (_loaded_callback) { _loaded_callback(load_task.resource, load_task.local_path); } - } else if (load_task.cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) { - Ref<Resource> existing = ResourceCache::get_ref(load_task.local_path); - if (existing.is_valid()) { - load_task.resource = existing; - load_task.status = THREAD_LOAD_LOADED; - load_task.progress = 1.0; - - if (_loaded_callback) { - _loaded_callback(load_task.resource, load_task.local_path); - } - } } thread_load_mutex.unlock(); @@ -474,7 +463,7 @@ Ref<ResourceLoader::LoadToken> ResourceLoader::_load_start(const String &p_path, load_task.type_hint = p_type_hint; load_task.cache_mode = p_cache_mode; load_task.use_sub_threads = p_thread_mode == LOAD_THREAD_DISTRIBUTE; - if (p_cache_mode == ResourceFormatLoader::CACHE_MODE_REUSE) { + if (p_cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) { Ref<Resource> existing = ResourceCache::get_ref(local_path); if (existing.is_valid()) { //referencing is fine |