summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-20 12:44:56 +0100
committerGitHub <noreply@github.com>2019-12-20 12:44:56 +0100
commit48edf6333029fc961528892af190201197b44c40 (patch)
treef56b1bf1009cebb3b23439bdefb47bb66169151e /scene
parent9abbf517ffd6358e3ea79a6be46a0dd979115a0b (diff)
parente7e095da3fd9140cfbbe11dd178981633819d642 (diff)
Merge pull request #34472 from timothyqiu/quote-property
Fixes property names serialization in project.godot
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/resource_format_text.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index baffc1396d..d4567abc07 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1459,20 +1459,6 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant,
}
}
-static String _valprop(const String &p_name) {
-
- // Escape and quote strings with extended ASCII or further Unicode characters
- // as well as '"', '=' or ' ' (32)
- const CharType *cstr = p_name.c_str();
- for (int i = 0; cstr[i]; i++) {
- if (cstr[i] == '=' || cstr[i] == '"' || cstr[i] < 33 || cstr[i] > 126) {
- return "\"" + p_name.c_escape_multiline() + "\"";
- }
- }
- // Keep as is
- return p_name;
-}
-
Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
if (p_path.ends_with(".tscn")) {
@@ -1675,7 +1661,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
String vars;
VariantWriter::write_to_string(value, vars, _write_resources, this);
- f->store_string(_valprop(name) + " = " + vars + "\n");
+ f->store_string(name.property_name_encode() + " = " + vars + "\n");
}
}
@@ -1747,7 +1733,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
String vars;
VariantWriter::write_to_string(state->get_node_property_value(i, j), vars, _write_resources, this);
- f->store_string(_valprop(String(state->get_node_property_name(i, j))) + " = " + vars + "\n");
+ f->store_string(String(state->get_node_property_name(i, j)).property_name_encode() + " = " + vars + "\n");
}
if (i < state->get_node_count() - 1)