diff options
author | Hans Goudey <h.goudey@me.com> | 2022-06-23 20:00:25 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-06-23 20:00:25 +0300 |
commit | 54182e4925de4ee7e49e4351479e79cb257acc73 (patch) | |
tree | d598250e653ee2e61f875b113ce4f41f87e4a084 /source/blender/blenkernel/intern/mesh.cc | |
parent | 3e5a4d14124029dd3ccb111de2db299bb405d668 (diff) |
Mesh: Add an explicit "positions changed" function
We store various lazily calculated caches on meshes, some of which
depend on the vertex positions staying the same. The current API to
invalidate these caches is a bit confusing. With an explicit set of
functions modeled after the functions in `BKE_node_tree_update.h`,
it becomes clear which function to call. This may become more
important if more lazy caches are added in the future.
Differential Revision: https://developer.blender.org/D14760
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.cc')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index 7c86aff6624..ffbd824712a 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -1684,7 +1684,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); + BKE_mesh_tag_coords_changed(me); } void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys) @@ -1706,6 +1706,7 @@ void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys) } } } + BKE_mesh_tag_coords_changed_uniformly(me); } void BKE_mesh_tessface_ensure(Mesh *mesh) @@ -1904,7 +1905,7 @@ void BKE_mesh_vert_coords_apply(Mesh *mesh, const float (*vert_coords)[3]) for (int i = 0; i < mesh->totvert; i++, mv++) { copy_v3_v3(mv->co, vert_coords[i]); } - BKE_mesh_normals_tag_dirty(mesh); + BKE_mesh_tag_coords_changed(mesh); } void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh, @@ -1918,7 +1919,7 @@ void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh, for (int i = 0; i < mesh->totvert; i++, mv++) { mul_v3_m4v3(mv->co, mat, vert_coords[i]); } - BKE_mesh_normals_tag_dirty(mesh); + BKE_mesh_tag_coords_changed(mesh); } void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spacearr) |