Merge pull request #62408 from Razoric480/raz/fix-no-cache
[3.x] Fix nested resources being cached if no-cache argument used
This commit is contained in:
commit
14c9325b5d
51 changed files with 112 additions and 76 deletions
|
@ -65,8 +65,8 @@ static const unsigned int MONTH_DAYS_TABLE[2][12] = {
|
|||
|
||||
_ResourceLoader *_ResourceLoader::singleton = nullptr;
|
||||
|
||||
Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String &p_path, const String &p_type_hint) {
|
||||
return ResourceLoader::load_interactive(p_path, p_type_hint);
|
||||
Ref<ResourceInteractiveLoader> _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);
|
||||
|
|
|
@ -51,7 +51,7 @@ protected:
|
|||
|
||||
public:
|
||||
static _ResourceLoader *get_singleton() { return singleton; }
|
||||
Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_type_hint = "");
|
||||
Ref<ResourceInteractiveLoader> 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<String> get_recognized_extensions_for_type(const String &p_type);
|
||||
void set_abort_on_missing_resources(bool p_abort);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -118,7 +118,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -72,7 +72,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -287,7 +287,13 @@ 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());
|
||||
}
|
||||
|
@ -309,7 +315,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());
|
||||
|
@ -333,7 +339,7 @@ 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);
|
||||
RES res = ResourceLoader::load(path, exttype, no_subresource_cache);
|
||||
|
||||
if (res.is_null()) {
|
||||
WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data());
|
||||
|
@ -602,7 +608,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);
|
||||
|
@ -640,7 +646,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;
|
||||
|
@ -674,7 +680,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();
|
||||
|
@ -928,7 +936,7 @@ ResourceInteractiveLoaderBinary::~ResourceInteractiveLoaderBinary() {
|
|||
}
|
||||
}
|
||||
|
||||
Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||
Ref<ResourceInteractiveLoader> 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;
|
||||
}
|
||||
|
@ -939,6 +947,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons
|
|||
ERR_FAIL_COND_V_MSG(err != OK, Ref<ResourceInteractiveLoader>(), "Cannot open file '" + p_path + "'.");
|
||||
|
||||
Ref<ResourceInteractiveLoaderBinary> 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;
|
||||
|
|
|
@ -68,6 +68,7 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
|
|||
};
|
||||
|
||||
Vector<IntResource> internal_resources;
|
||||
Map<uint32_t, RES> internal_resources_cache;
|
||||
|
||||
String get_unicode_string();
|
||||
void _advance_padding(uint32_t p_len);
|
||||
|
@ -100,7 +101,7 @@ public:
|
|||
|
||||
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
|
||||
public:
|
||||
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
|
||||
virtual Ref<ResourceInteractiveLoader> 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<String> *p_extensions) const;
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -57,7 +57,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<String> *p_extensions) const;
|
||||
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
|
||||
virtual bool recognize_path(const String &p_path, const String &p_for_type = String()) const;
|
||||
|
|
|
@ -52,6 +52,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);
|
||||
|
@ -112,6 +120,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 {
|
||||
|
@ -152,22 +164,23 @@ void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions)
|
|||
// here can trigger an infinite recursion otherwise, since `load` calls `load_interactive`
|
||||
// vice versa.
|
||||
|
||||
Ref<ResourceInteractiveLoader> ResourceFormatLoader::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||
Ref<ResourceInteractiveLoader> 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<Resource> res = load(p_path, p_original_path, r_error);
|
||||
Ref<Resource> res = load(p_path, p_original_path, r_error, p_no_subresource_cache);
|
||||
if (res.is_null()) {
|
||||
return Ref<ResourceInteractiveLoader>();
|
||||
}
|
||||
|
||||
Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(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) {
|
||||
|
@ -183,7 +196,7 @@ RES ResourceFormatLoader::load(const String &p_path, const String &p_original_pa
|
|||
}
|
||||
|
||||
// Warning: See previous note about the risk of infinite recursion.
|
||||
Ref<ResourceInteractiveLoader> ril = load_interactive(p_path, p_original_path, r_error);
|
||||
Ref<ResourceInteractiveLoader> ril = load_interactive(p_path, p_original_path, r_error, p_no_subresource_cache);
|
||||
if (!ril.is_valid()) {
|
||||
return RES();
|
||||
}
|
||||
|
@ -236,7 +249,7 @@ Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map<
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -259,7 +272,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;
|
||||
}
|
||||
|
@ -484,7 +497,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
|
|||
continue;
|
||||
}
|
||||
found = true;
|
||||
Ref<ResourceInteractiveLoader> ril = loader[i]->load_interactive(path, local_path, r_error);
|
||||
Ref<ResourceInteractiveLoader> ril = loader[i]->load_interactive(path, local_path, r_error, p_no_cache);
|
||||
if (ril.is_null()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ class ResourceInteractiveLoader : public Reference {
|
|||
Thread::ID path_loading_thread;
|
||||
|
||||
protected:
|
||||
bool no_subresource_cache = false;
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
|
@ -51,6 +53,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();
|
||||
|
@ -63,8 +67,8 @@ protected:
|
|||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
virtual Ref<ResourceInteractiveLoader> 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<ResourceInteractiveLoader> 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<String> *p_extensions) const;
|
||||
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
|
||||
|
|
|
@ -302,7 +302,7 @@ RES TranslationLoaderPO::load_translation(FileAccess *f, bool p_use_context, Err
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
class TranslationLoaderPO : public ResourceFormatLoader {
|
||||
public:
|
||||
static RES load_translation(FileAccess *f, bool p_use_context, 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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -46,8 +46,9 @@
|
|||
<return type="Variant" />
|
||||
<argument index="0" name="path" type="String" />
|
||||
<argument index="1" name="original_path" type="String" />
|
||||
<argument index="2" name="no_subresource_cache" type="bool" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="rename_dependencies" qualifiers="virtual">
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="no_subresource_cache" type="bool" setter="set_no_subresource_cache" getter="get_no_subresource_cache">
|
||||
Configures whether nested resources, if included, should not be cached.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
@ -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.
|
||||
</description>
|
||||
|
@ -67,9 +67,11 @@
|
|||
<return type="ResourceInteractiveLoader" />
|
||||
<argument index="0" name="path" type="String" />
|
||||
<argument index="1" name="type_hint" type="String" default="""" />
|
||||
<argument index="2" name="no_cache" type="bool" default="false" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_abort_on_missing_resources">
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -36,7 +36,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 = NULL, bool p_no_subresource_cache = false);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -94,7 +94,7 @@ static const DDSFormatInfo dds_format_info[DDS_MAX] = {
|
|||
{ "GRAYSCALE_ALPHA", false, false, 1, 2, Image::FORMAT_LA8 }
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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<GDNativeLibrary> lib;
|
||||
lib.instance();
|
||||
|
||||
|
|
|
@ -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, bool p_no_subresource_cache = false);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -1784,8 +1784,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<String> *p_extensions) const {
|
||||
|
|
|
@ -379,7 +379,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -2189,7 +2189,7 @@ Ref<GDScript> 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;
|
||||
}
|
||||
|
|
|
@ -525,7 +525,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -3374,7 +3374,7 @@ void CSharpScript::get_members(Set<StringName> *p_members) {
|
|||
|
||||
/*************** RESOURCE ***************/
|
||||
|
||||
RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||
RES ResourceFormatLoaderCSharpScript::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;
|
||||
|
||||
|
|
|
@ -480,7 +480,7 @@ public:
|
|||
|
||||
class ResourceFormatLoaderCSharpScript : 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 = NULL, bool p_no_subresource_cache = false);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -186,7 +186,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -438,7 +438,7 @@ void VideoStreamWebm::set_audio_track(int p_track) {
|
|||
|
||||
////////////
|
||||
|
||||
RES ResourceFormatLoaderWebm::load(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||
RES ResourceFormatLoaderWebm::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) {
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
|
||||
class ResourceFormatLoaderWebm : 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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -1435,7 +1435,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;
|
||||
}
|
||||
|
|
|
@ -323,7 +323,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -788,7 +788,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;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -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<Resource>(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);
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ String ResourceInteractiveLoaderText::recognize(FileAccess *p_f) {
|
|||
|
||||
/////////////////////
|
||||
|
||||
Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) {
|
||||
Ref<ResourceInteractiveLoader> 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;
|
||||
}
|
||||
|
@ -1183,6 +1183,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const
|
|||
ERR_FAIL_COND_V_MSG(err != OK, Ref<ResourceInteractiveLoader>(), "Cannot open file '" + p_path + "'.");
|
||||
|
||||
Ref<ResourceInteractiveLoaderText> 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;
|
||||
|
|
|
@ -129,7 +129,7 @@ public:
|
|||
class ResourceFormatLoaderText : public ResourceFormatLoader {
|
||||
public:
|
||||
static ResourceFormatLoaderText *singleton;
|
||||
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr);
|
||||
virtual Ref<ResourceInteractiveLoader> 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<String> *p_extensions) const;
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
|
@ -835,7 +835,7 @@ StreamTexture::~StreamTexture() {
|
|||
VS::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<StreamTexture> st;
|
||||
st.instance();
|
||||
Error err = st->load(p_path);
|
||||
|
@ -2739,7 +2739,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;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -551,7 +551,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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
|
Loading…
Reference in a new issue