Mesh: Avoid position copying in corrective smooth modifier #108291

Merged
Hans Goudey merged 2 commits from Chao-Li/blender:remove-position-copy into main 2023-05-25 22:12:17 +02:00
1 changed files with 3 additions and 2 deletions
Showing only changes of commit b0f1e89813 - Show all commits

View File

@ -658,8 +658,9 @@ static void correctivesmooth_modifier_do(ModifierData *md,
is_rest_coords_alloc = true;
}
else {
rest_coords = BKE_mesh_vert_positions(static_cast<const Mesh *>(ob->data));
me_numVerts = static_cast<const Mesh *>(ob->data)->totvert;
const Mesh *me = static_cast<const Mesh *>(ob->data);
Chao-Li marked this conversation as resolved Outdated

It would be a bit nicer to make a temporary Mesh *mesh variable, to avoid casting the object data twice.

It would be a bit nicer to make a temporary `Mesh *mesh` variable, to avoid casting the object data twice.

Sure. I named it Mesh *me since there's a variable named mesh in outer scope.

Sure. I named it `Mesh *me` since there's a variable named `mesh` in outer scope.
rest_coords = BKE_mesh_vert_positions(me);
me_numVerts = me->totvert;
}
BLI_assert((uint)me_numVerts == verts_num);