diff options
-rw-r--r-- | core/io/marshalls.cpp | 15 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 9 | ||||
-rw-r--r-- | core/io/resource_format_binary.h | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 12de2f582e..d0bc05566e 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -1068,6 +1068,21 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo flags |= ENCODE_FLAG_OBJECT_AS_ID; } } break; +#ifdef REAL_T_IS_DOUBLE + case Variant::VECTOR2: + case Variant::VECTOR3: + case Variant::PACKED_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: + case Variant::TRANSFORM2D: + case Variant::TRANSFORM3D: + case Variant::QUATERNION: + case Variant::PLANE: + case Variant::BASIS: + case Variant::RECT2: + case Variant::AABB: { + flags |= ENCODE_FLAG_64; + } break; +#endif // REAL_T_IS_DOUBLE default: { } // nothing to do at this stage } 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++) { diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index ecc3e95f6b..c80c9b0ac9 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -164,6 +164,8 @@ public: enum { FORMAT_FLAG_NAMED_SCENE_IDS = 1, FORMAT_FLAG_UIDS = 2, + FORMAT_FLAG_REAL_T_IS_DOUBLE = 4, + // Amount of reserved 32-bit fields in resource header RESERVED_FIELDS = 11 }; |