PBVH: update mesh data pointers stored in pbvh #106271

Merged
Jacques Lucke merged 11 commits from JacquesLucke/blender:pbvh-update-pointers into main 2023-04-08 13:29:49 +02:00
1 changed files with 4 additions and 1 deletions
Showing only changes of commit ee06d21f50 - Show all commits

View File

@ -833,7 +833,10 @@ void BKE_pbvh_update_mesh_pointers(PBVH *pbvh, Mesh *mesh)
pbvh->polys = mesh->polys().data();
pbvh->corner_verts = mesh->corner_verts().data();
pbvh->vert_positions = BKE_mesh_vert_positions_for_write(mesh);
if (!pbvh->deformed) {
/* If it was deformed, a new array is allocated. */
JacquesLucke marked this conversation as resolved Outdated

This comment is a bit confusing. I think a more correct phrasing would be Deformed positions not matching the original mesh are owned directly by the PBVH, and are set separately by #BKE_pbvh_vert_coords_apply (though I do suggest tweaking that a bit below).

This comment is a bit confusing. I think a more correct phrasing would be `Deformed positions not matching the original mesh are owned directly by the PBVH, and are set separately by #BKE_pbvh_vert_coords_apply` (though I do suggest tweaking that a bit below).
pbvh->vert_positions = BKE_mesh_vert_positions_for_write(mesh);
}
pbvh->material_indices = static_cast<const int *>(
CustomData_get_layer_named(&mesh->pdata, CD_PROP_INT32, "material_index"));