Skip to content

Commit

Permalink
Merge pull request #81026 from Razoric480/raz/use_resource_cache
Browse files Browse the repository at this point in the history
[3.x] Make binary resource loader utilize loaded external resources
  • Loading branch information
akien-mga authored Aug 28, 2023
2 parents fcaf4c7 + 17d8c09 commit 47e6467
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,18 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path));
}

RES res = ResourceLoader::load(path, exttype, no_subresource_cache);
RES res;

for (List<RES>::Element *E = resource_cache.front(); E; E = E->next()) {
if (E->get()->get_path() == path) {
res = E->get();
break;
}
}

if (res.is_null()) {
res = ResourceLoader::load(path, exttype, no_subresource_cache);
}

if (res.is_null()) {
WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data());
Expand Down

0 comments on commit 47e6467

Please sign in to comment.