diff --git a/js/io/codec.js b/js/io/codec.js index c9ba9aab..1628cf8c 100644 --- a/js/io/codec.js +++ b/js/io/codec.js @@ -31,21 +31,25 @@ class Codec { } if (file.path && isApp && this.remember && !file.no_file ) { var name = pathToName(file.path, true); - let project = Project; Project.name = pathToName(name, false); Project.export_path = file.path; + } + + this.parse(model, file.path) + + if (file.path && isApp && this.remember && !file.no_file ) { + loadDataFromModelMemory(); addRecentProject({ name, path: file.path, icon: Format.icon }) + let project = Project; setTimeout(() => { if (Project == project) updateRecentProjectThumbnail(); }, 200) } - this.parse(model, file.path) - if (isApp) loadDataFromModelMemory(); } //parse(model, path) diff --git a/js/io/formats/bedrock.js b/js/io/formats/bedrock.js index da12631f..a486a514 100644 --- a/js/io/formats/bedrock.js +++ b/js/io/formats/bedrock.js @@ -1030,21 +1030,33 @@ var codec = new Codec('bedrock', { } if (file.path && isApp && this.remember && !file.no_file ) { var name = pathToName(file.path, true); - let project = Project; Project.name = pathToName(name, false); Project.export_path = file.path; + } + + this.parse(model, file.path) + + if (file.path && isApp && this.remember && !file.no_file ) { + if (isApp) { + let no_textures_before = Texture.all.length == 0; + loadDataFromModelMemory(); + if (!Format.single_texture && no_textures_before && Texture.all.length) { + Cube.all.forEach(cube => { + cube.applyTexture(Texture.all[0]); + }) + } + } addRecentProject({ name, path: file.path, icon: Format.icon }); + let project = Project; setTimeout(() => { if (Project == project) setTimeout(() => updateRecentProjectThumbnail(), 40); }, 200) } - this.parse(model, file.path) - if (isApp) loadDataFromModelMemory(); }, compile(options) { if (options === undefined) options = {} diff --git a/js/io/formats/image.js b/js/io/formats/image.js index 13b52bc4..c73406c4 100644 --- a/js/io/formats/image.js +++ b/js/io/formats/image.js @@ -62,7 +62,15 @@ let codec = new Codec('image', { } } - if (isApp) loadDataFromModelMemory(); + if (path && isApp && !files[0].no_file ) { + loadDataFromModelMemory(); + + addRecentProject({ + name, + path: path, + icon: Format.icon + }); + } }, afterSave() { if (!isApp || !Texture.all.length) return;