Correct own error in editmesh bvh
Flag mix-up and uninitialized var.
This commit is contained in:
parent
e9b9b883fb
commit
ff7effdc04
|
@ -597,7 +597,8 @@ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *dm, float e
|
|||
|
||||
static BVHTree *bvhtree_from_mesh_faces_create_tree(
|
||||
float epsilon, int tree_type, int axis,
|
||||
BMEditMesh *em, MVert *vert, MFace *face, const int numFaces,
|
||||
BMEditMesh *em, const bool em_all,
|
||||
MVert *vert, MFace *face, const int numFaces,
|
||||
BLI_bitmap *mask, int numFaces_active)
|
||||
{
|
||||
BVHTree *tree = NULL;
|
||||
|
@ -646,7 +647,7 @@ static BVHTree *bvhtree_from_mesh_faces_create_tree(
|
|||
insert = insert_prev;
|
||||
}
|
||||
else if (insert) {
|
||||
if (tree_type == BVHTREE_FROM_FACES_EDITMESH_ALL) {
|
||||
if (em_all) {
|
||||
/* pass */
|
||||
}
|
||||
else if (BM_elem_flag_test(f, BM_ELEM_SELECT) || BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
|
||||
|
@ -786,7 +787,10 @@ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *dm, float e
|
|||
BLI_assert(!(numFaces == 0 && dm->getNumPolys(dm) != 0));
|
||||
}
|
||||
|
||||
tree = bvhtree_from_mesh_faces_create_tree(epsilon, tree_type, axis, em, vert, face, numFaces, NULL, -1);
|
||||
tree = bvhtree_from_mesh_faces_create_tree(
|
||||
epsilon, tree_type, axis,
|
||||
em, (bvhcache_type == BVHTREE_FROM_FACES_EDITMESH_ALL),
|
||||
vert, face, numFaces, NULL, -1);
|
||||
if (tree) {
|
||||
/* Save on cache for later use */
|
||||
/* printf("BVHTree built and saved on cache\n"); */
|
||||
|
@ -818,7 +822,9 @@ BVHTree *bvhtree_from_mesh_faces_ex(
|
|||
BLI_bitmap *mask, int numFaces_active, float epsilon, int tree_type, int axis)
|
||||
{
|
||||
BVHTree *tree = bvhtree_from_mesh_faces_create_tree(
|
||||
epsilon, tree_type, axis, NULL, vert, face, numFaces,
|
||||
epsilon, tree_type, axis,
|
||||
NULL, false,
|
||||
vert, face, numFaces,
|
||||
mask, numFaces_active);
|
||||
|
||||
/* Setup BVHTreeFromMesh */
|
||||
|
@ -837,7 +843,8 @@ BVHTree *bvhtree_from_mesh_faces_ex(
|
|||
|
||||
static BVHTree *bvhtree_from_mesh_looptri_create_tree(
|
||||
float epsilon, int tree_type, int axis,
|
||||
BMEditMesh *em, const MVert *vert, const MLoop *mloop, const MLoopTri *looptri, const int looptri_num,
|
||||
BMEditMesh *em, const bool em_all,
|
||||
const MVert *vert, const MLoop *mloop, const MLoopTri *looptri, const int looptri_num,
|
||||
BLI_bitmap *mask, int looptri_num_active)
|
||||
{
|
||||
BVHTree *tree = NULL;
|
||||
|
@ -886,7 +893,7 @@ static BVHTree *bvhtree_from_mesh_looptri_create_tree(
|
|||
insert = insert_prev;
|
||||
}
|
||||
else if (insert) {
|
||||
if (tree_type == BVHTREE_FROM_FACES_EDITMESH_ALL) {
|
||||
if (em_all) {
|
||||
/* pass */
|
||||
}
|
||||
else if (BM_elem_flag_test(f, BM_ELEM_SELECT) || BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
|
||||
|
@ -1054,7 +1061,8 @@ BVHTree *bvhtree_from_mesh_looptri(BVHTreeFromMesh *data, DerivedMesh *dm, float
|
|||
}
|
||||
|
||||
tree = bvhtree_from_mesh_looptri_create_tree(
|
||||
epsilon, tree_type, axis, em,
|
||||
epsilon, tree_type, axis,
|
||||
em, (bvhcache_type == BVHTREE_FROM_FACES_EDITMESH_ALL),
|
||||
mvert, mloop, looptri, looptri_num, NULL, -1);
|
||||
if (tree) {
|
||||
/* Save on cache for later use */
|
||||
|
@ -1087,7 +1095,9 @@ BVHTree *bvhtree_from_mesh_looptri_ex(
|
|||
float epsilon, int tree_type, int axis)
|
||||
{
|
||||
BVHTree *tree = bvhtree_from_mesh_looptri_create_tree(
|
||||
epsilon, tree_type, axis, NULL, vert, mloop, looptri, looptri_num,
|
||||
epsilon, tree_type, axis,
|
||||
NULL, false,
|
||||
vert, mloop, looptri, looptri_num,
|
||||
mask, looptri_num_active);
|
||||
|
||||
/* Setup BVHTreeFromMesh */
|
||||
|
|
|
@ -1549,6 +1549,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
|
|||
len_diff = 0.0f; /* In case BVHTree would fail for some reason... */
|
||||
|
||||
treeData.em_evil = em;
|
||||
treeData.em_evil_all = false;
|
||||
bvhtree_from_mesh_looptri(&treeData, dm, 0.0f, 2, 6);
|
||||
if (treeData.tree != NULL) {
|
||||
nearest.index = -1;
|
||||
|
@ -1591,6 +1592,7 @@ static bool snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMes
|
|||
}
|
||||
|
||||
treeData.em_evil = em;
|
||||
treeData.em_evil_all = false;
|
||||
bvhtree_from_mesh_looptri(&treeData, dm, 0.0f, 4, 6);
|
||||
|
||||
hit.index = -1;
|
||||
|
@ -2177,6 +2179,7 @@ static bool peelDerivedMesh(
|
|||
struct PeelRayCast_Data data;
|
||||
|
||||
data.bvhdata.em_evil = em;
|
||||
data.bvhdata.em_evil_all = false;
|
||||
bvhtree_from_mesh_looptri(&data.bvhdata, dm, 0.0f, 4, 6);
|
||||
|
||||
if (data.bvhdata.tree != NULL) {
|
||||
|
|
Loading…
Reference in New Issue