Refactor: remove cache parameters from `bvhtree_from_` functions

The `BVHCacheType bvh_cache_type` parameter defines specific
`BVHTrees` that cannot be customized.

So it doesn't make sense to pass this value to any
`*bvhtree_from_[...]_ex` function as the `BVHTrees` created in these
cases are custom and cannot be saved in the cache.

This also resulted in a nice cleanup in the code.

Differential Revision: https://developer.blender.org/D14479
This commit is contained in:
Germano Cavalcante 2022-04-05 18:44:52 -03:00 committed by Germano Cavalcante
parent bb7e3c2b56
commit 684b95804e
4 changed files with 86 additions and 302 deletions

View File

@ -113,9 +113,7 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
float epsilon,
int tree_type,
int axis,
BVHCacheType bvh_cache_type,
struct BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex);
const bool isolate);
/**
* Builds a BVH-tree where nodes are the given vertices (NOTE: does not copy given `vert`!).
@ -133,9 +131,7 @@ BVHTree *bvhtree_from_mesh_verts_ex(struct BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
BVHCacheType bvh_cache_type,
struct BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex);
const bool isolate);
BVHTree *bvhtree_from_editmesh_edges(
BVHTreeFromEditMesh *data, struct BMEditMesh *em, float epsilon, int tree_type, int axis);
@ -150,9 +146,7 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
float epsilon,
int tree_type,
int axis,
BVHCacheType bvh_cache_type,
struct BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex);
const bool isolate);
/**
* Builds a BVH-tree where nodes are the given edges.
@ -173,9 +167,7 @@ BVHTree *bvhtree_from_mesh_edges_ex(struct BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
BVHCacheType bvh_cache_type,
struct BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex);
const bool isolate);
/**
* Builds a BVH-tree where nodes are the given tessellated faces
@ -197,9 +189,7 @@ BVHTree *bvhtree_from_mesh_faces_ex(struct BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
BVHCacheType bvh_cache_type,
struct BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex);
const bool isolate);
BVHTree *bvhtree_from_editmesh_looptri(
BVHTreeFromEditMesh *data, struct BMEditMesh *em, float epsilon, int tree_type, int axis);
@ -214,9 +204,7 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
float epsilon,
int tree_type,
int axis,
BVHCacheType bvh_cache_type,
struct BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex);
const bool isolate);
/**
* Builds a BVH-tree where nodes are the looptri faces of the given mesh.
@ -236,9 +224,7 @@ BVHTree *bvhtree_from_mesh_looptri_ex(struct BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
BVHCacheType bvh_cache_type,
struct BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex);
const bool isolate);
/**
* Builds or queries a BVH-cache for the cache BVH-tree of the request type.

View File

@ -735,38 +735,16 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
float epsilon,
int tree_type,
int axis,
const BVHCacheType bvh_cache_type,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
const bool isolate)
{
BVHTree *tree = nullptr;
tree = bvhtree_from_editmesh_verts_create_tree(
epsilon, tree_type, axis, em, verts_mask, verts_num_active);
if (bvh_cache_p) {
bool lock_started = false;
data->cached = bvhcache_find(
bvh_cache_p, bvh_cache_type, &data->tree, &lock_started, mesh_eval_mutex);
if (data->cached == false) {
tree = bvhtree_from_editmesh_verts_create_tree(
epsilon, tree_type, axis, em, verts_mask, verts_num_active);
bvhtree_balance(tree, true);
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(*bvh_cache_p, tree, bvh_cache_type);
data->cached = true;
}
bvhcache_unlock(*bvh_cache_p, lock_started);
}
else {
tree = bvhtree_from_editmesh_verts_create_tree(
epsilon, tree_type, axis, em, verts_mask, verts_num_active);
bvhtree_balance(tree, false);
}
bvhtree_balance(tree, isolate);
if (data) {
bvhtree_from_editmesh_setup_data(tree, BVHTREE_FROM_EM_VERTS, em, data);
data->cached = bvh_cache_p != nullptr;
}
return tree;
@ -775,8 +753,7 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data,
BVHTree *bvhtree_from_editmesh_verts(
BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis)
{
return bvhtree_from_editmesh_verts_ex(
data, em, nullptr, -1, epsilon, tree_type, axis, BVHTREE_FROM_VERTS, nullptr, nullptr);
return bvhtree_from_editmesh_verts_ex(data, em, nullptr, -1, epsilon, tree_type, axis, false);
}
BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
@ -788,41 +765,19 @@ BVHTree *bvhtree_from_mesh_verts_ex(BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
const BVHCacheType bvh_cache_type,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
const bool isolate)
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
tree = bvhtree_from_mesh_verts_create_tree(
epsilon, tree_type, axis, vert, verts_num, verts_mask, verts_num_active);
if (in_cache == false) {
tree = bvhtree_from_mesh_verts_create_tree(
epsilon, tree_type, axis, vert, verts_num, verts_mask, verts_num_active);
bvhtree_balance(tree, bvh_cache_p != nullptr);
if (bvh_cache_p) {
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
BVHCache *bvh_cache = *bvh_cache_p;
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
in_cache = true;
}
}
if (bvh_cache_p) {
bvhcache_unlock(*bvh_cache_p, lock_started);
}
bvhtree_balance(tree, isolate);
if (data) {
/* Setup BVHTreeFromMesh */
bvhtree_from_mesh_setup_data(
tree, BVHTREE_FROM_VERTS, vert, nullptr, nullptr, nullptr, nullptr, nullptr, data);
data->vert_allocated = vert_allocated;
data->cached = in_cache;
}
return tree;
@ -918,37 +873,16 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
float epsilon,
int tree_type,
int axis,
const BVHCacheType bvh_cache_type,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
const bool isolate)
{
BVHTree *tree = nullptr;
tree = bvhtree_from_editmesh_edges_create_tree(
epsilon, tree_type, axis, em, edges_mask, edges_num_active);
if (bvh_cache_p) {
bool lock_started = false;
data->cached = bvhcache_find(
bvh_cache_p, bvh_cache_type, &data->tree, &lock_started, mesh_eval_mutex);
BVHCache *bvh_cache = *bvh_cache_p;
if (data->cached == false) {
tree = bvhtree_from_editmesh_edges_create_tree(
epsilon, tree_type, axis, em, edges_mask, edges_num_active);
bvhtree_balance(tree, true);
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
data->cached = true;
}
bvhcache_unlock(bvh_cache, lock_started);
}
else {
tree = bvhtree_from_editmesh_edges_create_tree(
epsilon, tree_type, axis, em, edges_mask, edges_num_active);
bvhtree_balance(tree, false);
}
bvhtree_balance(tree, isolate);
if (data) {
bvhtree_from_editmesh_setup_data(tree, BVHTREE_FROM_EM_EDGES, em, data);
data->cached = bvh_cache_p != nullptr;
}
return tree;
@ -957,8 +891,7 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data,
BVHTree *bvhtree_from_editmesh_edges(
BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis)
{
return bvhtree_from_editmesh_edges_ex(
data, em, nullptr, -1, epsilon, tree_type, axis, BVHTREE_FROM_VERTS, nullptr, nullptr);
return bvhtree_from_editmesh_edges_ex(data, em, nullptr, -1, epsilon, tree_type, axis, false);
}
BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
@ -972,38 +905,13 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
const BVHCacheType bvh_cache_type,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
const bool isolate)
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
tree = bvhtree_from_mesh_edges_create_tree(
vert, edge, edges_num, edges_mask, edges_num_active, epsilon, tree_type, axis);
if (in_cache == false) {
tree = bvhtree_from_mesh_edges_create_tree(
vert, edge, edges_num, edges_mask, edges_num_active, epsilon, tree_type, axis);
if (bvh_cache_p) {
bvhtree_balance(tree, true);
BVHCache *bvh_cache = *bvh_cache_p;
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
in_cache = true;
}
else {
bvhtree_balance(tree, false);
}
}
if (bvh_cache_p) {
bvhcache_unlock(*bvh_cache_p, lock_started);
}
bvhtree_balance(tree, isolate);
if (data) {
/* Setup BVHTreeFromMesh */
@ -1011,7 +919,6 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
tree, BVHTREE_FROM_EDGES, vert, edge, nullptr, nullptr, nullptr, nullptr, data);
data->vert_allocated = vert_allocated;
data->vert_allocated = edge_allocated;
data->cached = in_cache;
}
return tree;
@ -1081,34 +988,13 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
const BVHCacheType bvh_cache_type,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
const bool isolate)
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
tree = bvhtree_from_mesh_faces_create_tree(
epsilon, tree_type, axis, vert, face, numFaces, faces_mask, faces_num_active);
if (in_cache == false) {
tree = bvhtree_from_mesh_faces_create_tree(
epsilon, tree_type, axis, vert, face, numFaces, faces_mask, faces_num_active);
bvhtree_balance(tree, bvh_cache_p != nullptr);
if (bvh_cache_p) {
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
BVHCache *bvh_cache = *bvh_cache_p;
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
in_cache = true;
}
}
if (bvh_cache_p) {
bvhcache_unlock(*bvh_cache_p, lock_started);
}
bvhtree_balance(tree, isolate);
if (data) {
/* Setup BVHTreeFromMesh */
@ -1116,7 +1002,6 @@ BVHTree *bvhtree_from_mesh_faces_ex(BVHTreeFromMesh *data,
tree, BVHTREE_FROM_FACES, vert, nullptr, face, nullptr, nullptr, nullptr, data);
data->vert_allocated = vert_allocated;
data->face_allocated = face_allocated;
data->cached = in_cache;
}
return tree;
@ -1229,39 +1114,19 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
float epsilon,
int tree_type,
int axis,
const BVHCacheType bvh_cache_type,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
const bool isolate)
{
/* BMESH specific check that we have tessfaces,
* we _could_ tessellate here but rather not - campbell */
BVHTree *tree = nullptr;
if (bvh_cache_p) {
bool lock_started = false;
bool in_cache = bvhcache_find(
bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
BVHCache *bvh_cache = *bvh_cache_p;
if (in_cache == false) {
tree = bvhtree_from_editmesh_looptri_create_tree(
epsilon, tree_type, axis, em, looptri_mask, looptri_num_active);
bvhtree_balance(tree, true);
tree = bvhtree_from_editmesh_looptri_create_tree(
epsilon, tree_type, axis, em, looptri_mask, looptri_num_active);
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
}
bvhcache_unlock(bvh_cache, lock_started);
}
else {
tree = bvhtree_from_editmesh_looptri_create_tree(
epsilon, tree_type, axis, em, looptri_mask, looptri_num_active);
bvhtree_balance(tree, false);
}
bvhtree_balance(tree, isolate);
if (data) {
bvhtree_from_editmesh_setup_data(tree, BVHTREE_FROM_EM_LOOPTRI, em, data);
data->cached = bvh_cache_p != nullptr;
}
return tree;
}
@ -1269,8 +1134,7 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data,
BVHTree *bvhtree_from_editmesh_looptri(
BVHTreeFromEditMesh *data, BMEditMesh *em, float epsilon, int tree_type, int axis)
{
return bvhtree_from_editmesh_looptri_ex(
data, em, nullptr, -1, epsilon, tree_type, axis, BVHTREE_FROM_VERTS, nullptr, nullptr);
return bvhtree_from_editmesh_looptri_ex(data, em, nullptr, -1, epsilon, tree_type, axis, false);
}
BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data,
@ -1286,41 +1150,20 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data,
float epsilon,
int tree_type,
int axis,
const BVHCacheType bvh_cache_type,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
const bool isolate)
{
bool in_cache = false;
bool lock_started = false;
BVHTree *tree = nullptr;
if (bvh_cache_p) {
in_cache = bvhcache_find(bvh_cache_p, bvh_cache_type, &tree, &lock_started, mesh_eval_mutex);
}
tree = bvhtree_from_mesh_looptri_create_tree(epsilon,
tree_type,
axis,
vert,
mloop,
looptri,
looptri_num,
looptri_mask,
looptri_num_active);
if (in_cache == false) {
/* Setup BVHTreeFromMesh */
tree = bvhtree_from_mesh_looptri_create_tree(epsilon,
tree_type,
axis,
vert,
mloop,
looptri,
looptri_num,
looptri_mask,
looptri_num_active);
bvhtree_balance(tree, bvh_cache_p != nullptr);
if (bvh_cache_p) {
BVHCache *bvh_cache = *bvh_cache_p;
bvhcache_insert(bvh_cache, tree, bvh_cache_type);
in_cache = true;
}
}
if (bvh_cache_p) {
bvhcache_unlock(*bvh_cache_p, lock_started);
}
bvhtree_balance(tree, isolate);
if (data) {
/* Setup BVHTreeFromMesh */
@ -1329,7 +1172,6 @@ BVHTree *bvhtree_from_mesh_looptri_ex(BVHTreeFromMesh *data,
data->vert_allocated = vert_allocated;
data->loop_allocated = loop_allocated;
data->looptri_allocated = looptri_allocated;
data->cached = in_cache;
}
return tree;
@ -1436,13 +1278,19 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
BKE_mesh_vertex_normals_ensure(mesh),
data);
data->cached = bvhcache_find(bvh_cache_p, bvh_cache_type, &data->tree, nullptr, nullptr);
bool lock_started = false;
data->cached = bvhcache_find(
bvh_cache_p, bvh_cache_type, &data->tree, &lock_started, mesh_eval_mutex);
if (data->cached) {
BLI_assert(lock_started == false);
/* NOTE: #data->tree can be nullptr. */
return data->tree;
}
/* Create BVHTree. */
switch (bvh_cache_type) {
case BVHTREE_FROM_VERTS:
case BVHTREE_FROM_LOOSEVERTS: {
@ -1464,9 +1312,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
0.0f,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
lock_started);
if (loose_verts_mask != nullptr) {
MEM_freeN(loose_verts_mask);
@ -1494,9 +1340,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
0.0,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
lock_started);
if (loose_edges_mask != nullptr) {
MEM_freeN(loose_edges_mask);
@ -1518,14 +1362,11 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
0.0,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
lock_started);
} break;
case BVHTREE_FROM_LOOPTRI:
case BVHTREE_FROM_LOOPTRI_NO_HIDDEN: {
const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(mesh);
int looptri_len = BKE_mesh_runtime_looptri_len(mesh);
int looptri_mask_active_len = -1;
@ -1540,7 +1381,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
false,
mesh->mloop,
false,
mlooptri,
data->looptri,
looptri_len,
false,
looptri_mask,
@ -1548,9 +1389,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
0.0,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
lock_started);
if (looptri_mask != nullptr) {
MEM_freeN(looptri_mask);
@ -1564,8 +1403,12 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
break;
}
/* Even if nullptr, the tree has been added to the cache. */
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
BLI_assert(data->cached == false);
data->cached = true;
bvhcache_insert(*bvh_cache_p, data->tree, bvh_cache_type);
bvhcache_unlock(*bvh_cache_p, lock_started);
#ifdef DEBUG
if (data->tree != nullptr) {
@ -1587,52 +1430,32 @@ BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data,
BVHCache **bvh_cache_p,
ThreadMutex *mesh_eval_mutex)
{
bool lock_started = false;
bvhtree_from_editmesh_setup_data(nullptr, bvh_cache_type, em, data);
if (bvh_cache_p) {
data->cached = bvhcache_find(bvh_cache_p, bvh_cache_type, &data->tree, nullptr, nullptr);
data->cached = bvhcache_find(
bvh_cache_p, bvh_cache_type, &data->tree, &lock_started, mesh_eval_mutex);
if (data->cached) {
BLI_assert(lock_started == false);
return data->tree;
}
}
switch (bvh_cache_type) {
case BVHTREE_FROM_EM_VERTS:
data->tree = bvhtree_from_editmesh_verts_ex(nullptr,
em,
nullptr,
-1,
0.0f,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
data->tree = bvhtree_from_editmesh_verts_ex(
nullptr, em, nullptr, -1, 0.0f, tree_type, 6, lock_started);
break;
case BVHTREE_FROM_EM_EDGES:
data->tree = bvhtree_from_editmesh_edges_ex(nullptr,
em,
nullptr,
-1,
0.0f,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
data->tree = bvhtree_from_editmesh_edges_ex(
nullptr, em, nullptr, -1, 0.0f, tree_type, 6, lock_started);
break;
case BVHTREE_FROM_EM_LOOPTRI:
data->tree = bvhtree_from_editmesh_looptri_ex(nullptr,
em,
nullptr,
-1,
0.0f,
tree_type,
6,
bvh_cache_type,
bvh_cache_p,
mesh_eval_mutex);
data->tree = bvhtree_from_editmesh_looptri_ex(
nullptr, em, nullptr, -1, 0.0f, tree_type, 6, lock_started);
break;
case BVHTREE_FROM_VERTS:
case BVHTREE_FROM_EDGES:
@ -1646,8 +1469,14 @@ BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data,
break;
}
/* Even if the tree is nullptr, it has been added to the cache if available. */
data->cached = bvh_cache_p != nullptr;
if (bvh_cache_p) {
/* Save on cache for later use */
// printf("BVHTree built and saved on cache\n");
BLI_assert(data->cached == false);
data->cached = true;
bvhcache_insert(*bvh_cache_p, data->tree, bvh_cache_type);
bvhcache_unlock(*bvh_cache_p, lock_started);
}
#ifdef DEBUG
if (data->tree != nullptr) {

View File

@ -1516,9 +1516,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
0.0,
2,
6,
0,
NULL,
NULL);
false);
}
MEM_freeN(verts_active);
@ -1560,9 +1558,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
0.0,
2,
6,
0,
NULL,
NULL);
false);
}
MEM_freeN(looptri_active);

