Cleanup: mesh_runtime naming
- BKE_mesh_get_looptri_num -> BKE_mesh_runtime_looptri_len - BKE_mesh_runtime_recalc_looptri -> BKE_mesh_runtime_looptri_recalc - BKE_mesh_get_looptri_array -> BKE_mesh_runtime_looptri_ensure
This commit is contained in:
@@ -193,9 +193,9 @@ void BKE_mesh_apply_vert_coords(struct Mesh *mesh, float (*vertCoords)[3]);
|
||||
|
||||
/* *** mesh_runtime.c *** */
|
||||
|
||||
void BKE_mesh_runtime_recalc_looptri(struct Mesh *mesh);
|
||||
int BKE_mesh_get_looptri_num(struct Mesh *mesh);
|
||||
const struct MLoopTri *BKE_mesh_get_looptri_array(struct Mesh *mesh);
|
||||
int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh);
|
||||
void BKE_mesh_runtime_looptri_recalc(struct Mesh *mesh);
|
||||
const struct MLoopTri *BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh);
|
||||
|
||||
/* *** mesh_evaluate.c *** */
|
||||
|
||||
|
||||
@@ -1184,14 +1184,14 @@ BVHTree *BKE_bvhtree_from_mesh_looptri(
|
||||
|
||||
mvert = mesh->mvert;
|
||||
mloop = mesh->mloop;
|
||||
looptri = BKE_mesh_get_looptri_array(mesh);
|
||||
looptri = BKE_mesh_runtime_looptri_ensure(mesh);
|
||||
|
||||
/* Not in cache */
|
||||
if (tree == NULL) {
|
||||
BLI_rw_mutex_lock(&cache_rwlock, THREAD_LOCK_WRITE);
|
||||
tree = bvhcache_find(mesh->runtime.bvh_cache, BVHTREE_FROM_LOOPTRI);
|
||||
if (tree == NULL) {
|
||||
int looptri_num = BKE_mesh_get_looptri_num(mesh);
|
||||
int looptri_num = BKE_mesh_runtime_looptri_len(mesh);
|
||||
|
||||
/* this assert checks we have looptris,
|
||||
* if not caller should use DM_ensure_looptri() */
|
||||
|
||||
@@ -80,7 +80,7 @@ static void mesh_ensure_looptri_data(Mesh *mesh)
|
||||
}
|
||||
|
||||
/* This is a ported copy of CDDM_recalc_looptri(dm). */
|
||||
void BKE_mesh_runtime_recalc_looptri(Mesh *mesh)
|
||||
void BKE_mesh_runtime_looptri_recalc(Mesh *mesh)
|
||||
{
|
||||
mesh_ensure_looptri_data(mesh);
|
||||
BLI_assert(mesh->totpoly == 0 || mesh->runtime.looptris.array_wip != NULL);
|
||||
@@ -97,15 +97,15 @@ void BKE_mesh_runtime_recalc_looptri(Mesh *mesh)
|
||||
}
|
||||
|
||||
/* This is a ported copy of dm_getNumLoopTri(dm). */
|
||||
int BKE_mesh_get_looptri_num(Mesh *mesh)
|
||||
int BKE_mesh_runtime_looptri_len(const Mesh *mesh)
|
||||
{
|
||||
const int numlooptris = poly_to_tri_count(mesh->totpoly, mesh->totloop);
|
||||
BLI_assert(ELEM(mesh->runtime.looptris.num, 0, numlooptris));
|
||||
return numlooptris;
|
||||
const int looptri_len = poly_to_tri_count(mesh->totpoly, mesh->totloop);
|
||||
BLI_assert(ELEM(mesh->runtime.looptris.num, 0, looptri_len));
|
||||
return looptri_len;
|
||||
}
|
||||
|
||||
/* This is a ported copy of dm_getLoopTriArray(dm). */
|
||||
const MLoopTri *BKE_mesh_get_looptri_array(Mesh *mesh)
|
||||
const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh)
|
||||
{
|
||||
MLoopTri *looptri;
|
||||
|
||||
@@ -114,14 +114,14 @@ const MLoopTri *BKE_mesh_get_looptri_array(Mesh *mesh)
|
||||
BLI_rw_mutex_unlock(&loops_cache_lock);
|
||||
|
||||
if (looptri != NULL) {
|
||||
BLI_assert(BKE_mesh_get_looptri_num(mesh) == mesh->runtime.looptris.num);
|
||||
BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.num);
|
||||
}
|
||||
else {
|
||||
BLI_rw_mutex_lock(&loops_cache_lock, THREAD_LOCK_WRITE);
|
||||
/* We need to ensure array is still NULL inside mutex-protected code, some other thread might have already
|
||||
* recomputed those looptris. */
|
||||
if (mesh->runtime.looptris.array == NULL) {
|
||||
BKE_mesh_runtime_recalc_looptri(mesh);
|
||||
BKE_mesh_runtime_looptri_recalc(mesh);
|
||||
}
|
||||
looptri = mesh->runtime.looptris.array;
|
||||
BLI_rw_mutex_unlock(&loops_cache_lock);
|
||||
|
||||
@@ -1463,7 +1463,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
|
||||
Mesh *me = mdb->cagemesh;
|
||||
mdb->cagemesh_cache.mpoly = me->mpoly;
|
||||
mdb->cagemesh_cache.mloop = me->mloop;
|
||||
mdb->cagemesh_cache.looptri = BKE_mesh_get_looptri_array(me);
|
||||
mdb->cagemesh_cache.looptri = BKE_mesh_runtime_looptri_ensure(me);
|
||||
mdb->cagemesh_cache.poly_nors = CustomData_get_layer(&me->pdata, CD_NORMAL); /* can be NULL */
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ typedef struct EditMeshData {
|
||||
|
||||
|
||||
/**
|
||||
* \warning Typical access is done via #BKE_mesh_get_looptri_array, #BKE_mesh_get_looptri_num.
|
||||
* \warning Typical access is done via #BKE_mesh_runtime_looptri_ensure, #BKE_mesh_runtime_looptri_len.
|
||||
*/
|
||||
struct LooptrisData {
|
||||
/* WARNING! swapping between array (ready-to-be-used data) and array_wip (where data is actually computed)
|
||||
|
||||
Reference in New Issue
Block a user