Fix face deletion in mdr'es when more that one face is selected.

This commit is contained in:
Relintai 2022-02-13 16:14:34 +01:00
parent df071af39c
commit fa1a945319

View File

@ -1214,9 +1214,16 @@ func delete_selected() -> void:
var orig_arr = copy_arrays(_mdr.array) var orig_arr = copy_arrays(_mdr.array)
var triangle_indexes : Array = Array()
for sp in _selected_points: for sp in _selected_points:
var triangle_index : int = find_first_triangle_index_for_face(sp) var triangle_index : int = find_first_triangle_index_for_face(sp)
triangle_indexes.append(triangle_index)
#delete in reverse triangle index order
triangle_indexes.sort()
for i in range(triangle_indexes.size() - 1, -1, -1):
var triangle_index : int = triangle_indexes[i]
MDRMeshUtils.remove_triangle(_mdr, triangle_index) MDRMeshUtils.remove_triangle(_mdr, triangle_index)
add_mesh_change_undo_redo(orig_arr, _mdr.array, "Delete") add_mesh_change_undo_redo(orig_arr, _mdr.array, "Delete")