add selector for trace mode. convert widget mesh material to array. bump rev 3.4.D1
This commit is contained in:
parent
2813eaa0e6
commit
31bfe837d7
8 changed files with 40 additions and 23 deletions
|
|
@ -74,6 +74,11 @@ const LISTS = {
|
|||
{ name: "800" },
|
||||
{ name: "900" }
|
||||
],
|
||||
select: [
|
||||
{ name: "loops" },
|
||||
{ name: "lines" },
|
||||
// { name: "surface" }
|
||||
],
|
||||
trace: [
|
||||
{ name: "follow" },
|
||||
{ name: "clear" }
|
||||
|
|
|
|||
|
|
@ -263,9 +263,8 @@ function platformSelect(widget, shift, recurse = true) {
|
|||
platform.select(widget, false, recurse);
|
||||
}
|
||||
} else {
|
||||
let { mesh } = widget;
|
||||
// prevent selection in slice view
|
||||
if (!mesh.material.visible) {
|
||||
if (!widget.isVisible()) {
|
||||
return;
|
||||
}
|
||||
if (!shift) {
|
||||
|
|
|
|||
|
|
@ -300,19 +300,18 @@ class Widget {
|
|||
loadGeometry(geometry) {
|
||||
const mesh = new THREE.Mesh(
|
||||
geometry,
|
||||
new THREE.MeshPhongMaterial({
|
||||
[ new THREE.MeshPhongMaterial({
|
||||
color: 0xffff00,
|
||||
specular: 0x202020,
|
||||
shininess: 125,
|
||||
transparent: true,
|
||||
opacity: solid_opacity
|
||||
})
|
||||
}) ]
|
||||
);
|
||||
mesh.renderOrder = 1;
|
||||
// fix invalid normals
|
||||
// geometry.computeFaceNormals();
|
||||
geometry.computeVertexNormals();
|
||||
mesh.material.side = THREE.DoubleSide;
|
||||
geometry.addGroup(0, Infinity, 0);
|
||||
mesh.material[0].side = THREE.DoubleSide;
|
||||
mesh.castShadow = true;
|
||||
mesh.receiveShadow = true;
|
||||
mesh.widget = this;
|
||||
|
|
@ -362,7 +361,7 @@ class Widget {
|
|||
if (save) {
|
||||
this.color = color;
|
||||
}
|
||||
let material = this.mesh.material;
|
||||
let material = this.getMaterial();
|
||||
material.color.set(this.meta.disabled ? avgc(0x888888, color, 3) : color);
|
||||
}
|
||||
|
||||
|
|
@ -370,19 +369,28 @@ class Widget {
|
|||
return this.color;
|
||||
}
|
||||
|
||||
getMaterial() {
|
||||
return this.mesh.material[0];
|
||||
}
|
||||
|
||||
isVisible() {
|
||||
return this.getMaterial().visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
*/
|
||||
setOpacity(value) {
|
||||
const mesh = this.mesh;
|
||||
const mat = this.getMaterial();
|
||||
if (value <= 0.0) {
|
||||
mesh.material.transparent = solid_opacity < 1.0;
|
||||
mesh.material.opacity = solid_opacity;
|
||||
mesh.material.visible = false;
|
||||
mat.transparent = solid_opacity < 1.0;
|
||||
mat.opacity = solid_opacity;
|
||||
mat.visible = false;
|
||||
} else if (inRange(value, 0.0, solid_opacity)) {
|
||||
mesh.material.transparent = value < 1.0;
|
||||
mesh.material.opacity = value;
|
||||
mesh.material.visible = true;
|
||||
mat.transparent = value < 1.0;
|
||||
mat.opacity = value;
|
||||
mat.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -474,10 +482,11 @@ class Widget {
|
|||
|
||||
_move(x, y, z, abs) {
|
||||
let mesh = this.mesh,
|
||||
mat = this.getMaterial(),
|
||||
pos = this.track.pos,
|
||||
zcut = this.track.zcut || 0;
|
||||
// do not allow moves in pure slice view
|
||||
if (!mesh.material.visible) return;
|
||||
if (!mat.visible) return;
|
||||
if (abs) {
|
||||
mesh.position.set(x, y, z - zcut);
|
||||
pos.x = (x || 0);
|
||||
|
|
@ -896,7 +905,7 @@ const Group = Widget.Groups = {
|
|||
h: group[0].track.box.h,
|
||||
move: (x,y,z,abs) => {
|
||||
group.forEach(widget => {
|
||||
widget.mesh.material.visible = true;
|
||||
widget.getMaterial().visible = true;
|
||||
widget._move(x, y, z, abs);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue