diff options
Diffstat (limited to 'scene/resources/resource_format_text.cpp')
-rw-r--r-- | scene/resources/resource_format_text.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index d4d8018d43..58645dbe65 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -30,9 +30,9 @@ #include "resource_format_text.h" +#include "core/config/project_settings.h" #include "core/io/resource_format_binary.h" #include "core/os/dir_access.h" -#include "core/project_settings.h" #include "core/version.h" //version 2: changed names for basis, aabb, Vectors, etc. @@ -704,7 +704,6 @@ ResourceLoaderText::ResourceLoaderText() { resources_total = 0; resource_current = 0; - use_sub_threads = false; progress = nullptr; lines = false; @@ -838,6 +837,11 @@ Error ResourceLoaderText::rename_dependencies(FileAccess *p_f, const String &p_p f->seek(tag_end); uint8_t c = f->get_8(); + if (c == '\n' && !f->eof_reached()) { + // Skip first newline character since we added one + c = f->get_8(); + } + while (!f->eof_reached()) { fw->store_8(c); c = f->get_8(); @@ -1763,6 +1767,10 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r } for (int i = 0; i < state->get_connection_count(); i++) { + if (i == 0) { + f->store_line(""); + } + String connstr = "[connection"; connstr += " signal=\"" + String(state->get_connection_signal(i)) + "\""; connstr += " from=\"" + String(state->get_connection_source(i).simplified()) + "\""; @@ -1786,7 +1794,10 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r Vector<NodePath> editable_instances = state->get_editable_instances(); for (int i = 0; i < editable_instances.size(); i++) { - f->store_line("\n[editable path=\"" + editable_instances[i].operator String() + "\"]"); + if (i == 0) { + f->store_line(""); + } + f->store_line("[editable path=\"" + editable_instances[i].operator String() + "\"]"); } } |