Fix #119544: Cage modifier deformation ignored in next modifier

When the edit mesh modifier stack first deforms the original edit mesh,
it creates deformed positions in a separate array. That array is copied
to the mesh's vertex positions if a subsequent modifier requires an
actual mesh rather than a mesh wrapper.

However, if that last deform modifier is the last "on cage" modifier
and the next modifier requires a real Mesh, we hit a code path that
didn't copy the temporary position array, since it was contained in the
separate `EditMeshData` struct that must be handled manually.

This was a regression in 91b27ab637. In the future I hope to
make this simpler by expanding the use of implicit sharing and making
the conversion from original BMesh to a Mesh more lazy / const correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/119718
This commit is contained in:
Hans Goudey
2024-03-20 23:16:02 +01:00
committed by Hans Goudey
parent 91aa2a3d84
commit ddcfc46ee6
@@ -1148,6 +1148,9 @@ static void editbmesh_calc_modifiers(Depsgraph *depsgraph,
mesh_final->edit_mesh->is_shallow_copy = true;
mesh_final->runtime->is_original_bmesh = true;
BKE_mesh_runtime_ensure_edit_data(mesh_final);
if (!mesh_cage->runtime->edit_data->vertexCos.is_empty()) {
mesh_final->runtime->edit_data->vertexCos = mesh_cage->runtime->edit_data->vertexCos;
}
}
}