Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-10-09 03:04:24 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-10-09 14:23:41 +0300
commit31d3d434aa07fbbe17bdf2e822c51b7d85344a89 (patch)
treebc1ac458eb56262c4fca47829f6ea8e4f2cd01a4
parentf39babc9d66896cf042c864f634620ded0b0ead0 (diff)
Correct own error in editmesh bvh
Flag mix-up and uninitialized var.
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c26
-rw-r--r--source/blender/editors/transform/transform_snap.c3
2 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index d48635d21d9..9004985aebd 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -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 */
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index f6040732983..6075261fdc7 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -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) {