diff options
author | Jacques Lucke <jacques@blender.org> | 2020-05-27 17:15:06 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-05-27 17:15:06 +0300 |
commit | 735119dd0f91b60c827278947afc8544446a7658 (patch) | |
tree | 5eda396ceef44722f89ec5cadffed5d919ef664a /source/blender/blenkernel/intern/dynamicpaint.c | |
parent | 28d9368538f93d329573910d080e2f753f91b489 (diff) |
Fix T75096: Crash when using liquid simulation as dynamic paint brush
Reviewers: sergey
Differential Revision: https://developer.blender.org/D7853
Diffstat (limited to 'source/blender/blenkernel/intern/dynamicpaint.c')
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index a704e199007..79f0aacc3f8 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2701,15 +2701,16 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa } } + const int final_tri_index = tempPoints[final_index].tri_index; /* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */ - if (tempPoints[final_index].tri_index != target_tri) { + if (final_tri_index != target_tri && final_tri_index != -1) { /* Check if it's close enough to likely touch the intended triangle. Any triangle * becomes thinner than a pixel at its vertices, so robustness requires some margin. */ const float final_pt[2] = {((final_index % w) + 0.5f) / w, ((final_index / w) + 0.5f) / h}; const float threshold = square_f(0.7f) / (w * h); - if (dist_squared_to_looptri_uv_edges( - mlooptri, mloopuv, tempPoints[final_index].tri_index, final_pt) > threshold) { + if (dist_squared_to_looptri_uv_edges(mlooptri, mloopuv, final_tri_index, final_pt) > + threshold) { continue; } } |