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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-07 15:19:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-07 15:19:54 +0400
commita10ed84bf44b59c97639bf44f28b5afbfa24b0c7 (patch)
tree5e3b6a64ada9064218733ad91f91ede955dbbb00 /source
parent1c450d71efc1f86419ff74041efc0630d4f1ce09 (diff)
fix [#33094] Even edge slide on multiple loops destroys geometry
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/transform/transform.c36
-rw-r--r--source/blender/editors/transform/transform.h1
2 files changed, 21 insertions, 16 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 245241763fd..28ec90a648a 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -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);
+ }
}
}
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 1f9775821d1..bc959a772d6 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -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;