allow default layer off. disable moves layers default

This commit is contained in:
Stewart Allen 2020-11-09 09:08:13 -05:00
commit 024be442bd
4 changed files with 13 additions and 5 deletions

View file

@ -115,7 +115,8 @@
faces: codec.allocFloat32Array(layer.faces),
color: layer.color,
paths: layer.paths,
cpath: layer.cpath
cpath: layer.cpath,
off: layer.off
} })
};
return enc;
@ -130,7 +131,8 @@
faces: v.data[i].faces,
color: v.data[i].color,
paths: v.data[i].paths,
cpath: v.data[i].cpath
cpath: v.data[i].cpath,
off: v.data[i].off
};
}
return render;

View file

@ -18,7 +18,7 @@
};
}
setLayer(layer, colors) {
setLayer(layer, colors, off) {
let layers = this.layers;
if (typeof(colors) === 'number') {
colors = {
@ -28,6 +28,7 @@
};
}
this.current = layers[layer] = layers[layer] || {
off: off === true,
lines: [],
polys: [],
faces: [],

View file

@ -105,8 +105,10 @@
})
};
}
const defstate = !data.off;
const ctrl = DYN[label];
ctrl.toggle.checked = true;
ctrl.toggle.checked = defstate;
const { polys, lines, faces, paths, cpath } = data;
if (polys.length || lines.length) {
@ -127,6 +129,7 @@
group.add(new THREE.LineSegments(geo, mat));
}
ctrl.group.push(mat);
mat.visible = defstate;
}
if (faces.length) {
const mat = newMat(data);
@ -139,6 +142,7 @@
mesh.receiveShadow = true;
group.add(mesh);
ctrl.group.push(mat);
mat.visible = defstate;
}
if (paths.length) {
let mat = [];
@ -147,6 +151,7 @@
} else {
mat.push(newMat(data));
}
mat.forEach(m => m.visible = defstate);
// const mat = newMat(data);
paths.forEach((path, i) => {
const { index, faces, z, colors } = path;

View file

@ -455,7 +455,7 @@
}
output
.setLayer('move', moveColor)
.setLayer('move', moveColor, true)
.addPolys(moves, { thin: true, z: opts.z });
Object.values(prints).forEach(array => {
array.forEach(poly => {