[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50975] trunk/blender/source/blender/ editors/transform/transform.c: fix [#31654] Non-proportional edge slide behaving incorrectly.
Campbell Barton
ideasman42 at gmail.com
Mon Oct 1 12:43:53 CEST 2012
Revision: 50975
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50975
Author: campbellbarton
Date: 2012-10-01 10:43:52 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
fix [#31654] Non-proportional edge slide behaving incorrectly.
Modified Paths:
--------------
trunk/blender/source/blender/editors/transform/transform.c
Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c 2012-10-01 07:54:37 UTC (rev 50974)
+++ trunk/blender/source/blender/editors/transform/transform.c 2012-10-01 10:43:52 UTC (rev 50975)
@@ -5529,43 +5529,43 @@
int i;
sld->perc = perc;
-
sv = svlist;
- for (i = 0; i < sld->totsv; i++, sv++) {
- if (sld->is_proportional == FALSE) {
- TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
- float cur_sel = curr_sv->edge_len;
- float cur_sv = sv->edge_len;
- float extd = 0.0f;
- float recip_cur_sv = 0.0f;
- if (cur_sel == 0.0f) cur_sel = 1.0f;
- if (cur_sv == 0.0f) cur_sv = 1.0f;
+ if (sld->is_proportional == TRUE) {
+ for (i = 0; i < sld->totsv; i++, sv++) {
+ if (perc > 0.0f) {
+ copy_v3_v3(vec, sv->upvec);
+ mul_v3_fl(vec, perc);
+ add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
+ }
+ else {
+ copy_v3_v3(vec, sv->downvec);
+ mul_v3_fl(vec, -perc);
+ add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
+ }
+ }
+ }
+ else {
+ /**
+ * 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
+ */
+ 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);
- recip_cur_sv = 1.0f / cur_sv;
+ for (i = 0; i < sld->totsv; i++, sv++) {
+ const float sv_length = len_v3v3(sv->up->co, sv->down->co);
+ const float fac = minf(sv_length, curr_length_perc) / sv_length;
- if (!sld->flipped_vtx) {
- extd = (cur_sv - cur_sel) * recip_cur_sv;
+ if (sld->flipped_vtx) {
+ interp_v3_v3v3(sv->v->co, sv->down->co, sv->up->co, fac);
}
else {
- extd = (cur_sel - cur_sv) * recip_cur_sv;
+ interp_v3_v3v3(sv->v->co, sv->up->co, sv->down->co, fac);
}
-
- extd += (sld->perc * cur_sel) * recip_cur_sv;
- CLAMP(extd, -1.0f, 1.0f);
- perc = extd;
}
-
- if (perc > 0.0f) {
- copy_v3_v3(vec, sv->upvec);
- mul_v3_fl(vec, perc);
- add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
- }
- else {
- copy_v3_v3(vec, sv->downvec);
- mul_v3_fl(vec, -perc);
- add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
- }
}
projectSVData(t, 0);
More information about the Bf-blender-cvs
mailing list