remove non-func unrotate() and fold rotinfo back into belt
This commit is contained in:
parent
bfd8e9d322
commit
4bc113096b
7 changed files with 43 additions and 76 deletions
|
|
@ -249,7 +249,6 @@ FDM.prepare = async function(widgets, settings, update) {
|
|||
let swidget = kiri.newWidget(null,widget.group);
|
||||
swidget.slices = sslices;
|
||||
swidget.support = true;
|
||||
swidget.rotinfo = widget.rotinfo;
|
||||
swidget.belt = widget.belt;
|
||||
swidget.track = Object.clone(widget.track);
|
||||
swidget.mesh = { widget: swidget, position: swidget.track.pos };
|
||||
|
|
@ -440,12 +439,12 @@ FDM.prepare = async function(widgets, settings, update) {
|
|||
|
||||
// establish offsets
|
||||
for (let widget of widgets) {
|
||||
let { rotinfo, belt } = widget;
|
||||
let { belt } = widget;
|
||||
let offset = Object.clone(widget.track.pos);
|
||||
if (isBelt) {
|
||||
let o = rotinfo.ypos * beltfact;
|
||||
let o = belt.ypos * beltfact;
|
||||
offset = {
|
||||
x: rotinfo.xpos,
|
||||
x: belt.xpos,
|
||||
y: o,
|
||||
z: o
|
||||
};
|
||||
|
|
|
|||
|
|
@ -346,10 +346,8 @@ kiri.worker = {
|
|||
let x = vert[i++];
|
||||
let y = vert[i++];
|
||||
let z = vert[i++];
|
||||
// if (z < 0.01) {
|
||||
miny = Math.min(miny, y);
|
||||
maxy = Math.max(maxy, y);
|
||||
// }
|
||||
miny = Math.min(miny, y);
|
||||
maxy = Math.max(maxy, y);
|
||||
}
|
||||
return { miny, maxy };
|
||||
}
|
||||
|
|
@ -377,7 +375,14 @@ kiri.worker = {
|
|||
}
|
||||
widget.rotateRaw(rotation,0,0,true);
|
||||
let minr = gmin(group);
|
||||
widget.belt = { xpos, ypos, yadd: minr.maxy - minr.miny, dy: -miny, dz: 0 };
|
||||
widget.belt = {
|
||||
angle: 45,
|
||||
xpos,
|
||||
ypos,
|
||||
yadd: minr.maxy - minr.miny,
|
||||
dy: -miny - (proc.beltAnchor || proc.firstLayerBeltLead || 0),
|
||||
dz: 0
|
||||
};
|
||||
for (let others of group.slice(1)) {
|
||||
others.belt = widget.belt;
|
||||
}
|
||||
|
|
@ -387,28 +392,6 @@ kiri.worker = {
|
|||
send.done({});
|
||||
},
|
||||
|
||||
unrotate(data, send) {
|
||||
let { settings } = data;
|
||||
if (!settings.device.bedBelt) {
|
||||
return send.done({});
|
||||
}
|
||||
let rotation = (Math.PI / 180) * 45;
|
||||
for (let group of Object.values(wgroup)) {
|
||||
let widget = group[0];
|
||||
let { xpos, ypos } = widget.belt;
|
||||
let { dy, dz } = widget.belt;
|
||||
let proc = settings.process;
|
||||
// move to accomodate anchor
|
||||
dy -= (proc.beltAnchor || proc.firstLayerBeltLead || 0) ;
|
||||
widget.rotinfo = { angle: 45, dy, dz, xpos, ypos };
|
||||
for (let others of group.slice(1)) {
|
||||
others.rotinfo = widget.rotinfo;
|
||||
}
|
||||
send.data({group: group.id, rotinfo: widget.rotinfo});
|
||||
}
|
||||
send.done({});
|
||||
},
|
||||
|
||||
slice(data, send) {
|
||||
send.data({update:0.001, updateStatus:"slicing"});
|
||||
|
||||
|
|
|
|||
|
|
@ -199,18 +199,6 @@ const client = exports({
|
|||
});
|
||||
},
|
||||
|
||||
unrotate(settings, callback) {
|
||||
send("unrotate", { settings }, reply => {
|
||||
if (reply.group) {
|
||||
for (let widget of kiri.Widget.Groups.forid(reply.group)) {
|
||||
widget.rotinfo = reply.rotinfo;
|
||||
}
|
||||
} else if (callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
slice(settings, widget, callback) {
|
||||
send("slice", {
|
||||
id: widget.id,
|
||||
|
|
|
|||
|
|
@ -163,7 +163,8 @@ function encodePointArray(points, state, z) {
|
|||
return points;
|
||||
}
|
||||
|
||||
const array = codec.allocFloat32Array(length * 3, state.zeros);
|
||||
const zeros = state ? state.zeros : undefined;
|
||||
const array = codec.allocFloat32Array(length * 3, zeros);
|
||||
|
||||
for (let i=0, pos=0, point; i<length; i++) {
|
||||
point = points[i];
|
||||
|
|
@ -186,7 +187,8 @@ function encodePointArray2D(points, state) {
|
|||
return points;
|
||||
}
|
||||
|
||||
const array = codec.allocFloat32Array(length * 2, state.zeros);
|
||||
const zeros = state ? state.zeros : undefined;
|
||||
const array = codec.allocFloat32Array(length * 2, zeros);
|
||||
|
||||
for (let i=0, pos=0, point; i<length; i++) {
|
||||
point = points[i];
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ function prepareSlices(callback, scale = 1, offset = 0) {
|
|||
lastMsg;
|
||||
|
||||
for (let widget of toSlice) {
|
||||
widget.belt = null;
|
||||
widget.stats.progress = 0;
|
||||
widget.setColor(COLOR.slicing);
|
||||
let { extruder } = widget.anno;
|
||||
|
|
@ -135,7 +136,6 @@ function prepareSlices(callback, scale = 1, offset = 0) {
|
|||
widget.stack.obj.view.position.z = widget.track.zcut || 0;
|
||||
|
||||
widget.slice(settings, (sliced, error) => {
|
||||
widget.rotinfo = null;
|
||||
let mark = Date.now();
|
||||
// update UI info
|
||||
if (sliced) {
|
||||
|
|
@ -190,31 +190,29 @@ function prepareSlices(callback, scale = 1, offset = 0) {
|
|||
if (scale === 1 && feature.work_alerts && slicing.length) {
|
||||
alert = show.alert("Rendering");
|
||||
};
|
||||
client.unrotate(settings, () => {
|
||||
for (let widget of slicing) {
|
||||
// on done
|
||||
segtimes[`${widget.id}_${segNumber++}_draw`] = widget.render(widget.stack);
|
||||
// rotate stack for belt beds
|
||||
if (widget.rotinfo) {
|
||||
widget.stack.obj.rotate(widget.rotinfo);
|
||||
}
|
||||
if (scale === 1) {
|
||||
// clear wireframe
|
||||
widget.setWireframe(false, COLOR.wireframe, COLOR.wireframe_opacity);
|
||||
widget.setOpacity(camOrLaser ? COLOR.cam_sliced_opacity : COLOR.sliced_opacity);
|
||||
widget.setColor(COLOR.deselected);
|
||||
api.hide.alert(alert);
|
||||
}
|
||||
for (let widget of slicing) {
|
||||
// on done
|
||||
segtimes[`${widget.id}_${segNumber++}_draw`] = widget.render(widget.stack);
|
||||
// rotate stack for belt beds
|
||||
if (widget.belt) {
|
||||
widget.stack.obj.rotate(widget.belt);
|
||||
}
|
||||
view.update_slider_max(true);
|
||||
show.layer(-1, 0);
|
||||
if (scale === 1) {
|
||||
view.update_stack_labels();
|
||||
// clear wireframe
|
||||
widget.setWireframe(false, COLOR.wireframe, COLOR.wireframe_opacity);
|
||||
widget.setOpacity(camOrLaser ? COLOR.cam_sliced_opacity : COLOR.sliced_opacity);
|
||||
widget.setColor(COLOR.deselected);
|
||||
api.hide.alert(alert);
|
||||
}
|
||||
if (!isBelt && controller.lineType === 'line' && !process.xray && !controller.devel) {
|
||||
$('render-ghost').onclick();
|
||||
}
|
||||
});
|
||||
}
|
||||
view.update_slider_max(true);
|
||||
show.layer(-1, 0);
|
||||
if (scale === 1) {
|
||||
view.update_stack_labels();
|
||||
}
|
||||
if (!isBelt && controller.lineType === 'line' && !process.xray && !controller.devel) {
|
||||
$('render-ghost').onclick();
|
||||
}
|
||||
if (scale === 1) {
|
||||
show.progress(0);
|
||||
}
|
||||
|
|
@ -334,11 +332,11 @@ function preparePreview(callback, scale = 1, offset = 0) {
|
|||
stack.add(layer);
|
||||
});
|
||||
// rotate stack for belt beds
|
||||
if (isBelt && widgets[0].rotinfo) {
|
||||
let ri = widgets[0].rotinfo;
|
||||
if (isBelt && widgets[0].belt) {
|
||||
let ri = widgets[0].belt;
|
||||
ri.dz = 0;
|
||||
ri.dy = settings.device.bedDepth / 2;
|
||||
stack.obj.rotate(widgets[0].rotinfo);
|
||||
stack.obj.rotate(widgets[0].belt);
|
||||
}
|
||||
api.hide.alert(alert);
|
||||
segtimes[`${segNumber}_draw`] = Date.now() - startTime;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class Stack {
|
|||
|
||||
rotate(set) {
|
||||
this.view.rotation.x = -set.angle * (Math.PI/180);
|
||||
this.view.position.y += -set.dy;
|
||||
this.view.position.z += -set.dz;
|
||||
this.view.position.y = -set.dy;
|
||||
this.view.position.z = -set.dz;
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
|
|
|||
|
|
@ -772,9 +772,6 @@ class Widget {
|
|||
if (reply.slice) {
|
||||
widget.slices.push(kiri.codec.decode(reply.slice, {mesh:widget.mesh}));
|
||||
}
|
||||
if (reply.rotinfo) {
|
||||
widget.rotinfo = reply.rotinfo;
|
||||
}
|
||||
if (reply.done) {
|
||||
ondone(true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue