add widget render control ui. fix up cam prepare with new render engine
This commit is contained in:
parent
9493206d29
commit
b9b78cc1ae
12 changed files with 127 additions and 292 deletions
|
|
@ -2057,6 +2057,11 @@
|
|||
$('rot_y_gt').onclick = () => { API.selection.rotate(0, d,0) };
|
||||
$('rot_z_lt').onclick = () => { API.selection.rotate(0,0, d) };
|
||||
$('rot_z_gt').onclick = () => { API.selection.rotate(0,0,-d) };
|
||||
// rendering options
|
||||
$('render-hide').onclick = () => { API.view.wireframe(false, 0, 0); };
|
||||
$('render-ghost').onclick = () => { API.view.wireframe(false, 0, 0.5); };
|
||||
$('render-wire').onclick = () => { API.view.wireframe(true, 0, 0.5); };
|
||||
$('render-solid').onclick = () => { API.view.wireframe(false, 0, 1); };
|
||||
|
||||
UI.modal.onclick = API.modal.hide;
|
||||
UI.modalBox.onclick = (ev) => { ev.stopPropagation() };
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@
|
|||
set: setViewMode,
|
||||
update_slider: updateSlider,
|
||||
update_fields: updateFields,
|
||||
wireframe: toggleWireframe,
|
||||
wireframe: setWireframe,
|
||||
snapshot: null
|
||||
},
|
||||
widgets: {
|
||||
|
|
@ -564,22 +564,18 @@
|
|||
selectedMeshes.slice().forEach(function (mesh) { f(mesh) });
|
||||
}
|
||||
|
||||
function setWireframe(bool, color, opacity) {
|
||||
forAllWidgets(function(w) { w.setWireframe(bool, color, opacity) });
|
||||
SPACE.update();
|
||||
}
|
||||
|
||||
function toggleWireframe(color, opacity) {
|
||||
forAllWidgets(function(w) { w.toggleWireframe(color, opacity) });
|
||||
SPACE.update();
|
||||
}
|
||||
|
||||
function updateSliderMax(set) {
|
||||
let max = 0;
|
||||
if (viewMode === VIEWS.PREVIEW && currentPrint) {
|
||||
max = currentPrint.getLayerCount();
|
||||
} else {
|
||||
forAllWidgets(function(widget) {
|
||||
if (!widget.slices) return;
|
||||
max = Math.max(max, widget.slices.length);
|
||||
});
|
||||
}
|
||||
max = Math.max(0, max - 1);
|
||||
let max = STACKS.getRange().tallest - 1;
|
||||
API.var.layer_max = UI.sliderMax.innerText = max;
|
||||
if (set || max < API.var.layer_hi) {
|
||||
API.var.layer_hi = API.var.layer_max;
|
||||
|
|
@ -795,8 +791,6 @@
|
|||
|
||||
let firstMesh = true,
|
||||
countdown = WIDGETS.length,
|
||||
preserveMax = API.var.layer_max,
|
||||
preserveLayer = API.var.layer_hi,
|
||||
totalProgress,
|
||||
track = {},
|
||||
mode = settings.mode,
|
||||
|
|
@ -829,14 +823,11 @@
|
|||
if (lastMsg) segtimes[`${segNumber++}_${lastMsg}`] = mark - startTime;
|
||||
segtimes.total = UTIL.time() - now;
|
||||
API.event.emit('slice', getMode());
|
||||
updateSliderMax(true);
|
||||
if (preserveMax != API.var.layer_max) {
|
||||
preserveLayer = API.var.layer_max;
|
||||
}
|
||||
firstMesh = false;
|
||||
}
|
||||
// on done
|
||||
segtimes[`${segNumber}_draw`] = widget.render(stack);
|
||||
updateSliderMax(true);
|
||||
// clear wireframe
|
||||
widget.setWireframe(false, color.wireframe, color.wireframe_opacity);
|
||||
widget.setOpacity(camOrLaser ? color.cam_sliced_opacity : color.sliced_opacity);
|
||||
|
|
@ -844,7 +835,6 @@
|
|||
// on the last exit, update ui and call the callback
|
||||
if (--countdown === 0 || error || errored) {
|
||||
API.show.progress(0);
|
||||
showSlices(preserveLayer);
|
||||
SPACE.scene.active();
|
||||
API.event.emit('slice.end', getMode());
|
||||
// print stats
|
||||
|
|
|
|||
|
|
@ -648,6 +648,8 @@
|
|||
}
|
||||
if (set) {
|
||||
widget.wire = base.render.wireframe(mesh, this.getPoints(), color);
|
||||
}
|
||||
if (opacity !== undefined) {
|
||||
widget.setOpacity(opacity);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue