return early when no changes

This commit is contained in:
Stewart Allen 2022-11-02 23:30:40 -04:00
commit 7bb4b817fa
2 changed files with 9 additions and 4 deletions

View file

@ -66,13 +66,14 @@ CAM.init = function(kiri, api) {
}
function setAnimationStyle(settings) {
let changed = isIndexed !== settings.process.camStockIndexed;
isIndexed = settings.process.camStockIndexed;
if (!isIndexed || !isCamMode) {
for (let widget of API.widgets.all()) {
widget.setAxisIndex(0);
}
}
if (!isCamMode) {
if (!(isCamMode && changed)) {
return;
}
if (isIndexed) {
@ -130,6 +131,7 @@ CAM.init = function(kiri, api) {
});
api.event.on("mode.set", (mode) => {
isIndexed = undefined;
isCamMode = mode === 'CAM';
$('set-tools').style.display = isCamMode ? '' : 'none';
SPACE.platform.setColor(isCamMode ? 0xeeeeee : 0xcccccc);
@ -587,6 +589,7 @@ CAM.init = function(kiri, api) {
}
}
// update widget rotations from timeline marker
if (isIndexed)
for (let widget of API.widgets.all()) {
widget.setAxisIndex(-index);
}

View file

@ -56,7 +56,7 @@ class Widget {
// wireframe
this.wire = null;
this.slices = null;
this.settings = null;
this.settings = null; // used??
this.modified = true;
this.track = {
// box size for packer
@ -83,6 +83,7 @@ class Widget {
top: 0, // z top
mirror: false
},
// used to cache shadow geo
this.cache = {};
this.stats = {
slice_time: 0,
@ -536,6 +537,7 @@ class Widget {
top = track.top,
tz = tzoff !== top ? -tzoff : 0,
{ x, y, z } = track.pos;
console.trace('ump', {top, tz, tzoff});
if (track.indexed) {
let rad = track.indexRad;
let ln = track.box.d / 2;
@ -699,8 +701,8 @@ class Widget {
getBoundingBox(refresh) {
if (!this.bounds || refresh || this.modified) {
this.bounds = new THREE.Box3();
this.bounds.setFromPoints(this.getPoints());
// console.trace('gbb', refresh);
this.bounds = new THREE.Box3().setFromPoints(this.getPoints());
this.modified = false;
}
return this.bounds;