diff options
author | Campbell Barton <campbell@blender.org> | 2022-01-22 10:02:12 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-01-22 10:02:12 +0300 |
commit | e88d966737c1e4c246f92d21fbe31c4eb702678c (patch) | |
tree | 1e6ffe9e2ff86041907d3fc1ea815fa2828f1a25 | |
parent | 25c99e72cdac0545ab5e2005b56a556313612758 (diff) |
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 d590e223daf6e20d462f2b197d32606d69873051.
-rw-r--r-- | source/blender/editors/mesh/editmesh_undo.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c index 5d573271ea3..59c357aa416 100644 --- a/source/blender/editors/mesh/editmesh_undo.c +++ b/source/blender/editors/mesh/editmesh_undo.c @@ -687,19 +687,15 @@ static void undomesh_to_editmesh(UndoMesh *um, Object *ob, BMEditMesh *em, Key * .active_shapekey = um->shapenr, })); + 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)); - BM_mesh_normals_update(bm); - - em_tmp = BKE_editmesh_create(bm); - *em = *em_tmp; /* 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; |