From 92ece197a1dd9b9ff4e7f5b2973894a550ef7359 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Wed, 12 Jan 2022 09:32:13 -0500 Subject: [PATCH] auto-select patches --- src/mesh/api.js | 3 ++- src/mesh/object.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesh/api.js b/src/mesh/api.js index f290bda3..f6f61142 100644 --- a/src/mesh/api.js +++ b/src/mesh/api.js @@ -315,6 +315,7 @@ let tool = { let newmdl = []; let mcore = new THREE.Matrix4().makeRotationX(Math.PI / 2); for (let m of models) { + // todo - translate vertices with source model's matrix let p = worker.model_analyze(m.id).then(data => { let { areas, edges } = data.mapped; let nm = areas.map(area => new mesh.model({ @@ -327,7 +328,7 @@ let tool = { } Promise.all(promises).then(() => { if (newmdl.length) { - mesh.api.group.new(newmdl, undefined, "patch"); + mesh.api.group.new(newmdl, undefined, "patch").select(); } api.log.emit('analysis complete').unpin(); }); diff --git a/src/mesh/object.js b/src/mesh/object.js index f81c6313..43861914 100644 --- a/src/mesh/object.js +++ b/src/mesh/object.js @@ -66,6 +66,10 @@ mesh.object = class MeshObject { return this.applyMatrix(matrix.elements).matrixChanged(); } + select() { + mesh.api.selection.set([this]); + } + focus() { mesh.api.focus(this.object); return this;