Skip to content

Commit

Permalink
Merge pull request #46920 from nekomatata/soft-body-gizmo-fix-3.2
Browse files Browse the repository at this point in the history
[3.2] Fix pinned vertices in SoftBody editor gizmo
  • Loading branch information
akien-mga authored Mar 13, 2021
2 parents 707a3a6 + 987c346 commit 1d0929a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion editor/spatial_editor_gizmos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2148,7 +2148,17 @@ void SoftBodySpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
Ref<TriangleMesh> tm = soft_body->get_mesh()->generate_triangle_mesh();

Vector<Vector3> 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.empty());

const PoolVector<Vector3> &vertices = arrays[Mesh::ARRAY_VERTEX];
PoolVector<Vector3>::Read vertices_read = vertices.read();
int vertex_count = vertices.size();
for (int index = 0; index < vertex_count; ++index) {
points.push_back(vertices_read[index]);
}
}

Ref<Material> material = get_material("shape_material", p_gizmo);

Expand Down

0 comments on commit 1d0929a

Please sign in to comment.