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 9 additions and 4 deletions

View File

@ -653,12 +653,17 @@ static void correctivesmooth_modifier_do(ModifierData *md,
}
else {
int me_numVerts;
rest_coords = em ? BKE_editmesh_vert_coords_alloc_orco(em, &me_numVerts) :
BKE_mesh_vert_coords_alloc(static_cast<const Mesh *>(ob->data),
&me_numVerts);
if (em) {
rest_coords = BKE_editmesh_vert_coords_alloc_orco(em, &me_numVerts);
is_rest_coords_alloc = true;
}
else {
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);
is_rest_coords_alloc = true;
}
#ifdef DEBUG_TIME