diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-11-19 22:42:55 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-12-30 19:52:16 +0300 |
commit | ff8c9c5931f8b59d44352b24c3d96da7a0ea6b28 (patch) | |
tree | 8becb28d1abc5205ca73695fe74c5d8dec9fd38e /source/blender/blenkernel | |
parent | 06df30a415db618ab673237e431b00b1f102cb77 (diff) |
Fix T53343: Custom Normal Data Transfer Crashes when some vertexes have no faces.
Odd nobody noticed this earlier, was obvious bug in code logic here... :/
To be backported to 2.79a.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_remap.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index d2fe8f27f4a..23fbef60c82 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -1482,6 +1482,7 @@ void BKE_mesh_remap_calc_loops_from_dm( for (i = vert_to_refelem_map_src[nearest.index].count; i--;) { const int index_src = vert_to_refelem_map_src[nearest.index].indices[i]; + BLI_assert(index_src != -1); const float dot = dot_v3v3(nors_src[index_src], *nor_dst); pidx_src = (mode == MREMAP_MODE_LOOP_NEAREST_LOOPNOR) ? @@ -1522,7 +1523,12 @@ void BKE_mesh_remap_calc_loops_from_dm( } } } - if (mode == MREMAP_MODE_LOOP_NEAREST_POLYNOR) { + if (best_index_src == -1) { + /* We found no item to map back from closest vertex... */ + best_nor_dot = -1.0f; + hit_dist = FLT_MAX; + } + else if (mode == MREMAP_MODE_LOOP_NEAREST_POLYNOR) { /* Our best_index_src is a poly one for now! * Have to find its loop matching our closest vertex. */ mp_src = &polys_src[best_index_src]; |