diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 6d11eebe7dc..e660a43767a 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4917,10 +4917,19 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l, len_v3_ensure(vec_accum, vec_accum_len / (float)i); } else { + /* When there is no edge to slide along, + * we must slide along the vector defined by the face we're attach to */ BMLoop *l_tmp = BM_face_vert_share_loop(l_first->f, v); + float tvec[3]; - if (ELEM(l_tmp->e, e_prev, e_next) && ELEM(l_tmp->prev->e, e_prev, e_next)) { - float tvec[3]; + BLI_assert(ELEM(l_tmp->e, e_prev, e_next) && ELEM(l_tmp->prev->e, e_prev, e_next)); + + if (l_tmp->f->len == 4) { + /* we could use code below, but in this case + * sliding diagonally across the quad works well */ + sub_v3_v3v3(vec_accum, l_tmp->next->next->v->co, v->co); + } + else { BM_loop_calc_face_tangent(l_tmp, vec_accum); if (!BM_loop_is_convex(l_tmp)) { negate_v3(vec_accum); @@ -4929,9 +4938,6 @@ static BMLoop *get_next_loop(BMVert *v, BMLoop *l, cross_v3_v3v3(vec_accum, l_tmp->f->no, tvec); len_v3_ensure(vec_accum, (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f); } - else { - BLI_assert(0); - } } copy_v3_v3(r_slide_vec, vec_accum); |