From ddcfc46ee6575bc90846e6e0a76ae72cd7313337 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 20 Mar 2024 23:16:02 +0100 Subject: [PATCH] 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 91b27ab637334383b57b. 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 --- source/blender/blenkernel/intern/DerivedMesh.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 6c4553d4f08..32e47125be8 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -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; + } } }