[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53833] trunk/blender/source/blender/ editors/transform/transform.c: resolve issue [#33882] New GG slide - Lost functionality
Campbell Barton
ideasman42 at gmail.com
Wed Jan 16 03:23:39 CET 2013
Revision: 53833
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53833
Author: campbellbarton
Date: 2013-01-16 02:23:34 +0000 (Wed, 16 Jan 2013)
Log Message:
-----------
resolve issue [#33882] New GG slide - Lost functionality
Holding Alt stops switching the active edge so you can drag in the negative direction.
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 2013-01-16 01:10:06 UTC (rev 53832)
+++ trunk/blender/source/blender/editors/transform/transform.c 2013-01-16 02:23:34 UTC (rev 53833)
@@ -5857,32 +5857,44 @@
}
}
}
-static void calcVertSlideMouseMove(struct TransInfo *t, const int mval[2], const bool is_init)
+
+/**
+ * Run once when initializing vert slide to find the reference edge
+ */
+static void calcVertSlideMouseActiveVert(struct TransInfo *t, const int mval[2])
{
VertSlideData *sld = t->customData;
float mval_fl[2] = {UNPACK2(mval)};
+ TransDataVertSlideVert *sv;
+ /* set the vertex to use as a reference for the mouse direction 'curr_sv_index' */
+ float dist = 0.0f;
+ float min_dist = FLT_MAX;
+ int i;
+
+ for (i = 0; i < sld->totsv; i++, sv++) {
+ /* allow points behind the view [#33643] */
+ dist = len_squared_v2v2(mval_fl, sv->co_orig_2d);
+ if (dist < min_dist) {
+ min_dist = dist;
+ sld->curr_sv_index = i;
+ }
+ }
+}
+/**
+ * Run while moving the mouse to slide along the edge matching the mouse direction
+ */
+static void calcVertSlideMouseActiveEdges(struct TransInfo *t, const int mval[2])
+{
+ VertSlideData *sld = t->customData;
+ float mval_fl[2] = {UNPACK2(mval)};
+
float dir[2];
TransDataVertSlideVert *sv;
int i;
sv = sld->sv;
- if (is_init) {
- /* set the vertex to use as a reference for the mouse direction 'curr_sv_index' */
- float dist = 0.0f;
- float min_dist = FLT_MAX;
-
- for (i = 0; i < sld->totsv; i++, sv++) {
- /* allow points behind the view [#33643] */
- dist = len_squared_v2v2(mval_fl, sv->co_orig_2d);
- if (dist < min_dist) {
- min_dist = dist;
- sld->curr_sv_index = i;
- }
- }
- }
-
/* first get the direction of the original vertex */
sub_v2_v2v2(dir, sld->sv[sld->curr_sv_index].co_orig_2d, mval_fl);
normalize_v2(dir);
@@ -6025,8 +6037,10 @@
t->customData = sld;
- if (rv3d)
- calcVertSlideMouseMove(t, t->mval, true);
+ if (rv3d) {
+ calcVertSlideMouseActiveVert(t, t->mval);
+ calcVertSlideMouseActiveEdges(t, t->mval);
+ }
return 1;
}
@@ -6134,7 +6148,10 @@
#endif
case MOUSEMOVE:
{
- calcVertSlideMouseMove(t, event->mval, false);
+ /* don't recalculat the best edge */
+ if (!(t->flag & T_ALT_TRANSFORM)) {
+ calcVertSlideMouseActiveEdges(t, event->mval);
+ }
calcVertSlideCustomPoints(t);
}
default:
@@ -6264,12 +6281,12 @@
outputNumInput(&(t->num), c);
- BLI_snprintf(str, sizeof(str), "Vert Slide: %s (E)ven: %s, (F)lipped: %s",
- &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
+ BLI_snprintf(str, sizeof(str), "Vert Slide: %s (E)ven: %s, (F)lipped: %s, Alt Hold: %s",
+ &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF", (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
}
else {
- BLI_snprintf(str, sizeof(str), "Vert Slide: %.2f (E)ven: %s, (F)lipped: %s",
- final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
+ BLI_snprintf(str, sizeof(str), "Vert Slide: %.2f (E)ven: %s, (F)lipped: %s, Alt Hold: %s",
+ final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF", (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
}
CLAMP(final, -1.0f, 1.0f);
More information about the Bf-blender-cvs
mailing list