Improve memory cleanup no project close

Rename 16x MC skin resolution to "default"
Show more of JSON file when displaying error
This commit is contained in:
JannisX11 2023-04-07 14:35:41 +02:00
parent fac7c26b33
commit 2d792137e1
3 changed files with 13 additions and 3 deletions

View File

@ -264,7 +264,7 @@ const skin_dialog = new Dialog({
}
},
resolution: {label: 'dialog.create_texture.resolution', type: 'select', value: 16, options: {
16: '16x',
16: 'generic.default',
32: '32x',
64: '64x',
128: '128x',

View File

@ -515,12 +515,12 @@ function autoParseJSON(data, feedback) {
var length = err.toString().split('at position ')[1]
if (length) {
length = parseInt(length)
var start = limitNumber(length-20, 0, Infinity)
var start = limitNumber(length-32, 0, Infinity)
logErrantPart(data, start, 1+length-start)
} else if (err.toString().includes('Unexpected end of JSON input')) {
logErrantPart(data, data.length-10, 10)
logErrantPart(data, data.length-16, 10)
}
Blockbench.showMessageBox({
translateKey: 'invalid_file',

View File

@ -376,6 +376,16 @@ class ModelProject {
this.unselect(true);
Texture.all.forEach(tex => tex.stopWatcher());
// Clear memory
for (let uuid in ProjectData[this.uuid].nodes_3d) {
let node_3d = ProjectData[this.uuid].nodes_3d[uuid];
if (node_3d.parent) node_3d.parent.remove(node_3d);
if (node_3d.geometry) node_3d.geometry.dispose();
if (node_3d.outline && node_3d.outline.geometry) {
node_3d.outline.geometry.dispose();
}
}
let index = ModelProject.all.indexOf(this);
ModelProject.all.remove(this);
delete ProjectData[this.uuid];