summaryrefslogtreecommitdiff
path: root/scene/resources/scene_format_text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/scene_format_text.cpp')
-rw-r--r--scene/resources/scene_format_text.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index fa56f63465..3a254836a2 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -28,11 +28,12 @@
/*************************************************************************/
#include "scene_format_text.h"
-#include "globals.h"
+#include "global_config.h"
#include "version.h"
#include "os/dir_access.h"
-#define FORMAT_VERSION 1
+//version 2: changed names for basis, rect3, poolvectors, etc.
+#define FORMAT_VERSION 2
#include "version.h"
#include "os/dir_access.h"
@@ -397,7 +398,7 @@ Error ResourceInteractiveLoaderText::poll() {
int type=-1;
int name=-1;
int instance=-1;
-// int base_scene=-1;
+ //int base_scene=-1;
if (next_tag.fields.has("name")) {
name=packed_scene->get_state()->add_name(next_tag.fields["name"]);
@@ -950,7 +951,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const
Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText );
ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
-// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
+ //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
ria->open(f);
return ria;
@@ -984,7 +985,7 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const{
- String ext=p_path.extension().to_lower();
+ String ext=p_path.get_extension().to_lower();
if (ext=="tscn")
return "PackedScene";
else if (ext!="tres")
@@ -1001,7 +1002,7 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const{
Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText );
ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
-// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
+ //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
String r = ria->recognize(f);
return r;
}
@@ -1018,7 +1019,7 @@ void ResourceFormatLoaderText::get_dependencies(const String& p_path,List<String
Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText );
ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
-// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
+ //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
ria->get_dependencies(f,p_dependencies,p_add_types);
@@ -1035,7 +1036,7 @@ Error ResourceFormatLoaderText::rename_dependencies(const String &p_path,const M
Ref<ResourceInteractiveLoaderText> ria = memnew( ResourceInteractiveLoaderText );
ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
ria->res_path=ria->local_path;
-// ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
+ //ria->set_local_path( GlobalConfig::get_singleton()->localize_path(p_path) );
return ria->rename_dependencies(f,p_path,p_map);
}
@@ -1158,7 +1159,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;
}
@@ -1208,10 +1209,12 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re
if (packed_scene.is_null())
title+="type=\""+p_resource->get_class()+"\" ";
int load_steps=saved_resources.size()+external_resources.size();
- //if (packed_scene.is_valid()) {
- // load_steps+=packed_scene->get_node_count();
- //}
+ /*
+ if (packed_scene.is_valid()) {
+ load_steps+=packed_scene->get_node_count();
+ }
//no, better to not use load steps from nodes, no point to that
+ */
if (load_steps>1) {
title+="load_steps="+itos(load_steps)+" ";
@@ -1299,7 +1302,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re
List<PropertyInfo> property_list;
res->get_property_list(&property_list);
-// property_list.sort();
+ //property_list.sort();
for(List<PropertyInfo>::Element *PE = property_list.front();PE;PE=PE->next()) {
@@ -1358,13 +1361,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;j<groups.size();j++) {
- if (j>0)
- sgroups+=", ";
- sgroups+="\""+groups[j].operator String().c_escape()+"\"";
+ sgroups+="\""+String(groups[j]).c_escape()+"\",\n";
}
- sgroups+=" ]";
+ sgroups+="]";
header+=sgroups;
}