allow modules control over seed objects and controls visibility

This commit is contained in:
Stewart Allen 2020-03-28 16:06:22 -04:00
commit fd2b369849
2 changed files with 10 additions and 8 deletions

View file

@ -58,7 +58,7 @@ var gs_kiri_init = exports;
// skip sample object load in onshape (or any script postload)
if (!SDB[SEED]) {
SDB[SEED] = new Date().getTime();
if (!SETUP.s) {
if (!SETUP.s && API.feature.seed) {
platform.load_stl("/obj/cube.stl", function(vert) {
CATALOG.putFile("sample cube.stl", vert);
platform.compute_max_z();
@ -1679,7 +1679,7 @@ var gs_kiri_init = exports;
API.view.set(VIEWS.ARRANGE);
// add ability to override
API.show.controls(true);
API.show.controls(API.feature.controls);
// set initial layer slider size
API.dialog.update();

View file

@ -73,6 +73,11 @@ self.kiri.copyright = exports.COPYRIGHT;
// add show() to catalog for API
CATALOG.show = showCatalog;
const feature = {
seed: true,
controls: true
};
const selection = {
opacity: setOpacity,
move: moveSelection,
@ -106,6 +111,7 @@ self.kiri.copyright = exports.COPYRIGHT;
const color = {
wireframe: 0x444444,
wireframe_opacity: 0.25,
selected: 0xbbff00,
deselected: 0xffff00,
slicing: 0xffaaaa,
@ -118,10 +124,6 @@ self.kiri.copyright = exports.COPYRIGHT;
cam_sliced_opacity: 0.25
};
const opacity = {
wireframe: 0.25
};
const API = KIRI.api = {
ui: UI,
uc: UC,
@ -174,6 +176,7 @@ self.kiri.copyright = exports.COPYRIGHT;
alerts: updateAlerts,
settings: triggerSettingsEvent
},
feature,
function: {
slice: prepareSlices,
print: preparePrint,
@ -196,7 +199,6 @@ self.kiri.copyright = exports.COPYRIGHT;
set: setMode,
switch: switchMode
},
opacity,
print: {
get: function() { return currentPrint },
clear: clearPrint
@ -736,7 +738,7 @@ self.kiri.copyright = exports.COPYRIGHT;
// on done
widget.render(renderMode, MODE === MODES.CAM);
// clear wireframe
widget.setWireframe(false, color.wireframe, opacity.wireframe);
widget.setWireframe(false, color.wireframe, color.wireframe_opacity);
widget.setOpacity(settings.mode === 'CAM' ? color.cam_sliced_opacity : color.sliced_opacity);
widget.setColor(color.deselected);
// update UI info