summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-05-01 09:34:23 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-05-10 15:59:09 -0300
commit1bea8e1eacc68bcedbd3f207395bccf11011dae2 (patch)
treeb75303a69491978c1e13360a3e6f355c5234dfe0 /core/io
parent6a0473bcc23c096ef9ee929632a209761c2668f6 (diff)
New lightmapper
-Added LocalVector (needed it) -Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too) -Fixes and changes all around the place -Added library for 128 bits fixed point (required for Delaunay3D)
Diffstat (limited to 'core/io')
-rw-r--r--core/io/resource_format_binary.cpp24
-rw-r--r--core/io/resource_format_binary.h2
-rw-r--r--core/io/resource_importer.cpp2
3 files changed, 17 insertions, 11 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 8c7559479b..e0fea143bb 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -337,10 +337,14 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
} break;
case OBJECT_INTERNAL_RESOURCE: {
uint32_t index = f->get_32();
+ String path = res_path + "::" + itos(index);
+
if (use_nocache) {
- r_v = internal_resources[index].cache;
+ if (!internal_index_cache.has(path)) {
+ WARN_PRINT(String("Couldn't load resource (no cache): " + path).utf8().get_data());
+ }
+ r_v = internal_index_cache[path];
} else {
- String path = res_path + "::" + itos(index);
RES res = ResourceLoader::load(path);
if (res.is_null()) {
WARN_PRINT(String("Couldn't load resource: " + path).utf8().get_data());
@@ -720,13 +724,15 @@ Error ResourceLoaderBinary::load() {
if (!main) {
+ path = internal_resources[i].path;
+
+ if (path.begins_with("local://")) {
+ path = path.replace_first("local://", "");
+ subindex = path.to_int();
+ path = res_path + "::" + path;
+ }
+
if (!use_nocache) {
- path = internal_resources[i].path;
- if (path.begins_with("local://")) {
- path = path.replace_first("local://", "");
- subindex = path.to_int();
- path = res_path + "::" + path;
- }
if (ResourceCache::has(path)) {
//already loaded, don't do anything
@@ -769,7 +775,7 @@ Error ResourceLoaderBinary::load() {
r->set_subindex(subindex);
if (!main) {
- internal_resources.write[i].cache = res;
+ internal_index_cache[path] = res;
}
int pc = f->get_32();
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 0f8fc9445b..3c8d916c0a 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -68,10 +68,10 @@ class ResourceLoaderBinary {
struct IntResource {
String path;
uint64_t offset;
- RES cache;
};
Vector<IntResource> internal_resources;
+ Map<String, RES> internal_index_cache;
String get_unicode_string();
void _advance_padding(uint32_t p_len);
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index 643df53f8c..9e22bdced7 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -91,7 +91,7 @@ Error ResourceFormatImporter::_get_path_and_type(const String &p_path, PathAndTy
r_path_and_type.path = value;
path_found = true; //first match must have priority
} else if (assign == "type") {
- r_path_and_type.type = value;
+ r_path_and_type.type = ClassDB::get_compatibility_remapped_class(value);
} else if (assign == "importer") {
r_path_and_type.importer = value;
} else if (assign == "group_file") {