update face selection for new widget A indexing, timeline op terminates chain

This commit is contained in:
Stewart Allen 2022-11-02 22:22:38 -04:00
commit ee8d4b0013
5 changed files with 24 additions and 19 deletions

View file

@ -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();
}

View file

@ -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);

View file

@ -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);

View file

@ -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,

View file

@ -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');