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>2014-05-07 08:13:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-07 08:14:27 +0400
commit0710d9dfd17bc9dcc90ac4de2d9f652ae0714a2b (patch)
tree31a37135a18eae628ec4b9d7b736536e28565fa2 /source/blender/editors/armature/meshlaplacian.c
parent5e3509e2d23c76aef1cd2b658f919f10d9c3d348 (diff)
Fix crash binding mdef with no faces
Diffstat (limited to 'source/blender/editors/armature/meshlaplacian.c')
-rw-r--r--source/blender/editors/armature/meshlaplacian.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index c2a54c6d9f8..56e7bde0081 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1209,7 +1209,7 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
}
}
-static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float *co1, float *co2)
+static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, const float co1[3], const float co2[3])
{
MDefBoundIsect *isect;
BVHTreeRayHit hit;
@@ -1218,14 +1218,23 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
void *data[3] = {mdb->cagedm->getTessFaceArray(mdb->cagedm), mdb, &isect_mdef};
MFace *mface1 = data[0], *mface;
float vert[4][3], len, end[3];
- static float epsilon[3] = {0, 0, 0}; //1e-4, 1e-4, 1e-4};
+ // static float epsilon[3] = {1e-4, 1e-4, 1e-4};
+
+ /* happens binding when a cage has no faces */
+ if (UNLIKELY(mdb->bvhtree == NULL))
+ return NULL;
/* setup isec */
memset(&isect_mdef, 0, sizeof(isect_mdef));
isect_mdef.lambda = 1e10f;
+#if 0
add_v3_v3v3(isect_mdef.start, co1, epsilon);
add_v3_v3v3(end, co2, epsilon);
+#else
+ copy_v3_v3(isect_mdef.start, co1);
+ copy_v3_v3(end, co2);
+#endif
sub_v3_v3v3(isect_mdef.vec, end, isect_mdef.start);
hit.index = -1;