add developer preference

This commit is contained in:
Stewart Allen 2021-04-22 11:13:43 -04:00
commit f65e1d4e9c
4 changed files with 39 additions and 33 deletions

View file

@ -665,7 +665,8 @@
detail: "good", detail: "good",
animesh: "200", animesh: "200",
healMesh: false, healMesh: false,
ortho: false ortho: false,
devel: false
}, },
// label state preferences // label state preferences
labels: { labels: {

View file

@ -158,6 +158,7 @@
control.decimate = UI.decimate.checked; control.decimate = UI.decimate.checked;
control.healMesh = UI.healMesh.checked; control.healMesh = UI.healMesh.checked;
control.ortho = UI.ortho.checked; control.ortho = UI.ortho.checked;
control.devel = UI.devel.checked;
SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed); SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed);
// platform.layout(); // platform.layout();
API.conf.save(); API.conf.save();
@ -1609,13 +1610,14 @@
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}), reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l}),
ortho: UC.newBoolean(LANG.op_orth_s, booleanSave, {title:LANG.op_orth_l}), ortho: UC.newBoolean(LANG.op_orth_s, booleanSave, {title:LANG.op_orth_l}),
dark: UC.newBoolean(LANG.op_dark_s, booleanSave, {title:LANG.op_dark_l}), dark: UC.newBoolean(LANG.op_dark_s, booleanSave, {title:LANG.op_dark_l}),
decals: UC.newBoolean(LANG.op_decl_s, booleanSave, {title:LANG.op_decl_s}), devel: UC.newBoolean(LANG.op_devl_s, booleanSave, {title:LANG.op_devl_l}),
danger: UC.newBoolean(LANG.op_dang_s, booleanSave, {title:LANG.op_dang_l}), danger: UC.newBoolean(LANG.op_dang_s, booleanSave, {title:LANG.op_dang_l}),
lprefs: UC.newGroup(LANG.op_disp, $('prefs-gen2'), {inline: true}), lprefs: UC.newGroup(LANG.op_disp, $('prefs-gen2'), {inline: true}),
showOrigin: UC.newBoolean(LANG.op_shor_s, booleanSave, {title:LANG.op_shor_l}), showOrigin: UC.newBoolean(LANG.op_shor_s, booleanSave, {title:LANG.op_shor_l}),
showRulers: UC.newBoolean(LANG.op_shru_s, booleanSave, {title:LANG.op_shru_l}), showRulers: UC.newBoolean(LANG.op_shru_s, booleanSave, {title:LANG.op_shru_l}),
showSpeeds: UC.newBoolean(LANG.op_sped_s, speedSave, {title:LANG.op_sped_l}), showSpeeds: UC.newBoolean(LANG.op_sped_s, speedSave, {title:LANG.op_sped_l}),
decals: UC.newBoolean(LANG.op_decl_s, booleanSave, {title:LANG.op_decl_s}),
lineType: UC.newSelect(LANG.op_line_s, {title: LANG.op_line_l, action: lineTypeSave, modes:FDM}, "linetype"), lineType: UC.newSelect(LANG.op_line_s, {title: LANG.op_line_l, action: lineTypeSave, modes:FDM}, "linetype"),
animesh: UC.newSelect(LANG.op_anim_s, {title: LANG.op_anim_l, action: aniMeshSave, modes:CAM}, "animesh"), animesh: UC.newSelect(LANG.op_anim_s, {title: LANG.op_anim_l, action: aniMeshSave, modes:CAM}, "animesh"),
units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, action: unitsSave, modes:CAM, trace:true}, "units"), units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, action: unitsSave, modes:CAM, trace:true}, "units"),
@ -2411,6 +2413,7 @@
UI.decimate.checked = control.decimate; UI.decimate.checked = control.decimate;
UI.healMesh.checked = control.healMesh; UI.healMesh.checked = control.healMesh;
UI.ortho.checked = control.ortho; UI.ortho.checked = control.ortho;
UI.devel.checked = control.devel;
lineTypeSave(); lineTypeSave();
detailSave(); detailSave();
updateFPS(); updateFPS();

View file

