From 6a3c3c77b3ebdbcd44559bf91ea7d5cf3c5e4953 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 19 Apr 2022 17:08:02 -0500 Subject: Mesh: Avoid unnecessary normal calculation and dirty tags This is mostly a cleanup to avoid hardcoding the eager calculation of normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals` and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh is newly created and already has dirty normals anyway. This reduces boilerplate code and makes the "dirty by default" state more clear. Any regressions from this commit should be easy to fix, though the lazy calculation is solid enough that none are expected. --- source/blender/geometry/intern/mesh_merge_by_distance.cc | 4 ---- source/blender/geometry/intern/realize_instances.cc | 2 -- 2 files changed, 6 deletions(-) (limited to 'source/blender/geometry') diff --git a/source/blender/geometry/intern/mesh_merge_by_distance.cc b/source/blender/geometry/intern/mesh_merge_by_distance.cc index 9bb1cbb324e..e45b84632ab 100644 --- a/source/blender/geometry/intern/mesh_merge_by_distance.cc +++ b/source/blender/geometry/intern/mesh_merge_by_distance.cc @@ -1580,10 +1580,6 @@ static Mesh *create_merged_mesh(const Mesh &mesh, BLI_assert((int)r_i == result_npolys); BLI_assert(loop_cur == result_nloops); - /* We could only update the normals of the elements in context, but the next modifier can make it - * dirty anyway which would make the work useless. */ - BKE_mesh_normals_tag_dirty(result); - return result; } diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc index 0a0f01c1ff2..f3f0e5b1fce 100644 --- a/source/blender/geometry/intern/realize_instances.cc +++ b/source/blender/geometry/intern/realize_instances.cc @@ -1015,8 +1015,6 @@ static void execute_realize_mesh_tasks(const RealizeInstancesOptions &options, if (vertex_ids) { vertex_ids.save(); } - - BKE_mesh_normals_tag_dirty(dst_mesh); } /** \} */ -- cgit v1.2.3