diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2022-02-19 08:22:42 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-19 08:22:42 +0100 |
| commit | 719762d4dcbbb102e3ca2c3e1b635be295b2bd94 (patch) | |
| tree | c36ee9b674f33b40321f4b616bad044ed3b8c66e /core/io/resource_format_binary.cpp | |
| parent | 420ad25348565bc921f54c9561a6b358563fe48d (diff) | |
| parent | 722945be61f78bfc5ca12d1ddd6c57108dac0f26 (diff) | |
| download | redot-engine-719762d4dcbbb102e3ca2c3e1b635be295b2bd94.tar.gz | |
Merge pull request #58166 from Zylann/fix_binary_resource_with_doubles
Fix loading of binary resources with 64-bit floats
Diffstat (limited to 'core/io/resource_format_binary.cpp')
| -rw-r--r-- | core/io/resource_format_binary.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 611f371229..ee59a916f1 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -901,6 +901,7 @@ void ResourceLoaderBinary::open(FileAccess *p_f, bool p_no_resources, bool p_kee if (flags & ResourceFormatSaverBinaryInstance::FORMAT_FLAG_UIDS) { using_uids = true; } + f->real_is_double = (flags & ResourceFormatSaverBinaryInstance::FORMAT_FLAG_REAL_T_IS_DOUBLE) != 0; if (using_uids) { uid = f->get_64(); @@ -1897,7 +1898,13 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p save_unicode_string(f, p_resource->get_class()); f->store_64(0); //offset to import metadata - f->store_32(FORMAT_FLAG_NAMED_SCENE_IDS | FORMAT_FLAG_UIDS); + { + uint32_t format_flags = FORMAT_FLAG_NAMED_SCENE_IDS | FORMAT_FLAG_UIDS; +#ifdef REAL_T_IS_DOUBLE + format_flags |= FORMAT_FLAG_REAL_T_IS_DOUBLE; +#endif + f->store_32(format_flags); + } ResourceUID::ID uid = ResourceSaver::get_resource_id_for_path(p_path, true); f->store_64(uid); for (int i = 0; i < ResourceFormatSaverBinaryInstance::RESERVED_FIELDS; i++) { |
