return early when no changes
This commit is contained in:
parent
ee8d4b0013
commit
7bb4b817fa
2 changed files with 9 additions and 4 deletions
|
|
@ -66,13 +66,14 @@ CAM.init = function(kiri, api) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAnimationStyle(settings) {
|
function setAnimationStyle(settings) {
|
||||||
|
let changed = isIndexed !== settings.process.camStockIndexed;
|
||||||
isIndexed = settings.process.camStockIndexed;
|
isIndexed = settings.process.camStockIndexed;
|
||||||
if (!isIndexed || !isCamMode) {
|
if (!isIndexed || !isCamMode) {
|
||||||
for (let widget of API.widgets.all()) {
|
for (let widget of API.widgets.all()) {
|
||||||
widget.setAxisIndex(0);
|
widget.setAxisIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isCamMode) {
|
if (!(isCamMode && changed)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isIndexed) {
|
if (isIndexed) {
|
||||||
|
|
@ -130,6 +131,7 @@ CAM.init = function(kiri, api) {
|
||||||
});
|
});
|
||||||
|
|
||||||
api.event.on("mode.set", (mode) => {
|
api.event.on("mode.set", (mode) => {
|
||||||
|
isIndexed = undefined;
|
||||||
isCamMode = mode === 'CAM';
|
isCamMode = mode === 'CAM';
|
||||||
$('set-tools').style.display = isCamMode ? '' : 'none';
|
$('set-tools').style.display = isCamMode ? '' : 'none';
|
||||||
SPACE.platform.setColor(isCamMode ? 0xeeeeee : 0xcccccc);
|
SPACE.platform.setColor(isCamMode ? 0xeeeeee : 0xcccccc);
|
||||||
|
|
@ -587,6 +589,7 @@ CAM.init = function(kiri, api) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// update widget rotations from timeline marker
|
// update widget rotations from timeline marker
|
||||||
|
if (isIndexed)
|
||||||
for (let widget of API.widgets.all()) {
|
for (let widget of API.widgets.all()) {
|
||||||
widget.setAxisIndex(-index);
|
widget.setAxisIndex(-index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class Widget {
|
||||||
// wireframe
|
// wireframe
|
||||||
this.wire = null;
|
this.wire = null;
|
||||||
this.slices = null;
|
this.slices = null;
|
||||||
this.settings = null;
|
this.settings = null; // used??
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
this.track = {
|
this.track = {
|
||||||
// box size for packer
|
// box size for packer
|
||||||
|
|
@ -83,6 +83,7 @@ class Widget {
|
||||||
top: 0, // z top
|
top: 0, // z top
|
||||||
mirror: false
|
mirror: false
|
||||||
},
|
},
|
||||||
|
// used to cache shadow geo
|
||||||
this.cache = {};
|
this.cache = {};
|
||||||
this.stats = {
|
this.stats = {
|
||||||
slice_time: 0,
|
slice_time: 0,
|
||||||
|
|
@ -536,6 +537,7 @@ class Widget {
|
||||||
top = track.top,
|
top = track.top,
|
||||||
tz = tzoff !== top ? -tzoff : 0,
|
tz = tzoff !== top ? -tzoff : 0,
|
||||||
{ x, y, z } = track.pos;
|
{ x, y, z } = track.pos;
|
||||||
|
console.trace('ump', {top, tz, tzoff});
|
||||||
if (track.indexed) {
|
if (track.indexed) {
|
||||||
let rad = track.indexRad;
|
let rad = track.indexRad;
|
||||||
let ln = track.box.d / 2;
|
let ln = track.box.d / 2;
|
||||||
|
|
@ -699,8 +701,8 @@ class Widget {
|
||||||
|
|
||||||
getBoundingBox(refresh) {
|
getBoundingBox(refresh) {
|
||||||
if (!this.bounds || refresh || this.modified) {
|
if (!this.bounds || refresh || this.modified) {
|
||||||
this.bounds = new THREE.Box3();
|
// console.trace('gbb', refresh);
|
||||||
this.bounds.setFromPoints(this.getPoints());
|
this.bounds = new THREE.Box3().setFromPoints(this.getPoints());
|
||||||
this.modified = false;
|
this.modified = false;
|
||||||
}
|
}
|
||||||
return this.bounds;
|
return this.bounds;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue