summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-21 20:51:41 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-21 20:51:41 -0300
commit3edf66477a49696ae82074b4675aff818dda68fe (patch)
treeba1bad6d0e9b22648ce574a2380d051e243537be
parentd57b09e47bb229b164ac34a408207882635b541b (diff)
Fixed error using the same atlas rect for all images, closes #4139
-rw-r--r--core/script_language.h4
-rw-r--r--tools/editor/editor_import_export.cpp2
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp13
3 files changed, 17 insertions, 2 deletions
diff --git a/core/script_language.h b/core/script_language.h
index ceaa862463..bde4d619ab 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -129,6 +129,10 @@ public:
virtual void notification(int p_notification)=0;
+ //this is used by script languages that keep a reference counter of their own
+ //you can make make Ref<> not die when it reaches zero, so deleting the reference
+ //depends entirely from the script
+
virtual void refcount_incremented() {}
virtual bool refcount_decremented() { return true; } //return true if it can die
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index f9b9c0b41c..357d139c04 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -861,9 +861,11 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
//imd->set_editor();
+
for (List<StringName>::Element *F=atlas_images.front();F;F=F->next()) {
imd->add_source(EditorImportPlugin::validate_source_path(F->get()),FileAccess::get_md5(F->get()));
+
}
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 1fa7a50515..16ea803da4 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -1312,21 +1312,30 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
ERR_CONTINUE( !source_map.has(i) );
for (List<int>::Element *E=source_map[i].front();E;E=E->next()) {
- String apath = p_path.get_base_dir().plus_file(from->get_source_path(E->get()).get_file().basename()+".atex");
+ String apath;
+ String spath = from->get_source_path(E->get()).get_file();
+
+ if (p_external) {
+ apath = p_path.get_base_dir().plus_file(spath.basename()+"."+from->get_source_path(E->get()).md5_text()+".atex");
+ } else {
+ apath = p_path.get_base_dir().plus_file(spath.basename()+".atex");
+ }
Ref<AtlasTexture> at;
if (ResourceCache::has(apath)) {
+
at = Ref<AtlasTexture>( ResourceCache::get(apath)->cast_to<AtlasTexture>() );
} else {
at = Ref<AtlasTexture>( memnew( AtlasTexture ) );
+
}
at->set_region(region);
at->set_margin(margin);
at->set_path(apath);
atlases[E->get()]=at;
- print_line("Atlas Tex: "+apath);
+
}
}
if (ResourceCache::has(p_path)) {