fix [#33094] Even edge slide on multiple loops destroys geometry

This commit is contained in:
Campbell Barton
2012-11-07 11:19:54 +00:00
parent 1c450d71ef
commit a10ed84bf4
2 changed files with 21 additions and 16 deletions

View File

@@ -4847,14 +4847,9 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, SlideData *sld, const flo
float dist = 0;
float min_dist = FLT_MAX;
float up_p[3];
float dw_p[3];
for (i = 0; i < sld->totsv; i++, sv++) {
/* Set length */
add_v3_v3v3(up_p, sv->origvert.co, sv->upvec);
add_v3_v3v3(dw_p, sv->origvert.co, sv->downvec);
sv->edge_len = len_v3v3(dw_p, up_p);
sv->edge_len = len_v3v3(sv->upvec, sv->downvec);
mul_v3_m4v3(v_proj, t->obedit->obmat, sv->v->co);
if (ED_view3d_project_float_global(t->ar, v_proj, v_proj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
@@ -5595,7 +5590,6 @@ static int doEdgeSlide(TransInfo *t, float perc)
{
SlideData *sld = t->customData;
TransDataSlideVert *svlist = sld->sv, *sv;
float vec[3];
int i;
sld->perc = perc;
@@ -5603,6 +5597,7 @@ static int doEdgeSlide(TransInfo *t, float perc)
if (sld->is_proportional == TRUE) {
for (i = 0; i < sld->totsv; i++, sv++) {
float vec[3];
if (perc > 0.0f) {
copy_v3_v3(vec, sv->upvec);
mul_v3_fl(vec, perc);
@@ -5620,20 +5615,29 @@ static int doEdgeSlide(TransInfo *t, float perc)
* Implementation note, non proportional mode ignores the starting positions and uses only the
* up/down verts, this could be changed/improved so the distance is still met but the verts are moved along
* their original path (which may not be straight), however how it works now is OK and matches 2.4x - Campbell
*
* \note len_v3v3(curr_sv->upvec, curr_sv->downvec)
* is the same as the distance between the original vert locations, same goes for the lines below.
*/
TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
const float curr_length_perc = len_v3v3(curr_sv->up->co, curr_sv->down->co) *
(((sld->flipped_vtx ? perc : -perc) + 1.0f) / 2.0f);
const float curr_length_perc = curr_sv->edge_len * (((sld->flipped_vtx ? perc : -perc) + 1.0f) / 2.0f);
float down_co[3];
float up_co[3];
for (i = 0; i < sld->totsv; i++, sv++) {
const float sv_length = len_v3v3(sv->up->co, sv->down->co);
const float fac = min_ff(sv_length, curr_length_perc) / sv_length;
if (sv->edge_len > FLT_EPSILON) {
const float fac = min_ff(sv->edge_len, curr_length_perc) / sv->edge_len;
if (sld->flipped_vtx) {
interp_v3_v3v3(sv->v->co, sv->down->co, sv->up->co, fac);
}
else {
interp_v3_v3v3(sv->v->co, sv->up->co, sv->down->co, fac);
add_v3_v3v3(up_co, sv->origvert.co, sv->upvec);
add_v3_v3v3(down_co, sv->origvert.co, sv->downvec);
if (sld->flipped_vtx) {
interp_v3_v3v3(sv->v->co, down_co, up_co, fac);
}
else {
interp_v3_v3v3(sv->v->co, up_co, down_co, fac);
}
}
}
}

View File

@@ -197,6 +197,7 @@ typedef struct TransDataSlideVert {
float edge_len;
/* add origvert.co to get the original locations */
float upvec[3], downvec[3];
int loop_nr;