diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-16 22:48:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-16 22:51:09 +0300 |
commit | 770dfead8640fe3762d4ce59924249956f7308dc (patch) | |
tree | 8eefa726b1a68b5484728a118a83ba8276cad8cc /source | |
parent | aab2da9e651d5f58372ef64ae48c294f2c29c0ad (diff) |
Fix T45096: Bad UVs /w EdgeSlide & zero-area faces
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a2bfef8d89c..e23511b61a0 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -5395,11 +5395,36 @@ static void slide_origdata_interp_data_vert( /* weight the loop */ if (do_loop_weight) { - const float *v_prev = slide_origdata_orig_vert_co(sod, l->prev->v); - const float *v_next = slide_origdata_orig_vert_co(sod, l->next->v); - const float dist = dist_signed_squared_to_corner_v3v3v3(sv->v->co, v_prev, sv->co_orig_3d, v_next, f_copy->no); const float eps = 0.00001f; - loop_weights[j] = (dist >= 0.0f) ? 1.0f : ((dist <= -eps) ? 0.0f : (1.0f + (dist / eps))); + const BMLoop *l_prev = l->prev; + const BMLoop *l_next = l->next; + const float *co_prev = slide_origdata_orig_vert_co(sod, l_prev->v); + const float *co_next = slide_origdata_orig_vert_co(sod, l_next->v); + bool co_prev_ok; + bool co_next_ok; + + /* In the unlikely case that we're next to a zero length edge - walk around the to the next. + * Since we only need to check if the vertex is in this corner, + * its not important _which_ loop - as long as its not overlapping 'sv->co_orig_3d', see: T45096. */ + while (UNLIKELY(((co_prev_ok = (len_squared_v3v3(sv->co_orig_3d, co_prev) > eps)) == false) && + ((l_prev = l_prev->prev) != l->next))) + { + co_prev = slide_origdata_orig_vert_co(sod, l_prev->v); + } + while (UNLIKELY(((co_next_ok = (len_squared_v3v3(sv->co_orig_3d, co_next) > eps)) == false) && + ((l_next = l_next->next) != l->prev))) + { + co_next = slide_origdata_orig_vert_co(sod, l_next->v); + } + + if (co_prev_ok && co_next_ok && (area_tri_v3(co_prev, sv->co_orig_3d, co_next) > eps)) { + const float dist = dist_signed_squared_to_corner_v3v3v3( + sv->v->co, co_prev, sv->co_orig_3d, co_next, f_copy->no); + loop_weights[j] = (dist >= 0.0f) ? 1.0f : ((dist <= -eps) ? 0.0f : (1.0f + (dist / eps))); + } + else { + loop_weights[j] = 0.0f; + } } } |