add delete/backspace to remove model. front view. no auto-select on add

This commit is contained in:
Stewart Allen 2022-01-01 15:04:24 -05:00
commit b4e9a8a87a
3 changed files with 24 additions and 7 deletions

View file

@ -183,7 +183,6 @@ let group = {
groups.addOnce(group);
space.world.add(group.group);
space.update();
selection.set([group]);
return group;
},
@ -234,6 +233,7 @@ let api = mesh.api = {
},
objects: () => {
// return models, not groups
return group.list().map(o => o.models).flat().map(o => o.object());
}
};

View file

@ -42,6 +42,13 @@ mesh.group = class MeshGroup extends mesh.object {
// @param model {MeshModel}
remove(model) {
// remove all models
if (arguments.length === 0) {
for (let m of this.models.slice()) {
this.remove(m);
}
return;
}
model.group = undefined;
this.models.remove(model);
this.group.remove(model.mesh);