enable pluggable infill module development
This commit is contained in:
parent
73271daf0a
commit
73fc4dee3d
4 changed files with 20 additions and 1 deletions
|
|
@ -20,6 +20,11 @@ var gs_kiri_fill = exports;
|
||||||
gyroid: fillGyroid,
|
gyroid: fillGyroid,
|
||||||
triangle: fillTriangle,
|
triangle: fillTriangle,
|
||||||
linear: fillLinear
|
linear: fillLinear
|
||||||
|
},
|
||||||
|
CACHE = self.kiri.fill_fixed = {
|
||||||
|
hex: fillHexFull,
|
||||||
|
grid: fillGrid,
|
||||||
|
triangle: fillTriangle
|
||||||
};
|
};
|
||||||
|
|
||||||
function fillHexFull(target) {
|
function fillHexFull(target) {
|
||||||
|
|
|
||||||
|
|
@ -1053,6 +1053,8 @@ var gs_kiri_init = exports;
|
||||||
// MAIN INITIALIZATION FUNCTION
|
// MAIN INITIALIZATION FUNCTION
|
||||||
|
|
||||||
function init_one() {
|
function init_one() {
|
||||||
|
API.event.emit('init.one');
|
||||||
|
|
||||||
// ensure we have settings from last session
|
// ensure we have settings from last session
|
||||||
API.conf.restore();
|
API.conf.restore();
|
||||||
|
|
||||||
|
|
@ -1716,6 +1718,8 @@ var gs_kiri_init = exports;
|
||||||
// SECOND STAGE INIT AFTER UI RESTORED
|
// SECOND STAGE INIT AFTER UI RESTORED
|
||||||
|
|
||||||
function init_two() {
|
function init_two() {
|
||||||
|
API.event.emit('init.two');
|
||||||
|
|
||||||
let current = settings(),
|
let current = settings(),
|
||||||
control = current.controller;
|
control = current.controller;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ let gs_kiri_slice = exports;
|
||||||
|
|
||||||
let KIRI = self.kiri,
|
let KIRI = self.kiri,
|
||||||
FILL = KIRI.fill,
|
FILL = KIRI.fill,
|
||||||
|
FILLFIXED = KIRI.fill_fixed,
|
||||||
BASE = self.base,
|
BASE = self.base,
|
||||||
UTIL = BASE.util,
|
UTIL = BASE.util,
|
||||||
POLY = BASE.polygons,
|
POLY = BASE.polygons,
|
||||||
|
|
@ -675,6 +676,8 @@ let gs_kiri_slice = exports;
|
||||||
line = [],
|
line = [],
|
||||||
// callback passed to pluggable infill algorithm
|
// callback passed to pluggable infill algorithm
|
||||||
target = {
|
target = {
|
||||||
|
slice: function() { return scope },
|
||||||
|
options: function() { return options },
|
||||||
lineWidth: function() { return options.lineWidth },
|
lineWidth: function() { return options.lineWidth },
|
||||||
bounds: function() { return bounds },
|
bounds: function() { return bounds },
|
||||||
zIndex: function() { return scope.index },
|
zIndex: function() { return scope.index },
|
||||||
|
|
@ -709,7 +712,7 @@ let gs_kiri_slice = exports;
|
||||||
|
|
||||||
scope._fill_finger = POLY.fingerprint(polys);
|
scope._fill_finger = POLY.fingerprint(polys);
|
||||||
|
|
||||||
let skippable = type !== 'gyroid' && type !== 'linear';
|
let skippable = FILLFIXED[type] ? true : false;
|
||||||
let miss = false;
|
let miss = false;
|
||||||
// if the layer below has the same fingerprint, we may be able to clone its infill
|
// if the layer below has the same fingerprint, we may be able to clone its infill
|
||||||
if (skippable && scope.fingerprintSame(down)) {
|
if (skippable && scope.fingerprintSame(down)) {
|
||||||
|
|
|
||||||
|
|
@ -464,9 +464,16 @@ function addCorsHeaders(req, res) {
|
||||||
*/
|
*/
|
||||||
function handleDebug(req, res, next) {
|
function handleDebug(req, res, next) {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
let ext = req.url.split('.').pop();
|
||||||
|
let type = {
|
||||||
|
'html': 'text/html',
|
||||||
|
'js': 'application/javascript'
|
||||||
|
}[ext] || 'application/unknown';
|
||||||
if (lastmod(req.url)) {
|
if (lastmod(req.url)) {
|
||||||
|
res.setHeader('Content-Type',type);
|
||||||
return res.end(fs.readFileSync(req.url));
|
return res.end(fs.readFileSync(req.url));
|
||||||
} else if (lastmod(req.url.substring(1))) {
|
} else if (lastmod(req.url.substring(1))) {
|
||||||
|
res.setHeader('Content-Type','application/javascript');
|
||||||
return res.end(fs.readFileSync(req.url.substring(1)));
|
return res.end(fs.readFileSync(req.url.substring(1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue