|
@@ -471,7 +471,7 @@ Error ResourceLoaderText::load() {
|
|
|
|
|
|
ext_resources[id].path = path;
|
|
ext_resources[id].path = path;
|
|
ext_resources[id].type = type;
|
|
ext_resources[id].type = type;
|
|
- ext_resources[id].load_token = ResourceLoader::_load_start(path, type, use_sub_threads ? ResourceLoader::LOAD_THREAD_DISTRIBUTE : ResourceLoader::LOAD_THREAD_FROM_CURRENT, ResourceFormatLoader::CACHE_MODE_REUSE);
|
|
|
|
|
|
+ ext_resources[id].load_token = ResourceLoader::_load_start(path, type, use_sub_threads ? ResourceLoader::LOAD_THREAD_DISTRIBUTE : ResourceLoader::LOAD_THREAD_FROM_CURRENT, cache_mode_for_external);
|
|
if (!ext_resources[id].load_token.is_valid()) {
|
|
if (!ext_resources[id].load_token.is_valid()) {
|
|
if (ResourceLoader::get_abort_on_missing_resources()) {
|
|
if (ResourceLoader::get_abort_on_missing_resources()) {
|
|
error = ERR_FILE_CORRUPT;
|
|
error = ERR_FILE_CORRUPT;
|
|
@@ -584,7 +584,7 @@ Error ResourceLoaderText::load() {
|
|
if (do_assign) {
|
|
if (do_assign) {
|
|
if (cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) {
|
|
if (cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) {
|
|
res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE);
|
|
res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE);
|
|
- } else if (!path.is_resource_file()) {
|
|
|
|
|
|
+ } else {
|
|
res->set_path_cache(path);
|
|
res->set_path_cache(path);
|
|
}
|
|
}
|
|
res->set_scene_unique_id(id);
|
|
res->set_scene_unique_id(id);
|
|
@@ -721,6 +721,8 @@ Error ResourceLoaderText::load() {
|
|
resource->set_path(res_path);
|
|
resource->set_path(res_path);
|
|
}
|
|
}
|
|
resource->set_as_translation_remapped(translation_remapped);
|
|
resource->set_as_translation_remapped(translation_remapped);
|
|
|
|
+ } else {
|
|
|
|
+ resource->set_path_cache(res_path);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return error;
|
|
return error;
|
|
@@ -805,8 +807,13 @@ Error ResourceLoaderText::load() {
|
|
error = OK;
|
|
error = OK;
|
|
//get it here
|
|
//get it here
|
|
resource = packed_scene;
|
|
resource = packed_scene;
|
|
- if (cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE && !ResourceCache::has(res_path)) {
|
|
|
|
- packed_scene->set_path(res_path);
|
|
|
|
|
|
+ if (cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) {
|
|
|
|
+ if (!ResourceCache::has(res_path)) {
|
|
|
|
+ packed_scene->set_path(res_path);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ packed_scene->get_state()->set_path(res_path);
|
|
|
|
+ packed_scene->set_path_cache(res_path);
|
|
}
|
|
}
|
|
|
|
|
|
resource_current++;
|
|
resource_current++;
|
|
@@ -1650,7 +1657,22 @@ Ref<Resource> ResourceFormatLoaderText::load(const String &p_path, const String
|
|
|
|
|
|
ResourceLoaderText loader;
|
|
ResourceLoaderText loader;
|
|
String path = !p_original_path.is_empty() ? p_original_path : p_path;
|
|
String path = !p_original_path.is_empty() ? p_original_path : p_path;
|
|
- loader.cache_mode = p_cache_mode;
|
|
|
|
|
|
+ switch (p_cache_mode) {
|
|
|
|
+ case CACHE_MODE_IGNORE:
|
|
|
|
+ case CACHE_MODE_REUSE:
|
|
|
|
+ case CACHE_MODE_REPLACE:
|
|
|
|
+ loader.cache_mode = p_cache_mode;
|
|
|
|
+ loader.cache_mode_for_external = CACHE_MODE_REUSE;
|
|
|
|
+ break;
|
|
|
|
+ case CACHE_MODE_IGNORE_DEEP:
|
|
|
|
+ loader.cache_mode = ResourceFormatLoader::CACHE_MODE_IGNORE;
|
|
|
|
+ loader.cache_mode_for_external = p_cache_mode;
|
|
|
|
+ break;
|
|
|
|
+ case CACHE_MODE_REPLACE_DEEP:
|
|
|
|
+ loader.cache_mode = ResourceFormatLoader::CACHE_MODE_REPLACE;
|
|
|
|
+ loader.cache_mode_for_external = p_cache_mode;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
loader.use_sub_threads = p_use_sub_threads;
|
|
loader.use_sub_threads = p_use_sub_threads;
|
|
loader.local_path = ProjectSettings::get_singleton()->localize_path(path);
|
|
loader.local_path = ProjectSettings::get_singleton()->localize_path(path);
|
|
loader.progress = r_progress;
|
|
loader.progress = r_progress;
|