View File

@ -901,16 +901,7 @@ static bool raycastEditMesh(SnapObjectContext *sctx,
sctx->callbacks.edit_mesh.test_face_fn,
sctx->callbacks.edit_mesh.user_data);
bvhtree_from_editmesh_looptri_ex(treedata,
em,
elem_mask,
looptri_num_active,
0.0f,
4,
6,
BVHTREE_FROM_EM_LOOPTRI,
nullptr,
nullptr);
bvhtree_from_editmesh_looptri_ex(treedata, em, elem_mask, looptri_num_active, 0.0f, 4, 6, false);
MEM_freeN(elem_mask);
}
@ -2574,16 +2565,7 @@ static short snapEditMesh(SnapObjectContext *sctx,
(bool (*)(BMElem *, void *))sctx->callbacks.edit_mesh.test_vert_fn,
sctx->callbacks.edit_mesh.user_data);
bvhtree_from_editmesh_verts_ex(&treedata,
em,
verts_mask,
verts_num_active,
0.0f,
2,
6,
BVHTREE_FROM_VERTS,
nullptr,
nullptr);
bvhtree_from_editmesh_verts_ex(&treedata, em, verts_mask, verts_num_active, 0.0f, 2, 6, false);
MEM_freeN(verts_mask);
}
else {
@ -2615,16 +2597,7 @@ static short snapEditMesh(SnapObjectContext *sctx,
(bool (*)(BMElem *, void *))sctx->callbacks.edit_mesh.test_edge_fn,
sctx->callbacks.edit_mesh.user_data);
bvhtree_from_editmesh_edges_ex(&treedata,
em,
edges_mask,
edges_num_active,
0.0f,
2,
6,
BVHTREE_FROM_VERTS,
nullptr,
nullptr);
bvhtree_from_editmesh_edges_ex(&treedata, em, edges_mask, edges_num_active, 0.0f, 2, 6, false);
MEM_freeN(edges_mask);
}
else {