diff --git a/src/kiri-mode/cam/client.js b/src/kiri-mode/cam/client.js index bf838143..bd5082ea 100644 --- a/src/kiri-mode/cam/client.js +++ b/src/kiri-mode/cam/client.js @@ -1782,8 +1782,8 @@ function updateStock(args, event) { camZBottom = undefined; } - API.platform.update_top_z(delta); - API.platform.update_origin(); + // API.platform.update_top_z(delta); + // API.platform.update_origin(); SPACE.update(); } diff --git a/src/kiri-mode/cam/slice.js b/src/kiri-mode/cam/slice.js index bfee53e0..c3e51631 100644 --- a/src/kiri-mode/cam/slice.js +++ b/src/kiri-mode/cam/slice.js @@ -196,6 +196,9 @@ CAM.slice = function(settings, widget, onupdate, ondone) { // determing # of steps and step weighting for progress bar for (let op of proc.ops.filter(op => !op.disabled)) { + if (op.type === '|') { + break; + } let opfn = OPS[op.type]; if (opfn) { let opin = new opfn(state, op); diff --git a/src/kiri/tools.js b/src/kiri/tools.js index 2d755847..f0df350a 100644 --- a/src/kiri/tools.js +++ b/src/kiri/tools.js @@ -8,6 +8,9 @@ const { Vector3, Quaternion } = THREE; const { kiri } = root; const { api } = kiri; +const XAXIS = new THREE.Vector3(1,0,0); +const ZAXIS = new THREE.Vector3(0,0,1); + // circle let pgeo = new THREE.CircleGeometry(8, 30); let pmat = new THREE.MeshBasicMaterial({color: 0xff0000, opacity: 0.5, transparent: true}); @@ -116,20 +119,17 @@ api.event.on('mouse.hover', (ev) => { obj.add(pmesh); pmesh.position.x = point.x - opos.x + norm.x * 0.1; if (track.indexed) { - let delta = track.delta; let rad = track.indexRad; - let py = (point.y - delta.z + track.tzoff) * 1.001; - let pz = (point.z + delta.y) * 1.001; - let v = new THREE.Vector3(point.x, py, pz) - .applyAxisAngle(new THREE.Vector3(1,0,0), rad); + let py = point.y * 1.001; + let pz = point.z * 1.001; + let v = new THREE.Vector3(point.x, py, pz).applyAxisAngle(XAXIS, rad); pmesh.position.y = -v.z; pmesh.position.z = v.y; } else { pmesh.position.y = -point.z - opos.y + norm.y * 0.1; - pmesh.position.z = point.y + norm.z * 0.1; + pmesh.position.z = point.y + track.tzoff + norm.z * 0.1; } - let q = new Quaternion().setFromUnitVectors( - new Vector3(0,0,1), + let q = new Quaternion().setFromUnitVectors(ZAXIS, new Vector3(norm.x,norm.y,norm.z) ); pmesh.setRotationFromQuaternion(q); diff --git a/src/kiri/utils.js b/src/kiri/utils.js index 7654f231..d75db786 100644 --- a/src/kiri/utils.js +++ b/src/kiri/utils.js @@ -92,7 +92,15 @@ function areEqual(o1, o2) { return false; } +function trackFn(fn, name) { + return function() { + console.log(name, ...arguments); + fn(...arguments); + } +} + exports({ + trackFn, areEqual, parseOpt, encodeOpt, diff --git a/src/kiri/widget.js b/src/kiri/widget.js index fb762856..16bcdae0 100644 --- a/src/kiri/widget.js +++ b/src/kiri/widget.js @@ -17,7 +17,7 @@ const { api, driver, utils } = kiri; const { util, polygons } = base; const { Mesh, newPoint, verticesToPoints } = base; const { inRange, time } = util; -const { avgc } = utils; +const { avgc, trackFn } = utils; const solid_opacity = 1.0; const groups = []; @@ -467,7 +467,6 @@ class Widget { if (z !== this.track.indexed) { this.track.indexed = z; this.center(false); - // api.platform.update_top_z(); this._updateMeshPosition(); } } @@ -488,7 +487,6 @@ class Widget { setTopZ(z) { let mesh = this.mesh, track = this.track, - ltop = track.top || 0, mbz = mesh.getBoundingBox().max.z; if (z) { track.top = z; @@ -497,7 +495,6 @@ class Widget { } // difference between top of stock/bounds and top of widget (cam mode) track.tzoff = mbz - z; - this.modified |= (ltop !== z); this._updateMeshPosition(); } @@ -701,9 +698,10 @@ class Widget { } getBoundingBox(refresh) { - if (!this.bounds || refresh) { + if (!this.bounds || refresh || this.modified) { this.bounds = new THREE.Box3(); this.bounds.setFromPoints(this.getPoints()); + this.modified = false; } return this.bounds; } @@ -718,10 +716,6 @@ class Widget { return bounds; } - isModified() { - return this.modified; - } - getExtruder(settings) { if (settings) { console.trace('legacy call with settings');