From fa1a9453196de6f5254c1e483865a7bc485dba9f Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 13 Feb 2022 16:14:34 +0100 Subject: [PATCH] Fix face deletion in mdr'es when more that one face is selected. --- game/addons/mesh_data_resource_editor/MIDGizmo.gd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/game/addons/mesh_data_resource_editor/MIDGizmo.gd b/game/addons/mesh_data_resource_editor/MIDGizmo.gd index 843d767b..4fa1aa89 100644 --- a/game/addons/mesh_data_resource_editor/MIDGizmo.gd +++ b/game/addons/mesh_data_resource_editor/MIDGizmo.gd @@ -1214,9 +1214,16 @@ func delete_selected() -> void: var orig_arr = copy_arrays(_mdr.array) + var triangle_indexes : Array = Array() for sp in _selected_points: 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) add_mesh_change_undo_redo(orig_arr, _mdr.array, "Delete")