From 7dbb1c0571c0d1fb26c28552b09430807cc4d717 Mon Sep 17 00:00:00 2001 From: Pedro J. Estébanez Date: Mon, 16 Jan 2017 18:03:38 +0100 Subject: 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. --- scene/resources/scene_format_text.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'scene/resources/scene_format_text.cpp') diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp index 615c092da..cb9e7c3df 100644 --- a/scene/resources/scene_format_text.cpp +++ b/scene/resources/scene_format_text.cpp @@ -1158,7 +1158,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant& p_variant,b static String _valprop(const String& p_name) { if (p_name.find("\"")!=-1 || p_name.find("=")!=-1 || p_name.find(" ")!=-1) - return "\""+p_name.c_escape()+"\""; + return "\""+p_name.c_escape_multiline()+"\""; return p_name; } @@ -1358,13 +1358,11 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re } if (groups.size()) { - String sgroups=" groups=[ "; + String sgroups=" groups=[\n"; for(int j=0;j0) - sgroups+=", "; - sgroups+="\""+groups[j].operator String().c_escape()+"\""; + sgroups+="\""+String(groups[j]).c_escape()+"\",\n"; } - sgroups+=" ]"; + sgroups+="]"; header+=sgroups; } -- cgit v1.2.3-70-g09d2