Merge pull request #29432 from bojidar-bg/29401-tscn-serialization

Escape node names when saving to .tscn
This commit is contained in:
Rémi Verschelde 2019-06-03 16:25:00 +02:00 committed by GitHub
commit 22583ec6a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1712,15 +1712,15 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
Vector<StringName> groups = state->get_node_groups(i);
String header = "[node";
header += " name=\"" + String(name) + "\"";
header += " name=\"" + String(name).c_escape() + "\"";
if (type != StringName()) {
header += " type=\"" + String(type) + "\"";
}
if (path != NodePath()) {
header += " parent=\"" + String(path.simplified()) + "\"";
header += " parent=\"" + String(path.simplified()).c_escape() + "\"";
}
if (owner != NodePath() && owner != NodePath(".")) {
header += " owner=\"" + String(owner.simplified()) + "\"";
header += " owner=\"" + String(owner.simplified()).c_escape() + "\"";
}
if (index >= 0) {
header += " index=\"" + itos(index) + "\"";