@ -27,7 +27,7 @@
PROTO = Object.clone(COLOR), PROTO = Object.clone(COLOR),
bwcomp = (1 / Math.cos(Math.PI/4)), bwcomp = (1 / Math.cos(Math.PI/4)),
getRangeParameters = FDM.getRangeParameters, getRangeParameters = FDM.getRangeParameters,
debug = false; debug = true;
let isThin = false; // force line rendering let isThin = false; // force line rendering
let isFlat = false; // force flat rendering let isFlat = false; // force flat rendering
@ -449,7 +449,7 @@
if (render) { if (render) {
forSlices(0.9, 1.0, slice => { forSlices(0.9, 1.0, slice => {
let params = getRangeParameters(settings, slice.index); let params = getRangeParameters(settings, slice.index);
doRender(slice, isSynth, params); doRender(slice, isSynth, params, ctrl.devel);
}, "render"); }, "render");
} }
@ -472,56 +472,56 @@
return Math.max(min,Math.min(max,v)); return Math.max(min,Math.min(max,v));
} }
function doRender(slice, isSynth, params) { function doRender(slice, isSynth, params, devel) {
const output = slice.output(); const output = slice.output();
const height = slice.height / 2; const height = slice.height / 2;
const solidWidth = params.sliceFillWidth || 1; const solidWidth = params.sliceFillWidth || 1;
slice.tops.forEach(top => { slice.tops.forEach(top => {
if (isThin) output if (isThin) output
.setLayer('slice', { line: 0x000066, check: 0x000066 }) .setLayer('part', { line: 0x333333, check: 0x333333 })
.addPolys(top.poly); .addPolys(top.poly);
if (top.shells) output output
.setLayer("shells", isSynth ? COLOR.support : COLOR.shell) .setLayer("shells", isSynth ? COLOR.support : COLOR.shell)
.addPolys(top.shells, vopt({ offset, height, clean: true })); .addPolys(top.shells || [], vopt({ offset, height, clean: true }));
output
.setLayer("solid fill", isSynth ? COLOR.support : COLOR.fill)
.addLines(top.fill_lines || [], vopt({ offset: offset * solidWidth, height }));
output
.setLayer("sparse fill", COLOR.infill)
.addPolys(top.fill_sparse || [], vopt({ offset, height, outline: true }))
if (top.thin_fill) output
.setLayer("thin fill", COLOR.fill)
.addLines(top.thin_fill, vopt({ offset, height }));
if (top.gaps) output if (top.gaps) output
.setLayer("gaps", COLOR.gaps) .setLayer("gaps", COLOR.gaps)
.addPolys(top.gaps, vopt({ offset, height, thin: true })); .addPolys(top.gaps, vopt({ offset, height, thin: true }));
if (isThin && debug) { if (isThin && devel) {
slice.output() slice.output()
.setLayer('offset', { face: 0, line: 0x888888 }) .setLayer('fill inset', { face: 0, line: 0xaaaaaa, check: 0xaaaaaa })
.addPolys(top.fill_off) .addPolys(top.fill_off);
.setLayer('last', { face: 0, line: 0x008888 }) // .setLayer('last', { face: 0, line: 0x008888, check: 0x008888 })
.addPolys(top.last); // .addPolys(top.last);
} }
if (top.fill_lines && top.fill_lines.length) output
.setLayer("fill", isSynth ? COLOR.support : COLOR.fill)
.addLines(top.fill_lines, vopt({ offset: offset * solidWidth, height }));
if (top.fill_sparse) output
.setLayer("infill", COLOR.infill)
.addPolys(top.fill_sparse, vopt({ offset, height, outline: true }))
if (top.thin_fill) output
.setLayer("fill", COLOR.fill)
.addLines(top.thin_fill, vopt({ offset, height }));
}); });
if (isThin && debug) { if (isThin && devel) {
if (slice.solids) output if (slice.solids && slice.solids.length) output
.setLayer("solids", { face: 0x00dd00 }) .setLayer("solids", { face: 0xbbbb00, check: 0xbbbb00 })
.addAreas(slice.solids); .addAreas(slice.solids);
if (slice.bridges) output if (slice.bridges && slice.bridges.length) output
.setLayer("bridges", { face: 0x00aaaa, line: 0x00aaaa }) .setLayer("bridges", { face: 0x00cccc, line: 0x00cccc, check: 0x00cccc })
.addAreas(slice.bridges); .addAreas(slice.bridges);
if (slice.flats) output if (slice.flats && slice.flats.length) output
.setLayer("flats", { face: 0xaa00aa, line: 0xaa00aa }) .setLayer("flats", { face: 0xaa00aa, line: 0xaa00aa, check: 0xaa00aa })
.addAreas(slice.flats); .addAreas(slice.flats);
} }

View file

@ -192,10 +192,12 @@ kiri.lang['en-us'] = {
op_disp: "display", op_disp: "display",
op_xprt_s: "expert", op_xprt_s: "expert",
op_xprt_l: "show more settings options", op_xprt_l: "show more settings options",
op_decl_s: "decals", op_decl_s: "show decals",
op_decl_l: "show device decals and logos", op_decl_l: "show device decals and logos",
op_dang_s: "experimental", op_dang_s: "experimental",
op_dang_l: "show experimental parameters", op_dang_l: "show experimental parameters",
op_devl_s: "developer",
op_devl_l: "show developer options",
op_hopo_s: "hover pop", op_hopo_s: "hover pop",
op_hopo_l: ["enable menu hover","to activate"], op_hopo_l: ["enable menu hover","to activate"],
op_dark_s: "dark mode", op_dark_s: "dark mode",