diff options
author | Juan Linietsky <reduzio@gmail.com> | 2021-09-09 17:17:02 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-09 17:17:02 -0300 |
commit | be5c75b0070a8e17605837ddd8169d27916d0f22 (patch) | |
tree | 90ab8037b0c9605e893726d619fb2cfbb08f3deb /scene/resources | |
parent | 6679be45aa514ee693fbcec2a15b35477b38da91 (diff) | |
parent | d33a7367b6748a3fac70bb90ebf930c7a663430f (diff) |
Merge pull request #52284 from Calinou/tscn-groups-write-single-line
Write node groups on a single line when saving a `.tscn` file
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/resource_format_text.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index b863a309c0..341ce22185 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1849,10 +1849,16 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r } if (groups.size()) { + // Write all groups on the same line as they're part of a section header. + // This improves readability while not impacting VCS friendliness too much, + // since it's rare to have more than 5 groups assigned to a single node. groups.sort_custom<StringName::AlphCompare>(); - String sgroups = " groups=[\n"; + String sgroups = " groups=["; for (int j = 0; j < groups.size(); j++) { - sgroups += "\"" + String(groups[j]).c_escape() + "\",\n"; + sgroups += "\"" + String(groups[j]).c_escape() + "\""; + if (j < groups.size() - 1) { + sgroups += ", "; + } } sgroups += "]"; header += sgroups; |