From 81d1a88526e0afa08c58c1d8ac45e1a483ede03f Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 13 Jan 2022 12:50:55 -0600 Subject: Cleanup: Use helper functions to check if normals are dirty --- source/blender/blenkernel/intern/mesh_normals.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc index debb1f1e3de..08a17060549 100644 --- a/source/blender/blenkernel/intern/mesh_normals.cc +++ b/source/blender/blenkernel/intern/mesh_normals.cc @@ -356,8 +356,7 @@ static void mesh_calc_normals_poly_and_vertex(MVert *mvert, const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3] { - if (!(mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL || - mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL)) { + if (!(BKE_mesh_vertex_normals_are_dirty(mesh) || BKE_mesh_poly_normals_are_dirty(mesh))) { BLI_assert(CustomData_has_layer(&mesh->vdata, CD_NORMAL) || mesh->totvert == 0); return (const float(*)[3])CustomData_get_layer(&mesh->vdata, CD_NORMAL); } @@ -368,8 +367,7 @@ const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3] ThreadMutex *normals_mutex = (ThreadMutex *)mesh->runtime.normals_mutex; BLI_mutex_lock(normals_mutex); - if (!(mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL || - mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL)) { + if (!(BKE_mesh_vertex_normals_are_dirty(mesh) || BKE_mesh_poly_normals_are_dirty(mesh))) { BLI_assert(CustomData_has_layer(&mesh->vdata, CD_NORMAL)); BLI_mutex_unlock(normals_mutex); return (const float(*)[3])CustomData_get_layer(&mesh->vdata, CD_NORMAL); @@ -398,7 +396,7 @@ const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3] const float (*BKE_mesh_poly_normals_ensure(const Mesh *mesh))[3] { - if (!(mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL)) { + if (!BKE_mesh_poly_normals_are_dirty(mesh)) { BLI_assert(CustomData_has_layer(&mesh->pdata, CD_NORMAL) || mesh->totpoly == 0); return (const float(*)[3])CustomData_get_layer(&mesh->pdata, CD_NORMAL); } @@ -409,7 +407,7 @@ const float (*BKE_mesh_poly_normals_ensure(const Mesh *mesh))[3] ThreadMutex *normals_mutex = (ThreadMutex *)mesh->runtime.normals_mutex; BLI_mutex_lock(normals_mutex); - if (!(mesh->runtime.cd_dirty_poly & CD_MASK_NORMAL)) { + if (!BKE_mesh_poly_normals_are_dirty(mesh)) { BLI_assert(CustomData_has_layer(&mesh->pdata, CD_NORMAL)); BLI_mutex_unlock(normals_mutex); return (const float(*)[3])CustomData_get_layer(&mesh->pdata, CD_NORMAL); -- cgit v1.2.3