Skip to content

Commit

Permalink
Fix CACHE_MODE_REPLACE
Browse files Browse the repository at this point in the history
  • Loading branch information
SaracenOne committed Oct 30, 2023
1 parent 9144457 commit f967acc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/io/resource_loader.cpp
Expand Up @@ -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.resource->set_path(load_task.local_path, load_task.cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE);
}

if (load_task.xl_remapped) {
Expand Down Expand Up @@ -461,7 +461,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_IGNORE) {
if (p_cache_mode == ResourceFormatLoader::CACHE_MODE_REUSE) {
Ref<Resource> existing = ResourceCache::get_ref(local_path);
if (existing.is_valid()) {
//referencing is fine
Expand Down
4 changes: 2 additions & 2 deletions editor/editor_node.cpp
Expand Up @@ -6152,7 +6152,7 @@ void EditorNode::reload_instances_with_path_in_edited_scenes(const String &p_ins
if (edited_scene_map.size() > 0) {
// Reload the new instance.
Error err;
Ref<PackedScene> instance_scene_packed_scene = ResourceLoader::load(p_instance_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE, &err);
Ref<PackedScene> instance_scene_packed_scene = ResourceLoader::load(p_instance_path, "", ResourceFormatLoader::CACHE_MODE_REPLACE, &err);
instance_scene_packed_scene->set_path(p_instance_path, true);

ERR_FAIL_COND(err != OK);
Expand Down Expand Up @@ -6260,7 +6260,7 @@ void EditorNode::reload_instances_with_path_in_edited_scenes(const String &p_ins
// be properly updated.
for (String path : required_load_paths) {
if (!local_scene_cache.find(path)) {
current_packed_scene = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_IGNORE, &err);
current_packed_scene = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_REPLACE, &err);
current_packed_scene->set_path(path, true);
local_scene_cache[path] = current_packed_scene;
} else {
Expand Down

0 comments on commit f967acc

Please sign in to comment.