BMesh: merge normal and tessellation calculation on undo

This gives a modest speedup as calculating tessellation and face
normals at the same time can be more efficiently multi-threaded.

Also avoids calculating face normals twice,
oversight in d590e223da.
This commit is contained in:
Campbell Barton 2022-01-22 18:02:12 +11:00
parent 25c99e72cd
commit e88d966737
1 changed files with 5 additions and 9 deletions

View File

@ -687,19 +687,15 @@ static void undomesh_to_editmesh(UndoMesh *um, Object *ob, BMEditMesh *em, Key *
.active_shapekey = um->shapenr,
}));
/* Normals should not be stored in the undo mesh, so recalculate them. The edit
* mesh is expected to have valid normals and there is no tracked dirty state. */
BLI_assert(BKE_mesh_vertex_normals_are_dirty(&um->me));
BM_mesh_normals_update(bm);
em_tmp = BKE_editmesh_create(bm);
*em = *em_tmp;
/* Normals should not be stored in the undo mesh, so recalculate them. The edit
* mesh is expected to have valid normals and there is no tracked dirty state. */
BLI_assert(BKE_mesh_vertex_normals_are_dirty(&um->me));
/* Calculate face normals and tessellation at once since it's multi-threaded. */
BKE_editmesh_looptri_calc_ex(em,
&(const struct BMeshCalcTessellation_Params){
.face_normals = true,
});
BKE_editmesh_looptri_and_normals_calc(em);
em->selectmode = um->selectmode;
bm->selectmode = um->selectmode;