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-06-16 22:48:55 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-06-18 18:24:17 +0300
commit7c4d9523e61beca29da315df9da6a198bc68a730 (patch)
treeb121fa3e05dc240288963308dc60efd999ef040b
parentf751e7dc77dd5cd69b2dd8073838d8472dc8070a (diff)
Fix T45096: Bad UVs /w EdgeSlide & zero-area faces
-rw-r--r--source/blender/editors/transform/transform.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 28b0d9711cc..97f9ed1166c 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -5391,11 +5391,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;
+ }
}
}