Fix #130086: Weight/vertex paint non-deform modifiers wrong positions

The PBVH vertex positions accessor functions have to match the logic in
`sculpt_update_object`. When there were topology changing modifiers
before deform modifiers it didn't. `BKE_crazyspace_build_sculpt` just
skips the topology changing modifiers, and the resulting positions
are stored in `ss.deform_cos`, which we need to access here.

Pull Request: https://projects.blender.org/blender/blender/pulls/130139
This commit is contained in:
Hans Goudey
2024-11-11 17:24:13 +01:00
committed by Hans Goudey
parent 9fb185d31d
commit dd651ef5d6

View File

@@ -2433,6 +2433,10 @@ static Span<float3> vert_positions_eval(const Object &object_orig, const Object
return mesh_eval->vert_positions();
}
}
if (!ss.deform_cos.is_empty()) {
BLI_assert(ss.deform_cos.size() == mesh_orig.verts_num);
return ss.deform_cos;
}
if (const Mesh *mesh_eval = BKE_object_get_mesh_deform_eval(&object_eval)) {
return mesh_eval->vert_positions();
}
@@ -2457,6 +2461,10 @@ static MutableSpan<float3> vert_positions_eval_for_write(Object &object_orig, Ob
return mesh_eval_mut->vert_positions_for_write();
}
}
if (!ss.deform_cos.is_empty()) {
BLI_assert(ss.deform_cos.size() == mesh_orig.verts_num);
return ss.deform_cos;
}
if (const Mesh *mesh_eval = BKE_object_get_mesh_deform_eval(&object_eval)) {
Mesh *mesh_eval_mut = const_cast<Mesh *>(mesh_eval);
return mesh_eval_mut->vert_positions_for_write();