mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-03 01:19:38 +01:00
Ported: Fix custom res caching sub-res even if no-cache
-Razoric480
2ceb93bbef
This commit is contained in:
parent
c95765d515
commit
5d93975c8d
@ -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);
|
||||
|
@ -52,7 +52,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();
|
||||
|
@ -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<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) {
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -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<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;
|
||||
}
|
||||
@ -1053,6 +1063,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;
|
||||
|
@ -67,6 +67,7 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
|
||||
};
|
||||
|
||||
Vector<IntResource> internal_resources;
|
||||
RBMap<uint32_t, RES> 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<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()) {
|
||||
|
@ -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<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;
|
||||
|
@ -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<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) {
|
||||
@ -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<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();
|
||||
}
|
||||
@ -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<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;
|
||||
}
|
||||
|
@ -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<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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -44,8 +44,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;
|
||||
|
||||
|
@ -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<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;
|
||||
}
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -2126,7 +2126,7 @@ Ref<CScript> 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;
|
||||
}
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<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 = 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;
|
||||
|
@ -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<String> *p_extensions) const {
|
||||
|
@ -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<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;
|
||||
|
@ -2154,7 +2154,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;
|
||||
}
|
||||
|
@ -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<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;
|
||||
}
|
||||
|
@ -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<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) {
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<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);
|
||||
}
|
||||
|
||||
@ -1173,7 +1173,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;
|
||||
}
|
||||
@ -1184,6 +1184,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;
|
||||
|
@ -128,7 +128,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;
|
||||
}
|
||||
|
@ -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<String> *p_extensions) const;
|
||||
virtual bool handles_type(const String &p_type) const;
|
||||
virtual String get_resource_type(const String &p_path) const;
|
||||
|
@ -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<StreamTexture> 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;
|
||||
}
|
||||
|
@ -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<String> *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<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 New Issue
Block a user