You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Improve .tscn VCS
Serialize dictionaries adding newlines between key-value pairs
Serialize group lists also with newlines in between
Serialize string properties escaping only " and \ (needed for a good diff experience with built-in scripts and shaders)
Bonus:
Make AnimationPlayer serialize its blend times always sorted so their order is predictable in the .tscn file.
This PR is back-compat; won't break the load of existing files.
Cherry-picked from 7dbb1c0571
This commit is contained in:
@@ -1878,7 +1878,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
|
||||
|
||||
String str=p_variant;
|
||||
|
||||
str="\""+str.c_escape()+"\"";
|
||||
str="\""+str.c_escape_multiline()+"\"";
|
||||
p_store_string_func(p_store_string_ud, str );
|
||||
} break;
|
||||
case Variant::VECTOR2: {
|
||||
@@ -2123,20 +2123,20 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
|
||||
dict.get_key_list(&keys);
|
||||
keys.sort();
|
||||
|
||||
p_store_string_func(p_store_string_ud,"{ ");
|
||||
p_store_string_func(p_store_string_ud,"{\n");
|
||||
for(List<Variant>::Element *E=keys.front();E;E=E->next()) {
|
||||
|
||||
//if (!_check_type(dict[E->get()]))
|
||||
// continue;
|
||||
write(E->get(),p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud);
|
||||
p_store_string_func(p_store_string_ud,":");
|
||||
p_store_string_func(p_store_string_ud,": ");
|
||||
write(dict[E->get()],p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud);
|
||||
if (E->next())
|
||||
p_store_string_func(p_store_string_ud,", ");
|
||||
p_store_string_func(p_store_string_ud,",\n");
|
||||
}
|
||||
|
||||
|
||||
p_store_string_func(p_store_string_ud," }");
|
||||
p_store_string_func(p_store_string_ud,"\n}");
|
||||
|
||||
|
||||
} break;
|
||||
|
||||
Reference in New Issue
Block a user