persist layer visibility selections
This commit is contained in:
parent
5b4d89171d
commit
7a6cfd266c
5 changed files with 50 additions and 1 deletions
|
|
@ -633,6 +633,7 @@
|
||||||
view: null,
|
view: null,
|
||||||
dark: false,
|
dark: false,
|
||||||
decals: true,
|
decals: true,
|
||||||
|
danger: false,
|
||||||
zoomSpeed: 1.0,
|
zoomSpeed: 1.0,
|
||||||
lineType: "path",
|
lineType: "path",
|
||||||
autoSave: true,
|
autoSave: true,
|
||||||
|
|
@ -651,6 +652,8 @@
|
||||||
detail: "good",
|
detail: "good",
|
||||||
animesh: "200"
|
animesh: "200"
|
||||||
},
|
},
|
||||||
|
// label state preferences
|
||||||
|
labels: {},
|
||||||
// for passing temporary slice hints (topo currently)
|
// for passing temporary slice hints (topo currently)
|
||||||
synth: {},
|
synth: {},
|
||||||
// widget extra info for slicing (extruder mapping)
|
// widget extra info for slicing (extruder mapping)
|
||||||
|
|
|
||||||
|
|
@ -1991,6 +1991,19 @@
|
||||||
UI.sliderHold.style.marginRight = `${hival}px`;
|
UI.sliderHold.style.marginRight = `${hival}px`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// store layer preferences
|
||||||
|
API.event.on('stack.show', label => {
|
||||||
|
let mode = API.mode.get();
|
||||||
|
let view = API.view.get();
|
||||||
|
API.conf.get().labels[`${mode}-${view}-${label}`] = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
API.event.on('stack.hide', label => {
|
||||||
|
let mode = API.mode.get();
|
||||||
|
let view = API.view.get();
|
||||||
|
API.conf.get().labels[`${mode}-${view}-${label}`] = false;
|
||||||
|
});
|
||||||
|
|
||||||
// bind language choices
|
// bind language choices
|
||||||
$('lset-en').onclick = function() {
|
$('lset-en').onclick = function() {
|
||||||
SDB.setItem('kiri-lang', 'en-us');
|
SDB.setItem('kiri-lang', 'en-us');
|
||||||
|
|
|
||||||
|
|
@ -935,6 +935,12 @@
|
||||||
});
|
});
|
||||||
updateSliderMax(true);
|
updateSliderMax(true);
|
||||||
setVisibleLayer(-1, 0);
|
setVisibleLayer(-1, 0);
|
||||||
|
if (scale === 1) {
|
||||||
|
for (let label of STACKS.getLabels()) {
|
||||||
|
let check = `${mode}-${viewMode}-${label}`;
|
||||||
|
STACKS.setVisible(label, settings.labels[check] !== false);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (scale === 1) {
|
if (scale === 1) {
|
||||||
API.show.progress(0);
|
API.show.progress(0);
|
||||||
|
|
@ -1071,6 +1077,12 @@
|
||||||
setVisibleLayer(-1, 0);
|
setVisibleLayer(-1, 0);
|
||||||
updateSpeeds(maxSpeed);
|
updateSpeeds(maxSpeed);
|
||||||
|
|
||||||
|
// maatch label checkboxes to preference
|
||||||
|
for (let label of STACKS.getLabels()) {
|
||||||
|
let check = `${settings.mode}-${viewMode}-${label}`;
|
||||||
|
STACKS.setVisible(label, settings.labels[check] !== false);
|
||||||
|
}
|
||||||
|
|
||||||
// mark preview complete for export
|
// mark preview complete for export
|
||||||
complete.preview = true;
|
complete.preview = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,20 @@
|
||||||
return stacks[name];
|
return stacks[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLabels() {
|
||||||
|
return Object.keys(DYN);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setVisible(label, bool) {
|
||||||
|
let ctrl = DYN[label];
|
||||||
|
if (ctrl) {
|
||||||
|
ctrl.toggle.checked = bool;
|
||||||
|
ctrl.group.forEach(mat => {
|
||||||
|
mat.visible = bool;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function create(name, view) {
|
function create(name, view) {
|
||||||
if (stacks[name]) {
|
if (stacks[name]) {
|
||||||
return stacks[name];
|
return stacks[name];
|
||||||
|
|
@ -70,6 +84,11 @@
|
||||||
ctrl.group.forEach(mat => {
|
ctrl.group.forEach(mat => {
|
||||||
mat.visible = ctrl.toggle.checked;
|
mat.visible = ctrl.toggle.checked;
|
||||||
});
|
});
|
||||||
|
if (ctrl.toggle.checked) {
|
||||||
|
KIRI.api.event.emit("stack.show", label);
|
||||||
|
} else {
|
||||||
|
KIRI.api.event.emit("stack.hide", label)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
let color = lmap[label].color.check;
|
let color = lmap[label].color.check;
|
||||||
|
|
@ -128,6 +147,8 @@
|
||||||
getStack,
|
getStack,
|
||||||
getRange,
|
getRange,
|
||||||
setRange,
|
setRange,
|
||||||
|
getLabels,
|
||||||
|
setVisible,
|
||||||
setFreeMem
|
setFreeMem
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
retSpeed = process.outputRetractSpeed * 60,
|
retSpeed = process.outputRetractSpeed * 60,
|
||||||
retDwell = process.outputRetractDwell || 0,
|
retDwell = process.outputRetractDwell || 0,
|
||||||
timeDwell = retDwell / 1000,
|
timeDwell = retDwell / 1000,
|
||||||
arcDist = isBelt || isDanger ? 0 : (process.arcTolerance || 0),
|
arcDist = isBelt || !isDanger ? 0 : (process.arcTolerance || 0),
|
||||||
originCenter = process.outputOriginCenter,
|
originCenter = process.outputOriginCenter,
|
||||||
offset = originCenter ? null : {
|
offset = originCenter ? null : {
|
||||||
x: device.bedWidth/2,
|
x: device.bedWidth/2,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue