From 29e67101db061aed5e2536e6613c863a83c42b71 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 11 Mar 2021 18:28:16 -0700 Subject: Fix pinned vertices in SoftBody editor gizmo The wrong vertices could be highlighted/selected due to generating a debug triangle mesh to gather points, which can modify the order of vertices. --- editor/node_3d_editor_gizmos.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/editor/node_3d_editor_gizmos.cpp b/editor/node_3d_editor_gizmos.cpp index 16eefb1ad3..64cf9a7bb7 100644 --- a/editor/node_3d_editor_gizmos.cpp +++ b/editor/node_3d_editor_gizmos.cpp @@ -2073,7 +2073,13 @@ void SoftBody3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { Ref tm = soft_body->get_mesh()->generate_triangle_mesh(); Vector points; - soft_body->get_mesh()->generate_debug_mesh_indices(points); + for (int i = 0; i < soft_body->get_mesh()->get_surface_count(); i++) { + Array arrays = soft_body->get_mesh()->surface_get_arrays(i); + ERR_CONTINUE(arrays.is_empty()); + + const Vector &vertices = arrays[Mesh::ARRAY_VERTEX]; + points.append_array(vertices); + } Ref material = get_material("shape_material", p_gizmo); -- cgit v1.2.3