Fix mode keybindings not saving

Fix ground plane and painting grid being included in screenshots
Delete removed faces of a cube when converting to mesh, closes #1264
This commit is contained in:
JannisX11 2022-01-26 16:14:31 +01:00
parent 36a59630ec
commit af5b60e743
3 changed files with 11 additions and 2 deletions

View File

@ -4,7 +4,7 @@ class Mode extends KeybindItem {
data = id;
id = data.id;
}
super(data)
super(id, data)
this.id = id;
this.name = data.name || tl('mode.'+this.id);
this.selected = false

View File

@ -1484,8 +1484,11 @@ BARS.defineActions(function() {
})
let vertex_keys = Object.keys(mesh.vertices);
let unused_vkeys = vertex_keys.slice();
function addFace(direction, vertices) {
let cube_face = cube.faces[direction];
console.log(direction, cube_face, cube_face.texture)
if (cube_face.texture === null) return;
let uv = {
[vertices[0]]: [cube_face.uv[2], cube_face.uv[1]],
[vertices[1]]: [cube_face.uv[0], cube_face.uv[1]],
@ -1499,6 +1502,7 @@ BARS.defineActions(function() {
texture: cube_face.texture,
}
));
vertices.forEach(vkey => unused_vkeys.remove(vkey));
}
addFace('east', [vertex_keys[1], vertex_keys[0], vertex_keys[3], vertex_keys[2]]);
addFace('west', [vertex_keys[4], vertex_keys[5], vertex_keys[6], vertex_keys[7]]);
@ -1507,6 +1511,10 @@ BARS.defineActions(function() {
addFace('south', [vertex_keys[0], vertex_keys[4], vertex_keys[2], vertex_keys[6]]);
addFace('north', [vertex_keys[5], vertex_keys[1], vertex_keys[7], vertex_keys[3]]);
unused_vkeys.forEach(vkey => {
delete mesh.vertices[vkey];
})
mesh.sortInBefore(cube).init();
new_meshes.push(mesh);
cube.remove();

View File

@ -443,6 +443,7 @@ const Canvas = {
function editVis(edit) {
edit(three_grid)
edit(Canvas.ground_plane)
edit(Canvas.side_grids.x)
edit(Canvas.side_grids.z)
edit(Transformer)
@ -450,7 +451,7 @@ const Canvas = {
edit(rot_origin)
edit(Vertexsnap.line)
edit(Animator.motion_trail)
Outliner.selected.forEach(element => {
Outliner.elements.forEach(element => {
let {mesh} = element;
if (element.selected && mesh.outline) edit(mesh.outline);
if (mesh.grid_box) edit(mesh.grid_box);