summaryrefslogtreecommitdiffstats
path: root/core/io/resource_format_xml.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-03-13 22:57:24 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-03-13 22:57:24 -0300
commit31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b (patch)
treeb6d3a290333c72940b49ed4c930ff6858a59515e /core/io/resource_format_xml.cpp
parenta65edb4caabec21654c56552e11aacf0fd9291de (diff)
downloadredot-engine-31ce3c5fd0300aac1e86bced1efc5f9ec94bdb6b.tar.gz
-fix bug in cache for atlas import/export
-fix some menus -fixed bug in out transition curves -detect and remove file:/// in collada -remove multiscript for now -remove dependencies on mouse in OS, moved to Input -avoid fscache from screwing up (fix might make it slower, but it works) -funcref was missing, it's there now
Diffstat (limited to 'core/io/resource_format_xml.cpp')
-rw-r--r--core/io/resource_format_xml.cpp51
1 files changed, 45 insertions, 6 deletions
diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp
index fc5aecfd99..f3c0f1cb8b 100644
--- a/core/io/resource_format_xml.cpp
+++ b/core/io/resource_format_xml.cpp
@@ -1357,6 +1357,31 @@ Error ResourceInteractiveLoaderXML::poll() {
if (error!=OK)
return error;
+ if (ext_resources.size()) {
+
+ error=ERR_FILE_CORRUPT;
+ String path=ext_resources.front()->get();
+
+ RES res = ResourceLoader::load(path);
+
+ if (res.is_null()) {
+
+ if (ResourceLoader::get_abort_on_missing_resources()) {
+ ERR_EXPLAIN(local_path+":"+itos(get_current_line())+": editor exported unexisting resource at: "+path);
+ ERR_FAIL_V(error);
+ } else {
+ ResourceLoader::notify_load_error("Resource Not Found: "+path);
+ }
+ } else {
+
+ resource_cache.push_back(res);
+ }
+
+ error=OK;
+ ext_resources.pop_front();
+ resource_current++;
+ return error;
+ }
bool exit;
Tag *tag = parse_tag(&exit);
@@ -1528,7 +1553,7 @@ int ResourceInteractiveLoaderXML::get_stage() const {
}
int ResourceInteractiveLoaderXML::get_stage_count() const {
- return resources_total;
+ return resources_total+ext_resources.size();
}
ResourceInteractiveLoaderXML::~ResourceInteractiveLoaderXML() {
@@ -1573,6 +1598,12 @@ void ResourceInteractiveLoaderXML::get_dependencies(FileAccess *f,List<String> *
path=Globals::get_singleton()->localize_path(local_path.get_base_dir()+"/"+path);
}
+ if (path.ends_with("*")) {
+ ERR_FAIL_COND(!tag->args.has("type"));
+ String type = tag->args["type"];
+ path = ResourceLoader::guess_full_filename(path,type);
+ }
+
p_dependencies->push_back(path);
Error err = close_tag("ext_resource");
@@ -1642,6 +1673,19 @@ void ResourceInteractiveLoaderXML::open(FileAccess *p_f) {
}
+ String preload_depts = "deps/"+local_path.md5_text();
+ if (Globals::get_singleton()->has(preload_depts)) {
+ ext_resources.clear();
+ //ignore external resources and use these
+ NodePath depts=Globals::get_singleton()->get(preload_depts);
+
+ for(int i=0;i<depts.get_name_count();i++) {
+ ext_resources.push_back(depts.get_name(i));
+ }
+ print_line(local_path+" - EXTERNAL RESOURCES: "+itos(ext_resources.size()));
+ }
+
+
}
String ResourceInteractiveLoaderXML::recognize(FileAccess *p_f) {
@@ -1969,8 +2013,6 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V
if (res->get_path().length() && res->get_path().find("::")==-1) {
//external resource
String path=relative_paths?local_path.path_to_file(res->get_path()):res->get_path();
- if (no_extension)
- path=path.basename()+".*";
escape(path);
params+=" path=\""+path+"\"";
} else {
@@ -2458,7 +2500,6 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
relative_paths=p_flags&ResourceSaver::FLAG_RELATIVE_PATHS;
skip_editor=p_flags&ResourceSaver::FLAG_OMIT_EDITOR_PROPERTIES;
bundle_resources=p_flags&ResourceSaver::FLAG_BUNDLE_RESOURCES;
- no_extension=p_flags&ResourceSaver::FLAG_NO_EXTENSION;
depth=0;
// save resources
@@ -2475,8 +2516,6 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
write_tabs();
String p = E->get()->get_path();
- if (no_extension)
- p=p.basename()+".*";
enter_tag("ext_resource","path=\""+p+"\" type=\""+E->get()->get_save_type()+"\""); //bundled
exit_tag("ext_resource"); //bundled