Fix mesh undo issues

This commit is contained in:
JannisX11 2023-04-17 15:02:43 +02:00
parent 5e612e8d38
commit 50cbb4b88c
2 changed files with 8 additions and 7 deletions

View File

@ -1844,7 +1844,8 @@ const BARS = {
}
} else if (Modes.edit && Mesh.selected.length && mesh_selection) {
Undo.initEdit({elements: Mesh.selected})
let meshes = Mesh.selected.slice();
Undo.initEdit({elements: meshes})
Mesh.selected.forEach(mesh => {
let selected_vertices = mesh.getSelectedVertices();
@ -1926,13 +1927,13 @@ const BARS = {
delete mesh.vertices[vkey];
})
} else {
Mesh.selected.remove(mesh);
meshes.remove(mesh);
mesh.remove(false);
}
})
Undo.finishEdit('Delete mesh part')
Canvas.updateView({elements: Mesh.selected, selection: true, element_aspects: {geometry: true, faces: true, uv: Mesh.selected.length > 0}})
Canvas.updateView({elements: meshes, selection: true, element_aspects: {geometry: true, faces: true, uv: meshes.length > 0}})
} else if ((Modes.edit || Modes.paint) && (selected.length || Group.selected)) {

View File

@ -1384,7 +1384,7 @@ const UVEditor = {
icon: () => (UVEditor.isSelectedFaceMirrored(0) ? 'check_box' : 'check_box_outline_blank'),
condition: () => !UVEditor.isBoxUV() && UVEditor.getReferenceFace(),
click(event) {
Undo.initEdit({elements: Cube.selected, uv_only: true});
Undo.initEdit({elements: UVEditor.getMappableElements(), uv_only: true});
UVEditor.mirrorX(event);
Undo.finishEdit('Flip UV');
}
@ -1394,7 +1394,7 @@ const UVEditor = {
icon: () => (UVEditor.isSelectedFaceMirrored(1) ? 'check_box' : 'check_box_outline_blank'),
condition: () => !UVEditor.isBoxUV() && UVEditor.getReferenceFace(),
click(event) {
Undo.initEdit({elements: Cube.selected, uv_only: true});
Undo.initEdit({elements: UVEditor.getMappableElements(), uv_only: true});
UVEditor.mirrorY(event);
Undo.finishEdit('Flip UV');
}
@ -1538,7 +1538,7 @@ BARS.defineActions(function() {
category: 'uv',
condition: () => UVEditor.isFaceUV() && UVEditor.hasElements(),
click: function (event) {
Undo.initEdit({elements: Cube.selected, uv_only: true})
Undo.initEdit({elements: UVEditor.getMappableElements(), uv_only: true})
UVEditor.forSelection('mirrorX', event)
Undo.finishEdit('Mirror UV')
}
@ -1548,7 +1548,7 @@ BARS.defineActions(function() {
category: 'uv',
condition: () => UVEditor.isFaceUV() && UVEditor.hasElements(),
click: function (event) {
Undo.initEdit({elements: Cube.selected, uv_only: true})
Undo.initEdit({elements: UVEditor.getMappableElements(), uv_only: true})
UVEditor.forSelection('mirrorY', event)
Undo.finishEdit('Mirror UV')
}