Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-20 01:08:02 +0300
committerHans Goudey <h.goudey@me.com>2022-04-20 01:08:02 +0300
commit6a3c3c77b3ebdbcd44559bf91ea7d5cf3c5e4953 (patch)
tree619854e36d34502c1f81f0fd1ec7b0454fecc5b3 /source/blender/blenkernel/intern/mesh.cc
parent9ec94c3882a414dc60dd17abfa12838f94f63c24 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.cc')
-rw-r--r--source/blender/blenkernel/intern/mesh.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 25d97d0bd3c..7f005fda6a5 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1112,6 +1112,9 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
mesh_ensure_cdlayers_primary(me_dst, do_tessface);
BKE_mesh_update_customdata_pointers(me_dst, false);
+ /* Expect that normals aren't copied at all, since the destination mesh is new. */
+ BLI_assert(BKE_mesh_vertex_normals_are_dirty(me_dst));
+
return me_dst;
}
@@ -1688,6 +1691,7 @@ void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys)
mul_m3_v3(m3, *lnors);
}
}
+ BKE_mesh_normals_tag_dirty(me);
}
void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)