diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/marshalls.cpp | 20 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 6 |
2 files changed, 7 insertions, 19 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 1d9d2dd959..37320d7a77 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -324,7 +324,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int ERR_FAIL_COND_V(len < 12, ERR_INVALID_DATA); Vector<StringName> names; Vector<StringName> subnames; - StringName prop; uint32_t namecount = strlen &= 0x7FFFFFFF; uint32_t subnamecount = decode_uint32(buf + 4); @@ -333,9 +332,10 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int len -= 12; buf += 12; + if (flags & 2) // Obsolete format with property seperate from subpath + subnamecount++; + uint32_t total = namecount + subnamecount; - if (flags & 2) - total++; if (r_len) (*r_len) += 12; @@ -359,10 +359,8 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int if (i < namecount) names.push_back(str); - else if (i < namecount + subnamecount) - subnames.push_back(str); else - prop = str; + subnames.push_back(str); buf += strlen + pad; len -= strlen + pad; @@ -371,7 +369,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int (*r_len) += 4 + strlen + pad; } - r_variant = NodePath(names, subnames, flags & 1, prop); + r_variant = NodePath(names, subnames, flags & 1); } else { //old format, just a string @@ -919,8 +917,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo uint32_t flags = 0; if (np.is_absolute()) flags |= 1; - if (np.get_property() != StringName()) - flags |= 2; encode_uint32(flags, buf + 8); @@ -930,8 +926,6 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 12; int total = np.get_name_count() + np.get_subname_count(); - if (np.get_property() != StringName()) - total++; for (int i = 0; i < total; i++) { @@ -939,10 +933,8 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo if (i < np.get_name_count()) str = np.get_name(i); - else if (i < np.get_name_count() + np.get_subname_count()) - str = np.get_subname(i - np.get_subname_count()); else - str = np.get_property(); + str = np.get_subname(i - np.get_name_count()); CharString utf8 = str.utf8(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 8dc396c362..aa51b00028 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -267,7 +267,6 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { Vector<StringName> names; Vector<StringName> subnames; - StringName property; bool absolute; int name_count = f->get_16(); @@ -279,9 +278,8 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { names.push_back(_get_string()); for (uint32_t i = 0; i < subname_count; i++) subnames.push_back(_get_string()); - property = _get_string(); - NodePath np = NodePath(names, subnames, absolute, property); + NodePath np = NodePath(names, subnames, absolute); r_v = np; @@ -1454,7 +1452,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant &p_property, f->store_32(get_string_index(np.get_name(i))); for (int i = 0; i < np.get_subname_count(); i++) f->store_32(get_string_index(np.get_subname(i))); - f->store_32(get_string_index(np.get_property())); } break; case Variant::_RID: { @@ -1685,7 +1682,6 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant get_string_index(np.get_name(i)); for (int i = 0; i < np.get_subname_count(); i++) get_string_index(np.get_subname(i)); - get_string_index(np.get_property()); } break; default: {} |