allow infill cloning to work with threading

This commit is contained in:
Stewart Allen 2021-07-10 22:09:44 -04:00
commit 87642e8cf3
3 changed files with 16 additions and 28 deletions

View file

@ -479,7 +479,7 @@
if (!isSynth && !vaseMode) {
// sparse layers only present when non-vase mose and sparse % > 0
let lastType;
let promises = false && isConcurrent ? [] : undefined;
let promises = isConcurrent ? [] : undefined;
forSlices(0.5, promises ? 0.55 : 0.7, slice => {
let params = slice.params || process;
if (!params.sliceFillSparse) {
@ -496,7 +496,7 @@
bounds: widget.getBoundingBox(),
height: sliceHeight,
type: newType,
cache: params._range !== true && lastType === newType && !isConcurrent,
cache: params._range !== true && lastType === newType,
promises
});
lastType = newType;
@ -506,6 +506,16 @@
trackupdate(i / t, 0.55, 0.7);
});
}
// back-fill slices marked for infill cloning
for (let slice of slices) {
if (slice._clone_sparse) {
let tops = slice.tops;
let down = slice.down.tops;
for (let i=0; i<tops.length; i++) {
tops[i].fill_sparse = down[i].fill_sparse.map(p => p.cloneZ(slice.z));
}
}
}
} else if (isSynth) {
// fill manual supports differently
let promises = isConcurrent ? [] : undefined;
@ -943,20 +953,15 @@
if (skippable && slice.fingerprintSame(down)) {
// the fill fingerprint can slightly different because of solid projections
if (down._fill_finger && POLY.fingerprintCompare(slice._fill_finger, down._fill_finger)) {
// console.log({fill_clone: down.index});
for (let i=0; i<tops.length; i++) {
// the layer below may not have infill computed if it's solid
if (down.tops[i].fill_sparse) {
// tops[i].fill_sparse = down.tops[i].fill_sparse.map(p => p.cloneZ(slice.z));
tops[i].fill_sparse = down.tops[i].fill_sparse.map(poly => {
return poly.clone().setZ(slice.z);
});
} else {
if (!down.tops[i].fill_sparse) {
miss = true;
}
}
// if any of the fills as missing from below, re-compute
// mark for infill cloning if nothing is missing
if (!miss) {
slice._clone_sparse = true;
return;
}
}