add union op
This commit is contained in:
parent
9ff7289946
commit
d64000aafb
3 changed files with 21 additions and 2 deletions
|
|
@ -284,6 +284,8 @@ function space_init(data) {
|
||||||
case 'KeyM':
|
case 'KeyM':
|
||||||
if (shiftKey) return api.tool.merge();
|
if (shiftKey) return api.tool.merge();
|
||||||
return api.tool.mirror();
|
return api.tool.mirror();
|
||||||
|
case 'KeyU':
|
||||||
|
return shiftKey && api.tool.union();
|
||||||
case 'KeyA':
|
case 'KeyA':
|
||||||
return shiftKey ? api.tool.analyze() : undefined;
|
return shiftKey ? api.tool.analyze() : undefined;
|
||||||
case 'KeyR':
|
case 'KeyR':
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,22 @@ let tool = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
union(models) {
|
||||||
|
models = fallback(models);
|
||||||
|
api.log.emit(`union ${models.length} model(s)`).pin();
|
||||||
|
worker.model_union(models.map(m => {
|
||||||
|
return { id: m.id, matrix: m.matrix }
|
||||||
|
}))
|
||||||
|
.then(data => {
|
||||||
|
let group = api.group.new([new mesh.model({
|
||||||
|
file: `unioned`,
|
||||||
|
mesh: data
|
||||||
|
})]).promote();
|
||||||
|
api.selection.set([group]);
|
||||||
|
api.log.emit('union complete').unpin();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
duplicate() {
|
duplicate() {
|
||||||
for (let m of selection.models()) {
|
for (let m of selection.models()) {
|
||||||
m.duplicate();
|
m.duplicate();
|
||||||
|
|
|
||||||
|
|
@ -281,8 +281,8 @@ function ui_build() {
|
||||||
h.button({ _: 'visible', onclick() { selection.visible({ toggle: true }) } }),
|
h.button({ _: 'visible', onclick() { selection.visible({ toggle: true }) } }),
|
||||||
h.button({ _: 'bounds', onclick() { selection.boundsBox({ toggle: true }) } }),
|
h.button({ _: 'bounds', onclick() { selection.boundsBox({ toggle: true }) } }),
|
||||||
h.button({ _: 'gridlines', onclick() { api.grid() } }),
|
h.button({ _: 'gridlines', onclick() { api.grid() } }),
|
||||||
h.button({ _: 'wireframe', onclick() { api.wireframe() } }),
|
|
||||||
h.button({ _: 'normals', onclick() { api.normals() } }),
|
h.button({ _: 'normals', onclick() { api.normals() } }),
|
||||||
|
h.button({ _: 'wireframe', onclick() { api.wireframe() } }),
|
||||||
]),
|
]),
|
||||||
h.div([
|
h.div([
|
||||||
h.div({ _: "edit", class: "head" }),
|
h.div({ _: "edit", class: "head" }),
|
||||||
|
|
@ -291,8 +291,8 @@ function ui_build() {
|
||||||
h.button({ _: 'regroup', onclick: tool.regroup }),
|
h.button({ _: 'regroup', onclick: tool.regroup }),
|
||||||
h.button({ _: 'merge', onclick: tool.merge }),
|
h.button({ _: 'merge', onclick: tool.merge }),
|
||||||
h.button({ _: 'mirror', onclick: tool.mirror }),
|
h.button({ _: 'mirror', onclick: tool.mirror }),
|
||||||
|
h.button({ _: 'union', onclick: tool.union }),
|
||||||
h.button({ _: 'split', onclick: call.edit_split }),
|
h.button({ _: 'split', onclick: call.edit_split }),
|
||||||
h.button({ _: 'invert', onclick: tool.invert }),
|
|
||||||
]),
|
]),
|
||||||
h.div([
|
h.div([
|
||||||
h.div({ _: "fix", class: "head" }),
|
h.div({ _: "fix", class: "head" }),
|
||||||
|
|
@ -300,6 +300,7 @@ function ui_build() {
|
||||||
h.button({ _: 'automatic', onclick: tool.repair }),
|
h.button({ _: 'automatic', onclick: tool.repair }),
|
||||||
h.button({ _: 'analyze', onclick: tool.analyze }),
|
h.button({ _: 'analyze', onclick: tool.analyze }),
|
||||||
// h.button({ _: 'rebuild', onclick: tool.rebuild }),
|
// h.button({ _: 'rebuild', onclick: tool.rebuild }),
|
||||||
|
h.button({ _: 'invert', onclick: tool.invert }),
|
||||||
h.button({ _: 'clean', onclick: tool.clean }),
|
h.button({ _: 'clean', onclick: tool.clean }),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue