diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2023-01-11 01:16:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 01:16:12 +0100 |
commit | 3862939327cd13170c63aa9f6962d66cd6caed26 (patch) | |
tree | 49424a14115cdf24a7c0d0643fb375e3f7fbedf8 /scene | |
parent | 5c6158fdfd16c9f1d6f70865905cea172d581d19 (diff) | |
parent | eb3fa8eaa4bfcc27ecffc2d69e070cf306064643 (diff) |
Merge pull request #71170 from reduz/text-loader-fixes
Text resource loader fixes
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/resource_format_text.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index d80a4004a4..80b9ff3f38 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -601,14 +601,14 @@ Error ResourceLoaderText::load() { resource_current++; + if (progress && resources_total > 0) { + *progress = resource_current / float(resources_total); + } + int_resources[id] = res; //always assign int resources - if (do_assign) { - if (cache_mode == ResourceFormatLoader::CACHE_MODE_IGNORE) { - res->set_path(path); - } else { - res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE); - res->set_scene_unique_id(id); - } + if (do_assign && cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) { + res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE); + res->set_scene_unique_id(id); } Dictionary missing_resource_properties; @@ -663,10 +663,6 @@ Error ResourceLoaderText::load() { if (!missing_resource_properties.is_empty()) { res->set_meta(META_MISSING_RESOURCES, missing_resource_properties); } - - if (progress && resources_total > 0) { - *progress = resource_current / float(resources_total); - } } while (true) { @@ -716,8 +712,6 @@ Error ResourceLoaderText::load() { resource = Ref<Resource>(r); } - resource_current++; - Dictionary missing_resource_properties; while (true) { @@ -770,6 +764,12 @@ Error ResourceLoaderText::load() { } } + resource_current++; + + if (progress && resources_total > 0) { + *progress = resource_current / float(resources_total); + } + if (missing_resource) { missing_resource->set_recording_properties(false); } @@ -779,9 +779,6 @@ Error ResourceLoaderText::load() { } error = OK; - if (progress && resources_total > 0) { - *progress = resource_current / float(resources_total); - } return error; } |