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
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "grid-apps",
|
||||
"version": "3.4.0D",
|
||||
"version": "3.4.1D",
|
||||
"description": "grid.space 3d slice & modeling tools",
|
||||
"author": "Stewart Allen <sa@grid.space>",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -612,7 +612,7 @@ CAM.init = function(kiri, api) {
|
|||
}
|
||||
});
|
||||
});
|
||||
}, poppedRec.single);
|
||||
}, poppedRec.select === 'lines');
|
||||
api.feature.hover = true;
|
||||
api.feature.hoverAdds = true;
|
||||
func.hover = func.traceHover;
|
||||
|
|
@ -954,7 +954,8 @@ CAM.init = function(kiri, api) {
|
|||
down: 'camTraceDown',
|
||||
rate: 'camTraceSpeed',
|
||||
plunge: 'camTracePlunge',
|
||||
single: 'camTraceLines',
|
||||
// single: 'camTraceLines',
|
||||
select: 'camTraceMode'
|
||||
}).inputs = {
|
||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
|
|
@ -966,8 +967,9 @@ CAM.init = function(kiri, api) {
|
|||
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
|
||||
plunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, units:true}),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
single: UC.newBoolean(LANG.cc_sngl_s, undefined, {title:LANG.cc_sngl_l}),
|
||||
select: UC.newRow([
|
||||
// single: UC.newBoolean(LANG.cc_sngl_s, undefined, {title:LANG.cc_sngl_l}),
|
||||
select: UC.newSelect(LANG.cc_sele_s, {title:LANG.cc_sele_l}, "select"),
|
||||
menu: UC.newRow([
|
||||
UC.newButton(undefined, func.traceAdd, {icon:'<i class="fas fa-plus"></i>'}),
|
||||
UC.newButton(undefined, func.traceDone, {icon:'<i class="fas fa-check"></i>'}),
|
||||
], {class:"ext-buttons f-row"}),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ gapp.main("main.kiri", [], (root) => {
|
|||
const modfns = root.kirimod = ( root.kirimod || [] );
|
||||
|
||||
const kiri = root.kiri = {
|
||||
beta: 3400,
|
||||
beta: 3401,
|
||||
driver: {}, // driver modules
|
||||
load(fn) {
|
||||
modfns.push(fn);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
let terms = {
|
||||
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||
LICENSE: "See the license.md file included with the source distribution",
|
||||
VERSION: "3.4.D0"
|
||||
VERSION: "3.4.D1"
|
||||
};
|
||||
|
||||
if (typeof(module) === 'object') {
|
||||
|
|
|
|||
|
|
@ -436,6 +436,8 @@ self.kiri.lang['en-us'] = {
|
|||
cc_plng_l: ["max z axis speed in","workspace units / minute"],
|
||||
cc_sngl_s: "select lines only",
|
||||
cc_sngl_l: ["select only single edges","instead of connected polylines"],
|
||||
cc_sele_s: "select",
|
||||
cc_sele_l: ["select lines for follow","select loops for clear","select surface for pocket"],
|
||||
|
||||
// CNC COMMON
|
||||
cc_menu: "limits",
|
||||
|
|
|
|||
Loading…
Reference in a new issue