diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 98d2952e7..3d6cce238 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -65,8 +65,8 @@ static const unsigned int MONTH_DAYS_TABLE[2][12] = { _ResourceLoader *_ResourceLoader::singleton = nullptr; -Ref _ResourceLoader::load_interactive(const String &p_path, const String &p_type_hint) { - return ResourceLoader::load_interactive(p_path, p_type_hint); +Ref _ResourceLoader::load_interactive(const String &p_path, const String &p_type_hint, bool p_no_cache) { + return ResourceLoader::load_interactive(p_path, p_type_hint, p_no_cache); } RES _ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p_no_cache) { @@ -121,7 +121,7 @@ bool _ResourceLoader::exists(const String &p_path, const String &p_type_hint) { } void _ResourceLoader::_bind_methods() { - ClassDB::bind_method(D_METHOD("load_interactive", "path", "type_hint"), &_ResourceLoader::load_interactive, DEFVAL("")); + ClassDB::bind_method(D_METHOD("load_interactive", "path", "type_hint", "no_cache"), &_ResourceLoader::load_interactive, DEFVAL(""), DEFVAL(false)); ClassDB::bind_method(D_METHOD("load", "path", "type_hint", "no_cache"), &_ResourceLoader::load, DEFVAL(""), DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_recognized_extensions_for_type", "type"), &_ResourceLoader::get_recognized_extensions_for_type); ClassDB::bind_method(D_METHOD("set_abort_on_missing_resources", "abort"), &_ResourceLoader::set_abort_on_missing_resources); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 4df0c88bc..5629cc9ee 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -52,7 +52,7 @@ protected: public: static _ResourceLoader *get_singleton() { return singleton; } - Ref load_interactive(const String &p_path, const String &p_type_hint = ""); + Ref load_interactive(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false); RES load(const String &p_path, const String &p_type_hint = "", bool p_no_cache = false); PoolVector get_recognized_extensions_for_type(const String &p_type); void set_abort_on_missing_resources(bool p_abort); diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp index 7340eddf8..ded66c2a0 100644 --- a/core/crypto/crypto.cpp +++ b/core/crypto/crypto.cpp @@ -144,7 +144,7 @@ Crypto::Crypto() { /// Resource loader/saver -RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { String el = p_path.get_extension().to_lower(); if (el == "crt") { X509Certificate *cert = X509Certificate::create(); diff --git a/core/crypto/crypto.h b/core/crypto/crypto.h index 3403d0bea..4b092b023 100644 --- a/core/crypto/crypto.h +++ b/core/crypto/crypto.h @@ -117,7 +117,7 @@ public: class ResourceFormatLoaderCrypto : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/core/io/image_loader.cpp b/core/io/image_loader.cpp index 27df650da..f2372e1cf 100644 --- a/core/io/image_loader.cpp +++ b/core/io/image_loader.cpp @@ -122,7 +122,7 @@ void ImageLoader::cleanup() { ///////////////// -RES ResourceFormatLoaderImage::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderImage::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { FileAccess *f = FileAccess::open(p_path, FileAccess::READ); if (!f) { if (r_error) { diff --git a/core/io/image_loader.h b/core/io/image_loader.h index 4fe23cd04..2f58b355a 100644 --- a/core/io/image_loader.h +++ b/core/io/image_loader.h @@ -71,7 +71,7 @@ public: class ResourceFormatLoaderImage : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 35d9c5b40..bff2da638 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -350,7 +350,15 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { case OBJECT_INTERNAL_RESOURCE: { uint32_t index = f->get_32(); String path = res_path + "::" + itos(index); - RES res = ResourceLoader::load(path); + + RES res; + if (internal_resources_cache.has(index)) { + res = internal_resources_cache[index]; + } else { + res = ResourceLoader::load(path, "", no_subresource_cache); + internal_resources_cache[index] = res; + } + if (res.is_null()) { WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data()); } @@ -372,7 +380,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { path = remaps[path]; } - RES res = ResourceLoader::load(path, exttype); + RES res = ResourceLoader::load(path, exttype, no_subresource_cache); if (res.is_null()) { WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data()); @@ -406,7 +414,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } if (res.is_null()) { - res = ResourceLoader::load(path, exttype); + res = ResourceLoader::load(path, exttype, no_subresource_cache); } if (res.is_null()) { @@ -716,7 +724,7 @@ Error ResourceInteractiveLoaderBinary::poll() { if (remaps.has(path)) { path = remaps[path]; } - RES res = ResourceLoader::load(path, external_resources[s].type); + RES res = ResourceLoader::load(path, external_resources[s].type, no_subresource_cache); if (res.is_null()) { if (!ResourceLoader::get_abort_on_missing_resources()) { ResourceLoader::notify_dependency_error(local_path, path, external_resources[s].type); @@ -754,7 +762,7 @@ Error ResourceInteractiveLoaderBinary::poll() { path = res_path + "::" + path; } - if (ResourceCache::has(path)) { + if (!no_subresource_cache && ResourceCache::has(path)) { //already loaded, don't do anything stage++; error = OK; @@ -788,7 +796,9 @@ Error ResourceInteractiveLoaderBinary::poll() { RES res = RES(r); - r->set_path(path); + if (!no_subresource_cache) { + r->set_path(path); + } r->set_subindex(subindex); int pc = f->get_32(); @@ -1042,7 +1052,7 @@ ResourceInteractiveLoaderBinary::~ResourceInteractiveLoaderBinary() { } } -Ref ResourceFormatLoaderBinary::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) { +Ref ResourceFormatLoaderBinary::load_interactive(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } @@ -1053,6 +1063,7 @@ Ref ResourceFormatLoaderBinary::load_interactive(cons ERR_FAIL_COND_V_MSG(err != OK, Ref(), "Cannot open file '" + p_path + "'."); Ref ria = memnew(ResourceInteractiveLoaderBinary); + ria->set_no_subresource_cache(p_no_subresource_cache); String path = p_original_path != "" ? p_original_path : p_path; ria->local_path = ProjectSettings::get_singleton()->localize_path(path); ria->res_path = ria->local_path; diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index 135f3deca..c6d59a421 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -67,6 +67,7 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader { }; Vector internal_resources; + RBMap internal_resources_cache; String get_unicode_string(); void _advance_padding(uint32_t p_len); @@ -99,7 +100,7 @@ public: class ResourceFormatLoaderBinary : public ResourceFormatLoader { public: - virtual Ref load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual Ref load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions_for_type(const String &p_type, List *p_extensions) const; virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index c38802814..29a52429b 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -116,7 +116,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy return OK; } -RES ResourceFormatImporter::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatImporter::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { PathAndType pat; Error err = _get_path_and_type(p_path, pat); @@ -128,7 +128,7 @@ RES ResourceFormatImporter::load(const String &p_path, const String &p_original_ return RES(); } - RES res = ResourceLoader::_load(pat.path, p_path, pat.type, false, r_error); + RES res = ResourceLoader::_load(pat.path, p_path, pat.type, p_no_subresource_cache, r_error); #ifdef TOOLS_ENABLED if (res.is_valid()) { diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index 7cd6990be..8c18cac12 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -56,7 +56,7 @@ class ResourceFormatImporter : public ResourceFormatLoader { public: static ResourceFormatImporter *get_singleton() { return singleton; } - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual void get_recognized_extensions_for_type(const String &p_type, List *p_extensions) const; virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const; diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index c0cc5775a..22ad5a080 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -30,11 +30,11 @@ #include "resource_loader.h" +#include "core/config/project_settings.h" #include "core/io/resource_importer.h" #include "core/os/file_access.h" #include "core/os/os.h" #include "core/string/print_string.h" -#include "core/config/project_settings.h" #include "core/string/translation.h" #include "core/variant/variant_parser.h" @@ -51,6 +51,14 @@ Error ResourceInteractiveLoader::wait() { return err; } +void ResourceInteractiveLoader::set_no_subresource_cache(bool p_no_subresource_cache) { + no_subresource_cache = p_no_subresource_cache; +} + +bool ResourceInteractiveLoader::get_no_subresource_cache() { + return no_subresource_cache; +} + ResourceInteractiveLoader::~ResourceInteractiveLoader() { if (path_loading != String()) { ResourceLoader::_remove_from_loading_map_and_thread(path_loading, path_loading_thread); @@ -111,6 +119,10 @@ void ResourceInteractiveLoader::_bind_methods() { ClassDB::bind_method(D_METHOD("wait"), &ResourceInteractiveLoader::wait); ClassDB::bind_method(D_METHOD("get_stage"), &ResourceInteractiveLoader::get_stage); ClassDB::bind_method(D_METHOD("get_stage_count"), &ResourceInteractiveLoader::get_stage_count); + ClassDB::bind_method(D_METHOD("set_no_subresource_cache", "no_subresource_cache"), &ResourceInteractiveLoader::set_no_subresource_cache); + ClassDB::bind_method(D_METHOD("get_no_subresource_cache"), &ResourceInteractiveLoader::get_no_subresource_cache); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "no_subresource_cache"), "set_no_subresource_cache", "get_no_subresource_cache"); } class ResourceInteractiveLoaderDefault : public ResourceInteractiveLoader { @@ -151,22 +163,23 @@ void ResourceFormatLoader::get_recognized_extensions(List *p_extensions) // here can trigger an infinite recursion otherwise, since `load` calls `load_interactive` // vice versa. -Ref ResourceFormatLoader::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) { +Ref ResourceFormatLoader::load_interactive(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { // Warning: See previous note about the risk of infinite recursion. - Ref res = load(p_path, p_original_path, r_error); + Ref res = load(p_path, p_original_path, r_error, p_no_subresource_cache); if (res.is_null()) { return Ref(); } Ref ril = Ref(memnew(ResourceInteractiveLoaderDefault)); + ril->set_no_subresource_cache(p_no_subresource_cache); ril->resource = res; return ril; } -RES ResourceFormatLoader::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { // Check user-defined loader if there's any. Hard fail if it returns an error. if (get_script_instance() && get_script_instance()->has_method("load")) { - Variant res = get_script_instance()->call("load", p_path, p_original_path); + Variant res = get_script_instance()->call("load", p_path, p_original_path, p_no_subresource_cache); if (res.get_type() == Variant::INT) { // Error code, abort. if (r_error) { @@ -182,7 +195,7 @@ RES ResourceFormatLoader::load(const String &p_path, const String &p_original_pa } // Warning: See previous note about the risk of infinite recursion. - Ref ril = load_interactive(p_path, p_original_path, r_error); + Ref ril = load_interactive(p_path, p_original_path, r_error, p_no_subresource_cache); if (!ril.is_valid()) { return RES(); } @@ -235,7 +248,7 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const RBMa void ResourceFormatLoader::_bind_methods() { { - MethodInfo info = MethodInfo(Variant::NIL, "load", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "original_path")); + MethodInfo info = MethodInfo(Variant::NIL, "load", PropertyInfo(Variant::STRING, "path"), PropertyInfo(Variant::STRING, "original_path"), PropertyInfo(Variant::BOOL, "no_subresource_cache")); info.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; ClassDB::add_virtual_method(get_class_static(), info); } @@ -258,7 +271,7 @@ RES ResourceLoader::_load(const String &p_path, const String &p_original_path, c continue; } found = true; - RES res = loader[i]->load(p_path, p_original_path != String() ? p_original_path : p_path, r_error); + RES res = loader[i]->load(p_path, p_original_path != String() ? p_original_path : p_path, r_error, p_no_cache); if (res.is_null()) { continue; } @@ -483,7 +496,7 @@ Ref ResourceLoader::load_interactive(const String &p_ continue; } found = true; - Ref ril = loader[i]->load_interactive(path, local_path, r_error); + Ref ril = loader[i]->load_interactive(path, local_path, r_error, p_no_cache); if (ril.is_null()) { continue; } diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h index af6540180..5812fd9b6 100644 --- a/core/io/resource_loader.h +++ b/core/io/resource_loader.h @@ -30,8 +30,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "core/os/thread.h" #include "core/object/resource.h" +#include "core/os/thread.h" class ResourceInteractiveLoader : public Reference { GDCLASS(ResourceInteractiveLoader, Reference); @@ -40,6 +40,8 @@ class ResourceInteractiveLoader : public Reference { Thread::ID path_loading_thread; protected: + bool no_subresource_cache = false; + static void _bind_methods(); public: @@ -50,6 +52,8 @@ public: virtual int get_stage_count() const = 0; virtual void set_translation_remapped(bool p_remapped) = 0; virtual Error wait(); + virtual void set_no_subresource_cache(bool p_no_subresource_cache); + virtual bool get_no_subresource_cache(); ResourceInteractiveLoader() {} ~ResourceInteractiveLoader(); @@ -62,8 +66,8 @@ protected: static void _bind_methods(); public: - virtual Ref load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual Ref load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual bool exists(const String &p_path) const; virtual void get_recognized_extensions(List *p_extensions) const; virtual void get_recognized_extensions_for_type(const String &p_type, List *p_extensions) const; diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index 31ab4d089..fc42dae91 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -189,7 +189,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, Error *r_error) { return translation; } -RES TranslationLoaderPO::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES TranslationLoaderPO::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_CANT_OPEN; } diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h index 1b006d3cb..5cfc9c5ee 100644 --- a/core/io/translation_loader_po.h +++ b/core/io/translation_loader_po.h @@ -37,7 +37,7 @@ class TranslationLoaderPO : public ResourceFormatLoader { public: static RES load_translation(FileAccess *f, Error *r_error = nullptr); - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml index bd4a80f0b..40a58ce25 100644 --- a/doc/classes/ResourceFormatLoader.xml +++ b/doc/classes/ResourceFormatLoader.xml @@ -44,8 +44,9 @@ + - Loads a resource when the engine finds this loader to be compatible. If the loaded resource is the result of an import, [code]original_path[/code] will target the source file. Returns a [Resource] object on success, or an [enum Error] constant in case of failure. + Loads a resource when the engine finds this loader to be compatible. If the loaded resource is the result of an import, [code]original_path[/code] will target the source file. If [code]no_subresource_cache[/code] is true, sub-resources should not be cached. Returns a [Resource] object on success, or an [enum Error] constant in case of failure. diff --git a/doc/classes/ResourceInteractiveLoader.xml b/doc/classes/ResourceInteractiveLoader.xml index 04e0f40cf..8f6364772 100644 --- a/doc/classes/ResourceInteractiveLoader.xml +++ b/doc/classes/ResourceInteractiveLoader.xml @@ -45,6 +45,11 @@ + + + Configures whether nested resources, if included, should not be cached. + + diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xml index 1c0eb16bc..e0d0af975 100644 --- a/doc/classes/ResourceLoader.xml +++ b/doc/classes/ResourceLoader.xml @@ -58,7 +58,7 @@ Loads a resource at the given [code]path[/code], caching the result for further access. The registered [ResourceFormatLoader]s are queried sequentially to find the first one which can handle the file's extension, and then attempt loading. If loading fails, the remaining ResourceFormatLoaders are also attempted. An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader]. Anything that inherits from [Resource] can be used as a type hint, for example [Image]. - If [code]no_cache[/code] is [code]true[/code], the resource cache will be bypassed and the resource will be loaded anew. Otherwise, the cached resource will be returned if it exists. + If [code]no_cache[/code] is [code]true[/code], the resource cache will be bypassed, and the resource will be loaded anew. Otherwise, the cached resource will be returned if it exists. Returns an empty resource if no [ResourceFormatLoader] could handle the file. GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios. @@ -67,9 +67,11 @@ + Starts loading a resource interactively. The returned [ResourceInteractiveLoader] object allows to load with high granularity, calling its [method ResourceInteractiveLoader.poll] method successively to load chunks. An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader]. Anything that inherits from [Resource] can be used as a type hint, for example [Image]. + If [code]no_cache[/code] is [code]true[/code], the resource cache will be bypassed, and the resource will be loaded anew. Otherwise, the cached resource will be returned if it exists. diff --git a/drivers/dummy/texture_loader_dummy.cpp b/drivers/dummy/texture_loader_dummy.cpp index 9faec6571..3fa26c1ee 100644 --- a/drivers/dummy/texture_loader_dummy.cpp +++ b/drivers/dummy/texture_loader_dummy.cpp @@ -35,7 +35,7 @@ #include -RES ResourceFormatDummyTexture::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatDummyTexture::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { unsigned int width = 8; unsigned int height = 8; diff --git a/drivers/dummy/texture_loader_dummy.h b/drivers/dummy/texture_loader_dummy.h index a0277a109..7e0b5d659 100644 --- a/drivers/dummy/texture_loader_dummy.h +++ b/drivers/dummy/texture_loader_dummy.h @@ -35,7 +35,7 @@ class ResourceFormatDummyTexture : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/editor_modules/etc/texture_loader_pkm.cpp b/editor_modules/etc/texture_loader_pkm.cpp index d1636fc99..2e727d918 100644 --- a/editor_modules/etc/texture_loader_pkm.cpp +++ b/editor_modules/etc/texture_loader_pkm.cpp @@ -42,7 +42,7 @@ struct ETC1Header { uint16_t origHeight; }; -RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_CANT_OPEN; } diff --git a/editor_modules/etc/texture_loader_pkm.h b/editor_modules/etc/texture_loader_pkm.h index 8d2eb742a..b75e87bb7 100644 --- a/editor_modules/etc/texture_loader_pkm.h +++ b/editor_modules/etc/texture_loader_pkm.h @@ -35,7 +35,7 @@ class ResourceFormatPKM : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/editor_modules/text_editor/text_editor_format_loader.cpp b/editor_modules/text_editor/text_editor_format_loader.cpp index 92afb77cf..dc71cd85a 100644 --- a/editor_modules/text_editor/text_editor_format_loader.cpp +++ b/editor_modules/text_editor/text_editor_format_loader.cpp @@ -24,7 +24,7 @@ SOFTWARE. #include "text_editor_file.h" -RES TextEditorTextLoader::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES TextEditorTextLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/editor_modules/text_editor/text_editor_format_loader.h b/editor_modules/text_editor/text_editor_format_loader.h index 8a96bead9..feb790501 100644 --- a/editor_modules/text_editor/text_editor_format_loader.h +++ b/editor_modules/text_editor/text_editor_format_loader.h @@ -32,7 +32,7 @@ class TextEditorTextLoader : public ResourceFormatLoader { GDCLASS(TextEditorTextLoader, ResourceFormatLoader); public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/cscript/cscript.cpp b/modules/cscript/cscript.cpp index ce31bc95a..34643946b 100644 --- a/modules/cscript/cscript.cpp +++ b/modules/cscript/cscript.cpp @@ -2126,7 +2126,7 @@ Ref CScriptLanguage::get_orphan_subclass(const String &p_qualified_name /*************** RESOURCE ***************/ -RES ResourceFormatLoaderCScript::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderCScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/modules/cscript/cscript.h b/modules/cscript/cscript.h index 2e75de1ce..fc4040ecb 100644 --- a/modules/cscript/cscript.h +++ b/modules/cscript/cscript.h @@ -538,7 +538,7 @@ public: class ResourceFormatLoaderCScript : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index f2b4eb9e8..09b267ffb 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -32,7 +32,7 @@ #include "core/os/file_access.h" -RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_CANT_OPEN; } diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h index fef35900d..9e929efcd 100644 --- a/modules/dds/texture_loader_dds.h +++ b/modules/dds/texture_loader_dds.h @@ -35,7 +35,7 @@ class ResourceFormatDDS : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index db820ed44..dc1734469 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -520,7 +520,7 @@ Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_ return result; } -RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { Ref lib; lib.instance(); diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index 7b54134a0..598c98b6d 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -166,7 +166,7 @@ public: class GDNativeLibraryResourceLoader : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path, Error *r_error); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 3d3d5a089..e591e79ee 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -1729,8 +1729,8 @@ void NativeReloadNode::_notification(int p_what) { #endif } -RES ResourceFormatLoaderNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error) { - return ResourceFormatLoaderText::singleton->load(p_path, p_original_path, r_error); +RES ResourceFormatLoaderNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { + return ResourceFormatLoaderText::singleton->load(p_path, p_original_path, r_error, p_no_subresource_cache); } void ResourceFormatLoaderNativeScript::get_recognized_extensions(List *p_extensions) const { diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index dcba42e0a..72d3b0309 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -377,7 +377,7 @@ public: class ResourceFormatLoaderNativeScript : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp index 8777cbd6f..055a16cfa 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.cpp +++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp @@ -39,7 +39,7 @@ ResourceFormatLoaderPluginScript::ResourceFormatLoaderPluginScript(PluginScriptL _language = language; } -RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h index f5394064c..d1df3247e 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.h +++ b/modules/gdnative/pluginscript/pluginscript_loader.h @@ -43,7 +43,7 @@ class ResourceFormatLoaderPluginScript : public ResourceFormatLoader { public: ResourceFormatLoaderPluginScript(PluginScriptLanguage *language); - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp index dbe3da76e..3f607b00a 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp +++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp @@ -361,7 +361,7 @@ void VideoStreamGDNative::set_audio_track(int p_track) { /* --- NOTE ResourceFormatLoaderVideoStreamGDNative starts here. ----- */ -RES ResourceFormatLoaderVideoStreamGDNative::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderVideoStreamGDNative::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { FileAccess *f = FileAccess::open(p_path, FileAccess::READ); if (!f) { if (r_error) { diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h index 0a0409fc4..91b60df86 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.h +++ b/modules/gdnative/videodecoder/video_stream_gdnative.h @@ -198,7 +198,7 @@ public: class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index a0fd0d154..fba682fd9 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -2154,7 +2154,7 @@ Ref GDScriptLanguage::get_orphan_subclass(const String &p_qualified_na /*************** RESOURCE ***************/ -RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderGDScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 19cdeaeeb..f54aaeb45 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -538,7 +538,7 @@ public: class ResourceFormatLoaderGDScript : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index e829ec442..31454ed68 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -48,7 +48,7 @@ enum PVRFLags { }; -RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_CANT_OPEN; } diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h index 21359ab8f..8ffab75e6 100644 --- a/modules/pvr/texture_loader_pvr.h +++ b/modules/pvr/texture_loader_pvr.h @@ -35,7 +35,7 @@ class ResourceFormatPVR : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index fa569b8cc..3c2a0f7ba 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -689,7 +689,7 @@ void VideoStreamTheora::_bind_methods() { //////////// -RES ResourceFormatLoaderTheora::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderTheora::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { FileAccess *f = FileAccess::open(p_path, FileAccess::READ); if (!f) { if (r_error) { diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index d8f6aef65..a40d986b4 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -185,7 +185,7 @@ public: class ResourceFormatLoaderTheora : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index f737846cd..7f10a3f3d 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -1429,7 +1429,7 @@ void DynamicFont::update_oversampling() { ///////////////////////// -RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderDynamicFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 31ec1682d..22ad78051 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -391,7 +391,7 @@ VARIANT_ENUM_CAST(DynamicFont::SpacingType); class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index f3437bd8b..10f787a64 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -830,7 +830,7 @@ BitmapFont::~BitmapFont() { //////////// -RES ResourceFormatLoaderBMFont::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderBMFont::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/scene/resources/font.h b/scene/resources/font.h index 5d4244ed3..cfb34553c 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -223,7 +223,7 @@ public: class ResourceFormatLoaderBMFont : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index f7aa8e785..625450a1d 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -151,7 +151,7 @@ Error ResourceInteractiveLoaderText::_parse_ext_resource(VariantParser::Stream * path = ProjectSettings::get_singleton()->localize_path(res_path.get_base_dir().plus_file(path)); } - r_res = ResourceLoader::load(path, type); + r_res = ResourceLoader::load(path, type, no_subresource_cache); if (r_res.is_null()) { WARN_PRINT(String("Couldn't load external resource: " + path).utf8().get_data()); @@ -403,7 +403,7 @@ Error ResourceInteractiveLoaderText::poll() { path = remaps[path]; } - RES res = ResourceLoader::load(path, type); + RES res = ResourceLoader::load(path, type, no_subresource_cache); if (res.is_null()) { if (ResourceLoader::get_abort_on_missing_resources()) { @@ -460,7 +460,7 @@ Error ResourceInteractiveLoaderText::poll() { bool do_assign = false; - if (ResourceCache::has(path)) { + if (!no_subresource_cache && ResourceCache::has(path)) { //cached, do not assign Resource *r = ResourceCache::get(path); res = Ref(r); @@ -488,7 +488,7 @@ Error ResourceInteractiveLoaderText::poll() { int_resources[id] = res; //always assign int resources if (do_assign) { - res->set_path(path); + res->set_path(path, no_subresource_cache); res->set_subindex(id); } @@ -561,7 +561,7 @@ Error ResourceInteractiveLoaderText::poll() { if (error != ERR_FILE_EOF) { _printerr(); } else { - if (!ResourceCache::has(res_path)) { + if (!no_subresource_cache && !ResourceCache::has(res_path)) { resource->set_path(res_path); } resource->set_as_translation_remapped(translation_remapped); @@ -602,7 +602,7 @@ Error ResourceInteractiveLoaderText::poll() { error = ERR_FILE_EOF; //get it here resource = packed_scene; - if (!ResourceCache::has(res_path)) { + if (!no_subresource_cache && !ResourceCache::has(res_path)) { packed_scene->set_path(res_path); } @@ -1173,7 +1173,7 @@ String ResourceInteractiveLoaderText::recognize(FileAccess *p_f) { ///////////////////// -Ref ResourceFormatLoaderText::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) { +Ref ResourceFormatLoaderText::load_interactive(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_CANT_OPEN; } @@ -1184,6 +1184,7 @@ Ref ResourceFormatLoaderText::load_interactive(const ERR_FAIL_COND_V_MSG(err != OK, Ref(), "Cannot open file '" + p_path + "'."); Ref ria = memnew(ResourceInteractiveLoaderText); + ria->set_no_subresource_cache(p_no_subresource_cache); String path = p_original_path != "" ? p_original_path : p_path; ria->local_path = ProjectSettings::get_singleton()->localize_path(path); ria->res_path = ria->local_path; diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index 29be92e80..50362a85e 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -128,7 +128,7 @@ public: class ResourceFormatLoaderText : public ResourceFormatLoader { public: static ResourceFormatLoaderText *singleton; - virtual Ref load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual Ref load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions_for_type(const String &p_type, List *p_extensions) const; virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 64744682b..890781196 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -181,7 +181,7 @@ Shader::~Shader() { } //////////// -RES ResourceFormatLoaderShader::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderShader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/scene/resources/shader.h b/scene/resources/shader.h index 45ee783d1..371328f7b 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -105,7 +105,7 @@ VARIANT_ENUM_CAST(Shader::Mode); class ResourceFormatLoaderShader : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index c97a32477..30d778ab3 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -834,7 +834,7 @@ StreamTexture::~StreamTexture() { RS::get_singleton()->free(texture); } -RES ResourceFormatLoaderStreamTexture::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderStreamTexture::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { Ref st; st.instance(); Error err = st->load(p_path); @@ -2738,7 +2738,7 @@ void TextureArray::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "width", "height", "depth", "format", "flags"), &TextureArray::create, DEFVAL(FLAGS_DEFAULT_TEXTURE_ARRAY)); } -RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_no_subresource_cache) { if (r_error) { *r_error = ERR_CANT_OPEN; } diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 0b8b19011..490e41ca9 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -235,7 +235,7 @@ public: class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; @@ -560,7 +560,7 @@ public: class ResourceFormatLoaderTextureLayered : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_no_subresource_cache = false); virtual void get_recognized_extensions(List *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const;