bump rev 3.7.D1
This commit is contained in:
parent
99f7d1811b
commit
3dd05536f3
4 changed files with 22 additions and 4 deletions
|
|
@ -104,14 +104,21 @@ function restore_space() {
|
|||
}
|
||||
});
|
||||
mesh.db.space.iterate({ map: true }).then(cached => {
|
||||
const keys = [];
|
||||
const claimed = [];
|
||||
for (let [id, data] of Object.entries(cached)) {
|
||||
keys.push(id);
|
||||
if (count++ === 0) {
|
||||
mesh.api.log.emit(`restoring workspace`);
|
||||
}
|
||||
// restore group
|
||||
if (Array.isArray(data)) {
|
||||
claimed.push(id);
|
||||
let models = data
|
||||
.map(id => { return { id, md: cached[id] } })
|
||||
.map(id => {
|
||||
claimed.push(id);
|
||||
return { id, md: cached[id] }
|
||||
})
|
||||
.filter(r => r.md) // filter cache misses
|
||||
.map(r => new mesh.model(r.md, r.id).applyMatrix(mcache[r.id]));
|
||||
if (models.length) {
|
||||
|
|
@ -123,6 +130,17 @@ function restore_space() {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (let id of claimed) {
|
||||
keys.remove(id);
|
||||
}
|
||||
if (keys.length) {
|
||||
mesh.api.log.emit(`removing ${keys.length} unclaimed meshes`);
|
||||
}
|
||||
// clear out meshes left in the space db along with their matrices
|
||||
for (let id of keys) {
|
||||
mesh.db.space.remove(id);
|
||||
delete mcache[id];
|
||||
}
|
||||
// restore global cache only after objects are restored
|
||||
// otherwise their setup will corrupt the cache for other restores
|
||||
matrixCache = mcache;
|
||||
|
|
|
|||
Loading…
Reference in a new issue