You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Dictionary: Serialize empty dict as {} instead of {\n}
Also make sure to always convert multiline dictionaries to a single line for its EditorHelp representation, as multiline values break formatting.
This commit is contained in:
@@ -1649,12 +1649,13 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
|
||||
dict.get_key_list(&keys);
|
||||
keys.sort();
|
||||
|
||||
if (keys.is_empty()) { // Avoid unnecessary line break.
|
||||
p_store_string_func(p_store_string_ud, "{}");
|
||||
break;
|
||||
}
|
||||
|
||||
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, recursion_count);
|
||||
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, recursion_count);
|
||||
|
||||
Reference in New Issue
Block a user