summaryrefslogtreecommitdiffstats
path: root/core/io/resource_format_binary.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_binary.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_binary.cpp')
-rw-r--r--core/io/resource_format_binary.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index c54398935e..47f278596b 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -647,7 +647,7 @@ Error ResourceInteractiveLoaderBinary::poll(){
}
stage++;
- return OK;
+ return error;
}
s-=external_resources.size();
@@ -804,7 +804,12 @@ void ResourceInteractiveLoaderBinary::get_dependencies(FileAccess *p_f,List<Stri
for(int i=0;i<external_resources.size();i++) {
- p_dependencies->push_back(external_resources[i].path);
+ String dep=external_resources[i].path;
+ if (dep.ends_with("*")) {
+ dep=ResourceLoader::guess_full_filename(dep,external_resources[i].type);
+ }
+
+ p_dependencies->push_back(dep);
}
}
@@ -892,6 +897,19 @@ void ResourceInteractiveLoaderBinary::open(FileAccess *p_f) {
}
+ //see if the exporter has different set of external resources for more efficient loading
+ String preload_depts = "deps/"+res_path.md5_text();
+ if (Globals::get_singleton()->has(preload_depts)) {
+ external_resources.clear();
+ //ignore external resources and use these
+ NodePath depts=Globals::get_singleton()->get(preload_depts);
+ external_resources.resize(depts.get_name_count());
+ for(int i=0;i<depts.get_name_count();i++) {
+ external_resources[i].path=depts.get_name(i);
+ }
+ print_line(res_path+" - EXTERNAL RESOURCES: "+itos(external_resources.size()));
+ }
+
print_bl("ext resources: "+itos(ext_resources_size));
uint32_t int_resources_size=f->get_32();
@@ -1412,8 +1430,6 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
f->store_32(OBJECT_EXTERNAL_RESOURCE);
save_unicode_string(res->get_save_type());
String path=relative_paths?local_path.path_to_file(res->get_path()):res->get_path();
- if (no_extensions)
- path=path.basename()+".*";
save_unicode_string(path);
} else {
@@ -1439,7 +1455,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(const Variant& p_property,
f->store_32(VARIANT_DICTIONARY);
Dictionary d = p_property;
- f->store_32(uint32_t(d.size())|(d.is_shared()?0x80000000:0));
+ f->store_32(uint32_t(d.size())|(d.is_shared()?0x80000000:0));
List<Variant> keys;
d.get_key_list(&keys);
@@ -1734,7 +1750,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
skip_editor=p_flags&ResourceSaver::FLAG_OMIT_EDITOR_PROPERTIES;
bundle_resources=p_flags&ResourceSaver::FLAG_BUNDLE_RESOURCES;
big_endian=p_flags&ResourceSaver::FLAG_SAVE_BIG_ENDIAN;
- no_extensions=p_flags&ResourceSaver::FLAG_NO_EXTENSION;
+
local_path=p_path.get_base_dir();
//bin_meta_idx = get_string_index("__bin_meta__"); //is often used, so create
@@ -1816,8 +1832,6 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
save_unicode_string(E->get()->get_save_type());
String path = E->get()->get_path();
- if (no_extensions)
- path=path.basename()+".*";
save_unicode_string(path);
}
// save internal resource table
@@ -1861,6 +1875,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
}
f->seek_end();
+ print_line("SAVING: "+p_path);
if (p_resource->get_import_metadata().is_valid()) {
uint64_t md_pos = f->get_pos();
Ref<ResourceImportMetadata> imd=p_resource->get_import_metadata();
@@ -1869,6 +1884,8 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
for(int i=0;i<imd->get_source_count();i++) {
save_unicode_string(imd->get_source_path(i));
save_unicode_string(imd->get_source_md5(i));
+ print_line("SAVE PATH: "+imd->get_source_path(i));
+ print_line("SAVE MD5: "+imd->get_source_md5(i));
}
List<String> options;
imd->get_options(&options);