summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-22 08:46:34 -0300
committerGitHub <noreply@github.com>2017-11-22 08:46:34 -0300
commit0300522189b090e7c1ae9c8888101ea32c4ce6bd (patch)
tree5d703d0d17e8dda476c6caa4eecd3de253a33f7b /core
parent7f022a33a31ad276047744ef42a9fbd85f39a6b4 (diff)
parent3eb7858a3a2b0a03ca8ec5ef5c85b572f612f28b (diff)
Merge pull request #13176 from bojidar-bg/allow-subproperty-set
Fix combatibility with older .scn files
Diffstat (limited to 'core')
-rw-r--r--core/io/resource_format_binary.cpp11
-rw-r--r--core/io/resource_format_binary.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index aa51b00028..df0d41ea9d 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -84,8 +84,10 @@ enum {
OBJECT_INTERNAL_RESOURCE = 2,
OBJECT_EXTERNAL_RESOURCE_INDEX = 3,
//version 2: added 64 bits support for float and int
- FORMAT_VERSION = 2,
- FORMAT_VERSION_CAN_RENAME_DEPS = 1
+ //version 3: changed nodepath encoding
+ FORMAT_VERSION = 3,
+ FORMAT_VERSION_CAN_RENAME_DEPS = 1,
+ FORMAT_VERSION_NO_NODEPATH_PROPERTY = 3,
};
@@ -273,6 +275,9 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) {
uint32_t subname_count = f->get_16();
absolute = subname_count & 0x8000;
subname_count &= 0x7FFF;
+ if (ver_format < FORMAT_VERSION_NO_NODEPATH_PROPERTY) {
+ subname_count += 1; // has a property field, so we should count it as well
+ }
for (int i = 0; i < name_count; i++)
names.push_back(_get_string());
@@ -854,7 +859,7 @@ void ResourceInteractiveLoaderBinary::open(FileAccess *p_f) {
uint32_t ver_major = f->get_32();
uint32_t ver_minor = f->get_32();
- uint32_t ver_format = f->get_32();
+ ver_format = f->get_32();
print_bl("big endian: " + itos(big_endian));
#ifdef BIG_ENDIAN_ENABLED
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 2316f05b3c..687da0a9b4 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -41,6 +41,7 @@ class ResourceInteractiveLoaderBinary : public ResourceInteractiveLoader {
String res_path;
String type;
Ref<Resource> resource;
+ uint32_t ver_format;
FileAccess *f;