auto-select patches

This commit is contained in:
Stewart Allen 2022-01-12 09:32:13 -05:00
commit 92ece197a1
2 changed files with 6 additions and 1 deletions

View file

@ -315,6 +315,7 @@ let tool = {
let newmdl = []; let newmdl = [];
let mcore = new THREE.Matrix4().makeRotationX(Math.PI / 2); let mcore = new THREE.Matrix4().makeRotationX(Math.PI / 2);
for (let m of models) { for (let m of models) {
// todo - translate vertices with source model's matrix
let p = worker.model_analyze(m.id).then(data => { let p = worker.model_analyze(m.id).then(data => {
let { areas, edges } = data.mapped; let { areas, edges } = data.mapped;
let nm = areas.map(area => new mesh.model({ let nm = areas.map(area => new mesh.model({
@ -327,7 +328,7 @@ let tool = {
} }
Promise.all(promises).then(() => { Promise.all(promises).then(() => {
if (newmdl.length) { if (newmdl.length) {
mesh.api.group.new(newmdl, undefined, "patch"); mesh.api.group.new(newmdl, undefined, "patch").select();
} }
api.log.emit('analysis complete').unpin(); api.log.emit('analysis complete').unpin();
}); });

View file

@ -66,6 +66,10 @@ mesh.object = class MeshObject {
return this.applyMatrix(matrix.elements).matrixChanged(); return this.applyMatrix(matrix.elements).matrixChanged();
} }
select() {
mesh.api.selection.set([this]);
}
focus() { focus() {
mesh.api.focus(this.object); mesh.api.focus(this.object);
return this; return this;