diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 20:36:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 20:36:02 +0300 |
commit | 4f213c14953c182994dc3fe65e0602032733540e (patch) | |
tree | d951451166dc6de4ecd29fab4bcccca157189e4f /source/blender | |
parent | 305c455ffe36161baeb9495942808ddb7ac486bb (diff) |
Cleanup: naming (prefer len over num for new code)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_runtime.c | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mesh_types.h | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c index 96fc472ac8f..aebf03151d1 100644 --- a/source/blender/blenkernel/intern/mesh_runtime.c +++ b/source/blender/blenkernel/intern/mesh_runtime.c @@ -54,28 +54,28 @@ static ThreadRWMutex loops_cache_lock = PTHREAD_RWLOCK_INITIALIZER; static void mesh_ensure_looptri_data(Mesh *mesh) { const unsigned int totpoly = mesh->totpoly; - const int looptris_num = poly_to_tri_count(totpoly, mesh->totloop); + const int looptris_len = poly_to_tri_count(totpoly, mesh->totloop); BLI_assert(mesh->runtime.looptris.array_wip == NULL); SWAP(MLoopTri *, mesh->runtime.looptris.array, mesh->runtime.looptris.array_wip); - if ((looptris_num > mesh->runtime.looptris.num_alloc) || - (looptris_num < mesh->runtime.looptris.num_alloc * 2) || + if ((looptris_len > mesh->runtime.looptris.len_alloc) || + (looptris_len < mesh->runtime.looptris.len_alloc * 2) || (totpoly == 0)) { MEM_SAFE_FREE(mesh->runtime.looptris.array_wip); - mesh->runtime.looptris.num_alloc = 0; - mesh->runtime.looptris.num = 0; + mesh->runtime.looptris.len_alloc = 0; + mesh->runtime.looptris.len = 0; } if (totpoly) { if (mesh->runtime.looptris.array_wip == NULL) { - mesh->runtime.looptris.array_wip = MEM_malloc_arrayN(looptris_num, sizeof(*mesh->runtime.looptris.array_wip), __func__); - mesh->runtime.looptris.num_alloc = looptris_num; + mesh->runtime.looptris.array_wip = MEM_malloc_arrayN(looptris_len, sizeof(*mesh->runtime.looptris.array_wip), __func__); + mesh->runtime.looptris.len_alloc = looptris_len; } - mesh->runtime.looptris.num = looptris_num; + mesh->runtime.looptris.len = looptris_len; } } @@ -100,7 +100,7 @@ void BKE_mesh_runtime_looptri_recalc(Mesh *mesh) int BKE_mesh_runtime_looptri_len(const Mesh *mesh) { const int looptri_len = poly_to_tri_count(mesh->totpoly, mesh->totloop); - BLI_assert(ELEM(mesh->runtime.looptris.num, 0, looptri_len)); + BLI_assert(ELEM(mesh->runtime.looptris.len, 0, looptri_len)); return looptri_len; } @@ -114,7 +114,7 @@ const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh) BLI_rw_mutex_unlock(&loops_cache_lock); if (looptri != NULL) { - BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.num); + BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.len); } else { BLI_rw_mutex_lock(&loops_cache_lock, THREAD_LOCK_WRITE); diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index d90d5227e17..5ce24916c54 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -71,12 +71,12 @@ typedef struct EditMeshData { /** * \warning Typical access is done via #BKE_mesh_runtime_looptri_ensure, #BKE_mesh_runtime_looptri_len. */ -struct LooptrisData { +struct MLoopTri_Store { /* WARNING! swapping between array (ready-to-be-used data) and array_wip (where data is actually computed) * shall always be protected by same lock as one used for looptris computing. */ struct MLoopTri *array, *array_wip; - int num; - int num_alloc; + int len; + int len_alloc; }; /* not saved in file! */ @@ -89,7 +89,7 @@ typedef struct MeshRuntime { int64_t cd_dirty_loop; int64_t cd_dirty_poly; - struct LooptrisData looptris; + struct MLoopTri_Store looptris; /** 'BVHCache', for 'BKE_bvhutil.c' */ struct LinkNode *bvh_cache; |