From 160601cc78d14d500095a5127d49c335b249141a Mon Sep 17 00:00:00 2001 From: nikitalita <69168929+nikitalita@users.noreply.github.com> Date: Thu, 29 Jul 2021 18:17:49 -0700 Subject: Fix binary resource loading and saving --- scene/resources/resource_format_text.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scene') diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 3f6e926aa7..f71f5f27cb 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1020,11 +1020,11 @@ Error ResourceLoaderText::save_as_binary(FileAccess *p_f, const String &p_path) bs_save_unicode_string(wf.f, is_scene ? "PackedScene" : resource_type); wf->store_64(0); //offset to import metadata, this is no longer used - f->store_32(ResourceFormatSaverBinaryInstance::FORMAT_FLAG_NAMED_SCENE_IDS | ResourceFormatSaverBinaryInstance::FORMAT_FLAG_UIDS); + wf->store_32(ResourceFormatSaverBinaryInstance::FORMAT_FLAG_NAMED_SCENE_IDS | ResourceFormatSaverBinaryInstance::FORMAT_FLAG_UIDS); - f->store_64(res_uid); + wf->store_64(res_uid); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 11; i++) { wf->store_32(0); // reserved } @@ -1074,7 +1074,7 @@ Error ResourceLoaderText::save_as_binary(FileAccess *p_f, const String &p_path) bs_save_unicode_string(wf.f, type); bs_save_unicode_string(wf.f, path); - wf.f->store_64(uid); + wf->store_64(uid); int lindex = dummy_read.external_resources.size(); Ref dr; -- cgit v1.2.3 From bc58bf5477bc06c5ddcda04a95c6b13e137eec88 Mon Sep 17 00:00:00 2001 From: nikitalita <69168929+nikitalita@users.noreply.github.com> Date: Thu, 29 Jul 2021 22:24:29 -0700 Subject: Use constant for reserved field count --- scene/resources/resource_format_text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scene') diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index f71f5f27cb..a32e12ed51 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1024,7 +1024,7 @@ Error ResourceLoaderText::save_as_binary(FileAccess *p_f, const String &p_path) wf->store_64(res_uid); - for (int i = 0; i < 11; i++) { + for (int i = 0; i < ResourceFormatSaverBinaryInstance::RESERVED_FIELDS; i++) { wf->store_32(0); // reserved } -- cgit v1.2.3