You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Add forward compat parsing of PackedVector4Array
This new Variant type is being added in 4.3, and breaks compatibility with earlier releases. By adding minimal parsing support (converting to plain Array) we can at least open the scenes, and minimize the data loss when going back and forth between minor versions.
This commit is contained in:
@@ -1394,6 +1394,25 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
||||
}
|
||||
}
|
||||
|
||||
value = arr;
|
||||
} else if (id == "PackedVector4Array" || id == "PoolVector4Array" || id == "Vector4Array") {
|
||||
// Not supported for writing, added for compatibility with 4.3.
|
||||
// Handled as a plain array of Vector4 elements.
|
||||
Vector<real_t> args;
|
||||
Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
Array arr;
|
||||
{
|
||||
int len = args.size() / 4;
|
||||
arr.resize(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
arr[i] = Vector4(args[i * 4 + 0], args[i * 4 + 1], args[i * 4 + 2], args[i * 4 + 3]);
|
||||
}
|
||||
}
|
||||
|
||||
value = arr;
|
||||
} else if (id == "PackedColorArray" || id == "PoolColorArray" || id == "ColorArray") {
|
||||
Vector<float> args;
|
||||
|
||||
Reference in New Issue
Block a user