Fix model memory data not loading correctly

This commit is contained in:
JannisX11 2023-01-05 23:05:37 +01:00
parent 3a836a17e1
commit c7b8f7714f
3 changed files with 31 additions and 7 deletions

View File

@ -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)

View File

@ -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 = {}

View File

@ -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;