diff options
author | Hans Goudey <h.goudey@me.com> | 2021-07-02 19:37:01 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-07-02 19:37:01 +0300 |
commit | 5f8969bb4b43afd20cfe859ad5f00c3cdd28bcf1 (patch) | |
tree | d9601691f3167bf9714766bcc0cc4e3cf7d041d7 /source/blender/blenkernel/intern/mesh_runtime.c | |
parent | a1609340b436ff58e7e3522cc5e6d3ad1506b3ed (diff) |
Cleanup: Use const mesh to ensure BVH and triangulation cache
As noted in a comment now, these functions only update a cache, so they
don't change the logical state of the mesh, which is "it will have the
data when necessary." Using a const argument will help const correctness
when accessing an object's evaluated mesh.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_runtime.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_runtime.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c index 011dd7e25ee..6ae534012a9 100644 --- a/source/blender/blenkernel/intern/mesh_runtime.c +++ b/source/blender/blenkernel/intern/mesh_runtime.c @@ -158,8 +158,12 @@ static void mesh_runtime_looptri_recalc_isolated(void *userdata) BKE_mesh_runtime_looptri_recalc(mesh); } -/* This is a ported copy of dm_getLoopTriArray(dm). */ -const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh) +/** + * \note This function only fills a cache, and therefore the mesh argument can + * be considered logically const. Concurrent access is protected by a mutex. + * \note This is a ported copy of dm_getLoopTriArray(dm). + */ +const MLoopTri *BKE_mesh_runtime_looptri_ensure(const Mesh *mesh) { ThreadMutex *mesh_eval_mutex = (ThreadMutex *)mesh->runtime.eval_mutex; BLI_mutex_lock(mesh_eval_mutex); |