code cleanup: favor braces when blocks have mixed brace use.
[blender.git] / source / blender / editors / transform / transform.c
index 2afc116..4aa5439 100644 (file)
@@ -94,6 +94,7 @@
 #include "RNA_access.h"
 
 #include "BLF_api.h"
+#include "BLF_translation.h"
 
 #include "transform.h"
 
@@ -104,6 +105,16 @@ static int doVertSlide(TransInfo *t, float perc);
 static void drawEdgeSlide(const struct bContext *C, TransInfo *t);
 static void drawVertSlide(const struct bContext *C, TransInfo *t);
 
+static bool transdata_check_local_center(TransInfo *t)
+{
+       return ((t->around == V3D_LOCAL) && (
+                   (t->flag & (T_OBJECT | T_POSE)) ||
+                   (t->obedit && t->obedit->type == OB_MESH && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) ||
+                   (t->obedit && t->obedit->type == OB_ARMATURE) ||
+                   (t->spacetype == SPACE_IPO))
+               );
+}
+
 /* ************************** SPACE DEPENDANT CODE **************************** */
 
 void setTransformViewMatrices(TransInfo *t)
@@ -228,11 +239,11 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
        }
 }
 
-void projectIntView(TransInfo *t, const float vec[3], int adr[2])
+void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag)
 {
        if (t->spacetype == SPACE_VIEW3D) {
                if (t->ar->regiontype == RGN_TYPE_WINDOW) {
-                       if (ED_view3d_project_int_global(t->ar, vec, adr, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
+                       if (ED_view3d_project_int_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) {
                                adr[0] = (int)2140000000.0f;  /* this is what was done in 2.64, perhaps we can be smarter? */
                                adr[1] = (int)2140000000.0f;
                        }
@@ -350,15 +361,19 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
                UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], adr, adr + 1);
        }
 }
+void projectIntView(TransInfo *t, const float vec[3], int adr[2])
+{
+       projectIntViewEx(t, vec, adr, V3D_PROJ_TEST_NOP);
+}
 
-void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
+void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV3DProjTest flag)
 {
        switch (t->spacetype) {
                case SPACE_VIEW3D:
                {
                        if (t->ar->regiontype == RGN_TYPE_WINDOW) {
                                /* allow points behind the view [#33643] */
-                               if (ED_view3d_project_float_global(t->ar, vec, adr, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
+                               if (ED_view3d_project_float_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) {
                                        /* XXX, 2.64 and prior did this, weak! */
                                        adr[0] = t->ar->winx / 2.0f;
                                        adr[1] = t->ar->winy / 2.0f;
@@ -382,6 +397,10 @@ void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
 
        zero_v2(adr);
 }
+void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
+{
+       projectFloatViewEx(t, vec, adr, V3D_PROJ_TEST_NOP);
+}
 
 void applyAspectRatio(TransInfo *t, float vec[2])
 {
@@ -780,22 +799,29 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
        if (!(t->flag & T_NO_CONSTRAINT)) {
                int constraint_axis, constraint_plane;
                int edit_2d = (t->flag & T_2D_EDIT);
-               char msg1[] = "along _";
-               char msg2[] = "along %s _";
-               char msg3[] = "locking %s _";
+               const char *msg1 = "", *msg2 = "", *msg3 = "";
                char axis;
        
                /* Initialize */
                switch (key_type) {
                        case XKEY:
+                               msg1 = IFACE_("along X");
+                               msg2 = IFACE_("along %s X");
+                               msg3 = IFACE_("locking %s X");
                                axis = 'X';
                                constraint_axis = CON_AXIS0;
                                break;
                        case YKEY:
+                               msg1 = IFACE_("along Y");
+                               msg2 = IFACE_("along %s Y");
+                               msg3 = IFACE_("locking %s Y");
                                axis = 'Y';
                                constraint_axis = CON_AXIS1;
                                break;
                        case ZKEY:
+                               msg1 = IFACE_("along Z");
+                               msg2 = IFACE_("along %s Z");
+                               msg3 = IFACE_("locking %s Z");
                                axis = 'Z';
                                constraint_axis = CON_AXIS2;
                                break;
@@ -803,9 +829,6 @@ static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cm
                                /* Invalid key */
                                return;
                }
-               msg1[sizeof(msg1) - 2] = axis;
-               msg2[sizeof(msg2) - 2] = axis;
-               msg3[sizeof(msg3) - 2] = axis;
                constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & (~constraint_axis));
 
                if (edit_2d && (key_type != ZKEY)) {
@@ -894,9 +917,13 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                        t->redraw |= TREDRAW_HARD;
                                        WM_event_add_mousemove(t->context);
                                }
+                               else if (t->mode == TFM_SEQ_SLIDE) {
+                                       t->flag ^= T_ALT_TRANSFORM;
+                                       t->redraw |= TREDRAW_HARD;
+                               }
                                else {
                                        if (t->obedit && t->obedit->type == OB_MESH) {
-                                               if (t->mode == TFM_TRANSLATION) {
+                                               if ((t->mode == TFM_TRANSLATION) && (t->spacetype == SPACE_VIEW3D)) {
                                                        resetTransRestrictions(t);
                                                        restoreTransObjects(t);
 
@@ -907,6 +934,13 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                                                t->state = TRANS_STARTING;
                                                                initVertSlide(t);
                                                        }
+                                                       /* vert slide can fail on unconnected vertices (rare but possible) */
+                                                       if (t->state == TRANS_CANCEL) {
+                                                               t->state = TRANS_STARTING;
+                                                               resetTransRestrictions(t);
+                                                               restoreTransObjects(t);
+                                                               initTranslation(t);
+                                                       }
                                                        initSnapping(t, NULL); // need to reinit after mode change
                                                        t->redraw |= TREDRAW_HARD;
                                                        WM_event_add_mousemove(t->context);
@@ -951,6 +985,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                        initSnapping(t, NULL); // need to reinit after mode change
                                        t->redraw |= TREDRAW_HARD;
                                }
+                               else if (t->mode == TFM_SHRINKFATTEN) {
+                                       t->flag ^= T_ALT_TRANSFORM;
+                                       t->redraw |= TREDRAW_HARD;
+                               }
                                else if (t->mode == TFM_RESIZE) {
                                        if (t->options & CTX_MOVIECLIP) {
                                                restoreTransObjects(t);
@@ -980,10 +1018,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                        }
                                        else {
                                                if (t->flag & T_2D_EDIT) {
-                                                       setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X");
+                                                       setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), IFACE_("along X"));
                                                }
                                                else {
-                                                       setUserConstraint(t, t->current_orientation, (CON_AXIS0), "along %s X");
+                                                       setUserConstraint(t, t->current_orientation, (CON_AXIS0), IFACE_("along %s X"));
                                                }
                                        }
                                        t->redraw |= TREDRAW_HARD;
@@ -996,10 +1034,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                        }
                                        else {
                                                if (t->flag & T_2D_EDIT) {
-                                                       setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y");
+                                                       setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), IFACE_("along Y"));
                                                }
                                                else {
-                                                       setUserConstraint(t, t->current_orientation, (CON_AXIS1), "along %s Y");
+                                                       setUserConstraint(t, t->current_orientation, (CON_AXIS1), IFACE_("along %s Y"));
                                                }
                                        }
                                        t->redraw |= TREDRAW_HARD;
@@ -1011,7 +1049,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                                stopConstraint(t);
                                        }
                                        else {
-                                               setUserConstraint(t, t->current_orientation, (CON_AXIS2), "along %s Z");
+                                               setUserConstraint(t, t->current_orientation, (CON_AXIS2), IFACE_("along %s Z"));
                                        }
                                        t->redraw |= TREDRAW_HARD;
                                }
@@ -1022,7 +1060,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                                stopConstraint(t);
                                        }
                                        else {
-                                               setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), "locking %s X");
+                                               setUserConstraint(t, t->current_orientation, (CON_AXIS1 | CON_AXIS2), IFACE_("locking %s X"));
                                        }
                                        t->redraw |= TREDRAW_HARD;
                                }
@@ -1033,7 +1071,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                                stopConstraint(t);
                                        }
                                        else {
-                                               setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), "locking %s Y");
+                                               setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS2), IFACE_("locking %s Y"));
                                        }
                                        t->redraw |= TREDRAW_HARD;
                                }
@@ -1044,7 +1082,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                                stopConstraint(t);
                                        }
                                        else {
-                                               setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), "locking %s Z");
+                                               setUserConstraint(t, t->current_orientation, (CON_AXIS0 | CON_AXIS1), IFACE_("locking %s Z"));
                                        }
                                        t->redraw |= TREDRAW_HARD;
                                }
@@ -1149,7 +1187,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                        /* exception for switching to dolly, or trackball, in camera view */
                                        if (t->flag & T_CAMERA) {
                                                if (t->mode == TFM_TRANSLATION)
-                                                       setLocalConstraint(t, (CON_AXIS2), "along local Z");
+                                                       setLocalConstraint(t, (CON_AXIS2), IFACE_("along local Z"));
                                                else if (t->mode == TFM_ROTATION) {
                                                        restoreTransObjects(t);
                                                        initTrackball(t);
@@ -1260,7 +1298,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                if (t->flag & T_AUTOIK) {
                                        transform_autoik_update(t, 1);
                                }
-                               else view_editmove(event->type);
+                               else {
+                                       view_editmove(event->type);
+                               }
                                t->redraw = 1;
                                break;
                        case PADMINUS:
@@ -1275,7 +1315,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                if (t->flag & T_AUTOIK) {
                                        transform_autoik_update(t, -1);
                                }
-                               else view_editmove(event->type);
+                               else {
+                                       view_editmove(event->type);
+                               }
                                t->redraw = 1;
                                break;
                        case LEFTALTKEY:
@@ -1513,7 +1555,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
                        if (ob) mul_m4_v3(ob->obmat, vecrot);
                }
 
-               projectFloatView(t, vecrot, cent);  // no overflow in extreme cases
+               projectFloatViewEx(t, vecrot, cent, V3D_PROJ_TEST_CLIP_ZERO);
 
                glPushMatrix();
 
@@ -1641,7 +1683,7 @@ static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), voi
 static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
 {
        rcti rect;
-       const char printable[] = "Auto Keying On";
+       const char *printable = IFACE_("Auto Keying On");
        float      printable_size[2];
        int xco, yco;
 
@@ -1656,7 +1698,11 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
         * - original color was red to match the icon, but that clashes badly with a less nasty border
         */
        UI_ThemeColorShade(TH_TEXT_HI, -50);
+#ifdef WITH_INTERNATIONAL
+       BLF_draw_default(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
+#else
        BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
+#endif
        
        /* autokey recording icon... */
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1913,6 +1959,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 
        }
 
+       t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
+
        initSnapping(t, op); // Initialize snapping data AFTER mode flags
 
        /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
@@ -2117,12 +2165,6 @@ void transformApply(bContext *C, TransInfo *t)
                t->state = TRANS_CONFIRM;
        }
 
-       if (BKE_ptcache_get_continue_physics()) {
-               // TRANSFORM_FIX_ME
-               //do_screenhandlers(G.curscreen);
-               t->redraw |= TREDRAW_HARD;
-       }
-
        t->context = NULL;
 }
 
@@ -2335,7 +2377,7 @@ static void constraintTransLim(TransInfo *t, TransData *td)
                        ListBase targets = {NULL, NULL};
                        
                        /* only consider constraint if enabled */
-                       if (con->flag & CONSTRAINT_DISABLE) continue;
+                       if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
                        if (con->enforce == 0.0f) continue;
                        
                        /* only use it if it's tagged for this purpose (and the right type) */
@@ -2426,7 +2468,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
                /* Evaluate valid constraints */
                for (con = td->con; con; con = con->next) {
                        /* only consider constraint if enabled */
-                       if (con->flag & CONSTRAINT_DISABLE) continue;
+                       if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
                        if (con->enforce == 0.0f) continue;
 
                        /* we're only interested in Limit-Rotation constraints */
@@ -2516,7 +2558,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
                /* Evaluate valid constraints */
                for (con = td->con; con; con = con->next) {
                        /* only consider constraint if enabled */
-                       if (con->flag & CONSTRAINT_DISABLE) continue;
+                       if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
                        if (con->enforce == 0.0f) continue;
                        
                        /* we're only interested in Limit-Scale constraints */
@@ -2678,13 +2720,13 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
                
                outputNumInput(&(t->num), c);
                
-               sprintf(str, "Warp: %s", c);
+               sprintf(str, IFACE_("Warp: %s"), c);
 
                circumfac = DEG2RADF(circumfac);
        }
        else {
                /* default header print */
-               sprintf(str, "Warp: %.3f", RAD2DEGF(circumfac));
+               sprintf(str, IFACE_("Warp: %.3f"), RAD2DEGF(circumfac));
        }
        
        t->values[0] = circumfac;
@@ -2819,11 +2861,11 @@ int Shear(TransInfo *t, const int UNUSED(mval[2]))
                
                outputNumInput(&(t->num), c);
                
-               sprintf(str, "Shear: %s %s", c, t->proptext);
+               sprintf(str, IFACE_("Shear: %s %s"), c, t->proptext);
        }
        else {
                /* default header print */
-               sprintf(str, "Shear: %.3f %s (Press X or Y to set shear axis)", value, t->proptext);
+               sprintf(str, IFACE_("Shear: %.3f %s (Press X or Y to set shear axis)"), value, t->proptext);
        }
        
        t->values[0] = value;
@@ -2915,30 +2957,30 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
        if (t->con.mode & CON_APPLY) {
                switch (t->num.idx_max) {
                        case 0:
-                               spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
+                               spos += sprintf(spos, IFACE_("Scale: %s%s %s"), &tvec[0], t->con.text, t->proptext);
                                break;
                        case 1:
-                               spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+                               spos += sprintf(spos, IFACE_("Scale: %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
                                                t->con.text, t->proptext);
                                break;
                        case 2:
-                               spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+                               spos += sprintf(spos, IFACE_("Scale: %s : %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
                                                &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
                }
        }
        else {
                if (t->flag & T_2D_EDIT) {
-                       spos += sprintf(spos, "Scale X: %s   Y: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+                       spos += sprintf(spos, IFACE_("Scale X: %s   Y: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
                                        t->con.text, t->proptext);
                }
                else {
-                       spos += sprintf(spos, "Scale X: %s   Y: %s  Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN],
+                       spos += sprintf(spos, IFACE_("Scale X: %s   Y: %s  Z: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
                                        &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
                }
        }
        
        if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
-               spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+               spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
        }
 
        (void)spos;
@@ -2994,12 +3036,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
        }
        
        /* local constraint shouldn't alter center */
-       if ((t->around == V3D_LOCAL) &&
-           (   (t->flag & (T_OBJECT | T_POSE)) ||
-               ((t->flag & T_EDIT) && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) ||
-               (t->obedit && t->obedit->type == OB_ARMATURE))
-           )
-       {
+       if (transdata_check_local_center(t)) {
                copy_v3_v3(center, td->center);
        }
        else if (t->options & CTX_MOVIECLIP) {
@@ -3302,11 +3339,11 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
                
                outputNumInput(&(t->num), c);
                
-               sprintf(str, "To Sphere: %s %s", c, t->proptext);
+               sprintf(str, IFACE_("To Sphere: %s %s"), c, t->proptext);
        }
        else {
                /* default header print */
-               sprintf(str, "To Sphere: %.4f %s", ratio, t->proptext);
+               sprintf(str, IFACE_("To Sphere: %.4f %s"), ratio, t->proptext);
        }
        
        
@@ -3376,20 +3413,16 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
 {
        float vec[3], totmat[3][3], smat[3][3];
        float eul[3], fmat[3][3], quat[4];
-       float *center = t->center;
+       const float *center;
 
        /* local constraint shouldn't alter center */
-       if (around == V3D_LOCAL) {
-               if (    (t->flag & (T_OBJECT | T_POSE)) ||
-                       (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE)) ||
-                       (t->obedit && t->obedit->type == OB_ARMATURE))
-               {
-                       center = td->center;
-               }
-
-               if (t->options & CTX_MOVIECLIP) {
-                       center = td->center;
-               }
+       if (transdata_check_local_center(t) ||
+           ((around == V3D_LOCAL) && (t->options & CTX_MOVIECLIP)))
+       {
+               center = td->center;
+       }
+       else {
+               center = t->center;
        }
 
        if (t->flag & T_POINTS) {
@@ -3650,17 +3683,17 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2]))
                
                outputNumInput(&(t->num), c);
                
-               spos += sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
+               spos += sprintf(spos, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext);
 
                /* Clamp between -180 and 180 */
                final = angle_wrap_rad(DEG2RADF(final));
        }
        else {
-               spos += sprintf(spos, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext);
+               spos += sprintf(spos, IFACE_("Rot: %.2f%s %s"), RAD2DEGF(final), t->con.text, t->proptext);
        }
        
        if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
-               spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+               spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
        }
        (void)spos;
 
@@ -3749,17 +3782,17 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[NUM_STR_REP_LEN], t->proptext);
+               spos += sprintf(spos, IFACE_("Trackball: %s %s %s"), &c[0], &c[NUM_STR_REP_LEN], t->proptext);
 
                phi[0] = DEG2RADF(phi[0]);
                phi[1] = DEG2RADF(phi[1]);
        }
        else {
-               spos += sprintf(spos, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
+               spos += sprintf(spos, IFACE_("Trackball: %.2f %.2f %s"), RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
        }
 
        if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
-               spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+               spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
        }
        (void)spos;
 
@@ -3870,7 +3903,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
                short chainlen = t->settings->autoik_chainlen;
 
                if (chainlen)
-                       sprintf(autoik, "AutoIK-Len: %d", chainlen);
+                       sprintf(autoik, IFACE_("AutoIK-Len: %d"), chainlen);
                else
                        autoik[0] = '\0';
        }
@@ -3903,7 +3936,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
        }
        
        if (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) {
-               spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+               spos += sprintf(spos, IFACE_(" Proportional size: %.2f"), t->prop_size);
        }
        (void)spos;
 }
@@ -4053,7 +4086,8 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 {
        float distance;
        int i;
-       char str[64];
+       char str[128];
+       char *str_p;
        TransData *td = t->data;
 
        distance = -t->values[0];
@@ -4063,18 +4097,34 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
        applyNumInput(&t->num, &distance);
 
        /* header print for NumInput */
+       str_p = str;
+       str_p += BLI_snprintf(str_p, sizeof(str), IFACE_("Shrink/Fatten:"));
        if (hasNumInput(&t->num)) {
                char c[NUM_STR_REP_LEN];
-
                outputNumInput(&(t->num), c);
-
-               sprintf(str, "Shrink/Fatten: %s %s", c, t->proptext);
+               str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s", c);
        }
        else {
                /* default header print */
-               sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext);
+               str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %.4f", distance);
        }
 
+       if (t->proptext[0]) {
+               str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s", t->proptext);
+       }
+       str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), ", (");
+
+       {
+               wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
+               if (kmi) {
+                       str_p += WM_keymap_item_to_string(kmi, str_p, sizeof(str) - (str_p - str));
+               }
+       }
+       str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_(" or Alt) Even Thickness %s"),
+                             (t->flag & T_ALT_TRANSFORM) ? IFACE_("ON") : IFACE_("OFF"));
+       /* done with header string */
+
+
        t->values[0] = -distance;
 
        for (i = 0; i < t->total; i++, td++) {
@@ -4142,7 +4192,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               sprintf(str, "Tilt: %s° %s", &c[0], t->proptext);
+               sprintf(str, IFACE_("Tilt: %s° %s"), &c[0], t->proptext);
 
                final = DEG2RADF(final);
 
@@ -4150,7 +4200,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
                t->values[0] = final;
        }
        else {
-               sprintf(str, "Tilt: %.2f° %s", RAD2DEGF(final), t->proptext);
+               sprintf(str, IFACE_("Tilt: %.2f° %s"), RAD2DEGF(final), t->proptext);
        }
 
        for (i = 0; i < t->total; i++, td++) {
@@ -4214,10 +4264,10 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
                char c[NUM_STR_REP_LEN];
 
                outputNumInput(&(t->num), c);
-               sprintf(str, "Shrink/Fatten: %s", c);
+               sprintf(str, IFACE_("Shrink/Fatten: %s"), c);
        }
        else {
-               sprintf(str, "Shrink/Fatten: %3f", ratio);
+               sprintf(str, IFACE_("Shrink/Fatten: %3f"), ratio);
        }
 
        for (i = 0; i < t->total; i++, td++) {
@@ -4282,10 +4332,10 @@ int MaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
                char c[NUM_STR_REP_LEN];
 
                outputNumInput(&(t->num), c);
-               sprintf(str, "Feather Shrink/Fatten: %s", c);
+               sprintf(str, IFACE_("Feather Shrink/Fatten: %s"), c);
        }
        else {
-               sprintf(str, "Feather Shrink/Fatten: %3f", ratio);
+               sprintf(str, IFACE_("Feather Shrink/Fatten: %3f"), ratio);
        }
 
        /* detect if no points have feather yet */
@@ -4370,11 +4420,11 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               sprintf(str, "Push/Pull: %s%s %s", c, t->con.text, t->proptext);
+               sprintf(str, IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext);
        }
        else {
                /* default header print */
-               sprintf(str, "Push/Pull: %.4f%s %s", distance, t->con.text, t->proptext);
+               sprintf(str, IFACE_("Push/Pull: %.4f%s %s"), distance, t->con.text, t->proptext);
        }
 
        t->values[0] = distance;
@@ -4491,7 +4541,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
        const char *mode;
        TransData *td = t->data;
 
-       mode = (G.editBMesh->options & BME_BEVEL_VERT) ? "verts only" : "normal";
+       mode = (G.editBMesh->options & BME_BEVEL_VERT) ? IFACE_("verts only") : IFACE_("normal");
        distance = t->values[0] / 4; /* 4 just seemed a nice value to me, nothing special */
 
        distance = fabs(distance);
@@ -4506,11 +4556,11 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               sprintf(str, "Bevel - Dist: %s, Mode: %s (MMB to toggle))", c, mode);
+               sprintf(str, IFACE_("Bevel - Dist: %s, Mode: %s (MMB to toggle))"), c, mode);
        }
        else {
                /* default header print */
-               sprintf(str, "Bevel - Dist: %.4f, Mode: %s (MMB to toggle))", distance, mode);
+               sprintf(str, IFACE_("Bevel - Dist: %.4f, Mode: %s (MMB to toggle))"), distance, mode);
        }
 
        if (distance < 0) distance = -distance;
@@ -4574,16 +4624,16 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
                outputNumInput(&(t->num), c);
 
                if (weight >= 0.0f)
-                       sprintf(str, "Bevel Weight: +%s %s", c, t->proptext);
+                       sprintf(str, IFACE_("Bevel Weight: +%s %s"), c, t->proptext);
                else
-                       sprintf(str, "Bevel Weight: %s %s", c, t->proptext);
+                       sprintf(str, IFACE_("Bevel Weight: %s %s"), c, t->proptext);
        }
        else {
                /* default header print */
                if (weight >= 0.0f)
-                       sprintf(str, "Bevel Weight: +%.3f %s", weight, t->proptext);
+                       sprintf(str, IFACE_("Bevel Weight: +%.3f %s"), weight, t->proptext);
                else
-                       sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext);
+                       sprintf(str, IFACE_("Bevel Weight: %.3f %s"), weight, t->proptext);
        }
 
        for (i = 0; i < t->total; i++, td++) {
@@ -4647,16 +4697,16 @@ int Crease(TransInfo *t, const int UNUSED(mval[2]))
                outputNumInput(&(t->num), c);
 
                if (crease >= 0.0f)
-                       sprintf(str, "Crease: +%s %s", c, t->proptext);
+                       sprintf(str, IFACE_("Crease: +%s %s"), c, t->proptext);
                else
-                       sprintf(str, "Crease: %s %s", c, t->proptext);
+                       sprintf(str, IFACE_("Crease: %s %s"), c, t->proptext);
        }
        else {
                /* default header print */
                if (crease >= 0.0f)
-                       sprintf(str, "Crease: +%.3f %s", crease, t->proptext);
+                       sprintf(str, IFACE_("Crease: +%.3f %s"), crease, t->proptext);
                else
-                       sprintf(str, "Crease: %.3f %s", crease, t->proptext);
+                       sprintf(str, IFACE_("Crease: %.3f %s"), crease, t->proptext);
        }
 
        for (i = 0; i < t->total; i++, td++) {
@@ -4715,14 +4765,14 @@ static void headerBoneSize(TransInfo *t, float vec[3], char *str)
        /* hmm... perhaps the y-axis values don't need to be shown? */
        if (t->con.mode & CON_APPLY) {
                if (t->num.idx_max == 0)
-                       sprintf(str, "ScaleB: %s%s %s", &tvec[0], t->con.text, t->proptext);
+                       sprintf(str, IFACE_("ScaleB: %s%s %s"), &tvec[0], t->con.text, t->proptext);
                else
-                       sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
-                               t->con.text, t->proptext);
+                       sprintf(str, IFACE_("ScaleB: %s : %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
+                               &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
        }
        else {
-               sprintf(str, "ScaleB X: %s  Y: %s  Z: %s%s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2],
-                       t->con.text, t->proptext);
+               sprintf(str, IFACE_("ScaleB X: %s  Y: %s  Z: %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN],
+                       &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
        }
 }
 
@@ -4838,10 +4888,10 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
                char c[NUM_STR_REP_LEN];
                
                outputNumInput(&(t->num), c);
-               sprintf(str, "Envelope: %s", c);
+               sprintf(str, IFACE_("Envelope: %s"), c);
        }
        else {
-               sprintf(str, "Envelope: %3f", ratio);
+               sprintf(str, IFACE_("Envelope: %3f"), ratio);
        }
        
        for (i = 0; i < t->total; i++, td++) {
@@ -4871,70 +4921,159 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
 static BMEdge *get_other_edge(BMVert *v, BMEdge *e)
 {
        BMIter iter;
-       BMEdge *e2;
+       BMEdge *e_iter;
 
-       BM_ITER_ELEM (e2, &iter, v, BM_EDGES_OF_VERT) {
-               if (BM_elem_flag_test(e2, BM_ELEM_SELECT) && e2 != e)
-                       return e2;
+       BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) {
+               if (BM_elem_flag_test(e_iter, BM_ELEM_SELECT) && e_iter != e) {
+                       return e_iter;
+               }
        }
 
        return NULL;
 }
 
+static void len_v3_ensure(float v[3], const float length)
+{
+       normalize_v3(v);
+       mul_v3_fl(v, length);
+}
+
+/**
+ * Find the closest point on the ngon on the opposite side.
+ * used to set the edge slide distance for ngons.
+ */
+static bool bm_loop_calc_opposite_co(BMLoop *l_tmp,
+                                     const float plane_no[3],
+                                     float r_co[3])
+{
+       /* skip adjacent edges */
+       BMLoop *l_first = l_tmp->next;
+       BMLoop *l_last  = l_tmp->prev;
+       BMLoop *l_iter;
+       float dist = FLT_MAX;
+
+       l_iter = l_first;
+       do {
+               float tvec[3];
+               if (isect_line_plane_v3(tvec,
+                                       l_iter->v->co, l_iter->next->v->co,
+                                       l_tmp->v->co, plane_no, false))
+               {
+                       const float fac = line_point_factor_v3(tvec, l_iter->v->co, l_iter->next->v->co);
+                       /* allow some overlap to avoid missing the intersection because of float precision */
+                       if ((fac > -FLT_EPSILON) && (fac < 1.0f + FLT_EPSILON)) {
+                               /* likelyhood of multiple intersections per ngon is quite low,
+                                * it would have to loop back on its self, but better support it
+                                * so check for the closest opposite edge */
+                               const float tdist = len_v3v3(l_tmp->v->co, tvec);
+                               if (tdist < dist) {
+                                       copy_v3_v3(r_co, tvec);
+                                       dist = tdist;
+                               }
+                       }
+               }
+       } while ((l_iter = l_iter->next) != l_last);
+
+       return (dist != FLT_MAX);
+}
+
+/**
+ * Given 2 edges and a loop, step over the loops
+ * and calculate a direction to slide along.
+ *
+ * \param r_slide_vec the direction to slide,
+ * the length of the vector defines the slide distance.
+ */
 static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
-                             BMEdge *olde, BMEdge *nexte, float vec[3])
+                             BMEdge *e_prev, BMEdge *e_next, float r_slide_vec[3])
 {
-       BMLoop *firstl;
-       float a[3] = {0.0f, 0.0f, 0.0f}, n[3] = {0.0f, 0.0f, 0.0f};
+       BMLoop *l_first;
+       float vec_accum[3] = {0.0f, 0.0f, 0.0f};
+       float vec_accum_len = 0.0f;
        int i = 0;
 
-       firstl = l;
+       BLI_assert(BM_edge_share_vert(e_prev, e_next) == v);
+
+       l_first = l;
        do {
                l = BM_face_other_edge_loop(l->f, l->e, v);
                if (l->radial_next == l)
                        return NULL;
                
-               if (l->e == nexte) {
+               if (l->e == e_next) {
                        if (i) {
-                               mul_v3_fl(a, 1.0f / (float)i);
+                               len_v3_ensure(vec_accum, vec_accum_len / (float)i);
                        }
                        else {
-                               float f1[3], f2[3], f3[3];
+                               /* 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);
 
-                               sub_v3_v3v3(f1, BM_edge_other_vert(olde, v)->co, v->co);
-                               sub_v3_v3v3(f2, BM_edge_other_vert(nexte, v)->co, v->co);
+                               BLI_assert(ELEM(l_tmp->e, e_prev, e_next) && ELEM(l_tmp->prev->e, e_prev, e_next));
 
-                               cross_v3_v3v3(f3, f1, l->f->no);
-                               cross_v3_v3v3(a, f2, l->f->no);
-                               mul_v3_fl(a, -1.0f);
+                               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 {
+                                       float tdir[3];
+                                       BM_loop_calc_face_direction(l_tmp, tdir);
+                                       cross_v3_v3v3(vec_accum, l_tmp->f->no, tdir);
+#if 0
+                                       /* rough guess, we can  do better! */
+                                       len_v3_ensure(vec_accum, (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f);
+#else
+                                       /* be clever, check the opposite ngon edge to slide into.
+                                        * this gives best results */
+                                       {
+                                               float tvec[3];
+                                               float dist;
 
-                               mid_v3_v3v3(a, a, f3);
+                                               if (bm_loop_calc_opposite_co(l_tmp, tdir, tvec)) {
+                                                       dist = len_v3v3(l_tmp->v->co, tvec);
+                                               }
+                                               else {
+                                                       dist = (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f;
+                                               }
+
+                                               len_v3_ensure(vec_accum, dist);
+                                       }
+#endif
+                               }
                        }
-                       
-                       copy_v3_v3(vec, a);
+
+                       copy_v3_v3(r_slide_vec, vec_accum);
                        return l;
                }
                else {
-                       sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co);
-                       add_v3_v3v3(a, a, n);
+                       /* accumulate the normalized edge vector,
+                        * normalize so some edges don't skew the result */
+                       float tvec[3];
+                       sub_v3_v3v3(tvec, BM_edge_other_vert(l->e, v)->co, v->co);
+                       vec_accum_len += normalize_v3(tvec);
+                       add_v3_v3(vec_accum, tvec);
                        i += 1;
                }
 
-               if (BM_face_other_edge_loop(l->f, l->e, v)->e == nexte) {
-                       if (i)
-                               mul_v3_fl(a, 1.0f / (float)i);
-                       
-                       copy_v3_v3(vec, a);
+               if (BM_face_other_edge_loop(l->f, l->e, v)->e == e_next) {
+                       if (i) {
+                               len_v3_ensure(vec_accum, vec_accum_len / (float)i);
+                       }
+
+                       copy_v3_v3(r_slide_vec, vec_accum);
                        return BM_face_other_edge_loop(l->f, l->e, v);
                }
                
+               BLI_assert(l != l->radial_next);
                l = l->radial_next;
-       } while (l != firstl);
+       } while (l != l_first);
 
-       if (i)
-               mul_v3_fl(a, 1.0f / (float)i);
+       if (i) {
+               len_v3_ensure(vec_accum, vec_accum_len / (float)i);
+       }
        
-       copy_v3_v3(vec, a);
+       copy_v3_v3(r_slide_vec, vec_accum);
        
        return NULL;
 }
@@ -4990,8 +5129,9 @@ static int createEdgeSlideVerts(TransInfo *t)
        BMesh *bm = em->bm;
        BMIter iter;
        BMEdge *e, *e1;
-       BMVert *v, *v2, *first;
+       BMVert *v, *v2;
        TransDataEdgeSlideVert *sv_array;
+       int sv_tot;
        BMBVHTree *btree;
        SmallHash table;
        EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
@@ -5091,12 +5231,13 @@ static int createEdgeSlideVerts(TransInfo *t)
                return 0;
        }
 
-       sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * j, "sv_array");
+       sv_tot = j;
+       sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * sv_tot, "sv_array");
        loop_nr = 0;
 
-       j = 0;
        while (1) {
                BMLoop *l, *l1, *l2;
+               BMVert *v_first;
 
                v = NULL;
                BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
@@ -5111,7 +5252,7 @@ static int createEdgeSlideVerts(TransInfo *t)
                if (!v->e)
                        continue;
                
-               first = v;
+               v_first = v;
 
                /*walk along the edge loop*/
                e = v->e;
@@ -5131,7 +5272,7 @@ static int createEdgeSlideVerts(TransInfo *t)
                                break;
 
                        v = BM_edge_other_vert(e, v);
-               } while (e != first->e);
+               } while (e != v_first->e);
 
                BM_elem_flag_disable(v, BM_ELEM_TAG);
 
@@ -5151,10 +5292,13 @@ static int createEdgeSlideVerts(TransInfo *t)
                }
 
                /*iterate over the loop*/
-               first = v;
+               v_first = v;
                do {
-                       TransDataEdgeSlideVert *sv = sv_array + j;
+                       TransDataEdgeSlideVert *sv;
 
+                       /* XXX, 'sv' will initialize multiple times, this is suspicious. see [#34024] */
+                       BLI_assert(BLI_smallhash_haskey(&table, (uintptr_t)v) != false);
+                       sv = sv_array + GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
                        sv->v = v;
                        sv->origvert = *v;
                        sv->loop_nr = loop_nr;
@@ -5176,9 +5320,8 @@ static int createEdgeSlideVerts(TransInfo *t)
                        e1 = e;
                        e = get_other_edge(v, e);
                        if (!e) {
-                               //v2=v, v = BM_edge_other_vert(l1->e, v);
-
-                               sv = sv_array + j + 1;
+                               BLI_assert(BLI_smallhash_haskey(&table, (uintptr_t)v) != false);
+                               sv = sv_array + GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
                                sv->v = v;
                                sv->origvert = *v;
                                sv->loop_nr = loop_nr;
@@ -5195,19 +5338,22 @@ static int createEdgeSlideVerts(TransInfo *t)
 
                                BM_elem_flag_disable(v, BM_ELEM_TAG);
                                BM_elem_flag_disable(v2, BM_ELEM_TAG);
-                               
-                               j += 2;
+
                                break;
                        }
 
                        l1 = get_next_loop(v, l1, e1, e, vec);
                        l2 = l2 ? get_next_loop(v, l2, e1, e, vec2) : NULL;
 
-                       j += 1;
+                       if (UNLIKELY(l1 == NULL && l2 != NULL)) {
+                               l1 = l2;
+                               l2 = NULL;
+                               swap_v3_v3(vec, vec2);
+                       }
 
                        BM_elem_flag_disable(v, BM_ELEM_TAG);
                        BM_elem_flag_disable(v2, BM_ELEM_TAG);
-               } while (e != first->e && l1);
+               } while (e != v_first->e && l1);
 
                loop_nr++;
        }
@@ -5215,7 +5361,7 @@ static int createEdgeSlideVerts(TransInfo *t)
        /* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
 
        sld->sv = sv_array;
-       sld->totsv = j;
+       sld->totsv = sv_tot;
        
        /* find mouse vectors, the global one, and one per loop in case we have
         * multiple loops selected, in case they are oriented different */
@@ -5246,6 +5392,7 @@ static int createEdgeSlideVerts(TransInfo *t)
                                                continue;
                                        }
 
+                                       BLI_assert(BLI_smallhash_haskey(&table, (uintptr_t)v) != false);
                                        j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
 
                                        if (sv_array[j].down) {
@@ -5323,7 +5470,7 @@ static int createEdgeSlideVerts(TransInfo *t)
        if (rv3d)
                calcNonProportionalEdgeSlide(t, sld, mval);
 
-       sld->origfaces_init = TRUE;
+       sld->origfaces_init = true;
        sld->em = em;
        
        /*zero out start*/
@@ -5523,7 +5670,7 @@ void freeEdgeSlideTempFaces(EdgeSlideData *sld)
 
                BLI_smallhash_release(&sld->origfaces);
 
-               sld->origfaces_init = FALSE;
+               sld->origfaces_init = false;
 
                /* arrays are dirty from removing faces: EDBM_index_arrays_free */
                EDBM_update_generic(sld->em, FALSE, TRUE);
@@ -5590,7 +5737,7 @@ void initEdgeSlide(TransInfo *t)
 
        /* set custom point first if you want value to be initialized by init */
        setCustomPoints(t, &t->mouse, sld->end, sld->start);
-       initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO);
+       initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO_FLIP);
        
        t->idx_max = 0;
        t->num.idx_max = 0;
@@ -5789,8 +5936,8 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
        char str[128];
        float final;
        EdgeSlideData *sld =  t->customData;
-       int flipped = sld->flipped_vtx;
-       int is_proportional = sld->is_proportional;
+       bool flipped = sld->flipped_vtx;
+       bool is_proportional = sld->is_proportional;
 
        final = t->values[0];
 
@@ -5806,12 +5953,12 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               BLI_snprintf(str, sizeof(str), "Edge Slide: %s (E)ven: %s, (F)lipped: %s",
-                            &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
+               BLI_snprintf(str, sizeof(str), IFACE_("Edge Slide: %s (E)ven: %s, (F)lipped: %s"),
+                            &c[0], !is_proportional ? IFACE_("ON") : IFACE_("OFF"), flipped ? IFACE_("ON") : IFACE_("OFF"));
        }
        else {
-               BLI_snprintf(str, sizeof(str), "Edge Slide: %.2f (E)ven: %s, (F)lipped: %s",
-                            final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
+               BLI_snprintf(str, sizeof(str), IFACE_("Edge Slide: %.4f (E)ven: %s, (F)lipped: %s"),
+                            final, !is_proportional ? IFACE_("ON") : IFACE_("OFF"), flipped ? IFACE_("ON") : IFACE_("OFF"));
        }
 
        CLAMP(final, -1.0f, 1.0f);
@@ -5822,7 +5969,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
        if (t->customData)
                doEdgeSlide(t, final);
        else {
-               strcpy(str, "Invalid Edge Selection");
+               strcpy(str, IFACE_("Invalid Edge Selection"));
                t->state = TRANS_CANCEL;
        }
 
@@ -5839,48 +5986,58 @@ static void calcVertSlideCustomPoints(struct TransInfo *t)
 {
        VertSlideData *sld = t->customData;
        TransDataVertSlideVert *sv = &sld->sv[sld->curr_sv_index];
-       int start[2] = {UNPACK2(sv->co_orig_2d)};
-       int end[2]   = {UNPACK2(sv->co_link_orig_2d[sv->co_link_curr])};
-       if (sld->flipped_vtx) {
+       float *co_orig = sv->co_orig_2d;
+       float *co_curr = sv->co_link_orig_2d[sv->co_link_curr];
+       const int start[2] = {co_orig[0], co_orig[1]};
+       const int end[2]   = {co_curr[0], co_curr[1]};
+
+       if (sld->flipped_vtx && sld->is_proportional == false) {
                setCustomPoints(t, &t->mouse, start, end);
        }
        else {
                setCustomPoints(t, &t->mouse, end, start);
        }
 }
-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)};
-
-       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;
+       /* 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;
-                       }
+       for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) {
+               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;
 
        /* 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);
 
-       sv = sld->sv;
-
-       for (i = 0; i < sld->totsv; i++, sv++) {
+       for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) {
                if (sv->co_link_tot > 1) {
                        float dir_dot_best = -FLT_MAX;
                        int co_link_curr_best = -1;
@@ -5924,12 +6081,12 @@ static int createVertSlideVerts(TransInfo *t)
        if (t->spacetype == SPACE_VIEW3D) {
                /* background mode support */
 //             v3d = t->sa ? t->sa->spacedata.first : NULL;
-               rv3d = t->ar ? t->ar->regiondata : NULL;
+               rv3d = ar ? ar->regiondata : NULL;
        }
 
-       sld->is_proportional = TRUE;
+       sld->is_proportional = true;
        sld->curr_sv_index = 0;
-       sld->flipped_vtx = FALSE;
+       sld->flipped_vtx = false;
 
        if (!rv3d) {
                /* ok, let's try to survive this */
@@ -5969,7 +6126,7 @@ static int createVertSlideVerts(TransInfo *t)
 
        j = 0;
        BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-               if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+               if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
                        int k;
                        sv_array[j].v = v;
                        copy_v3_v3(sv_array[j].co_orig_3d, v->co);
@@ -5990,18 +6147,30 @@ static int createVertSlideVerts(TransInfo *t)
                                if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
                                        BMVert *v_other = BM_edge_other_vert(e, v);
                                        copy_v3_v3(sv_array[j].co_link_orig_3d[k], v_other->co);
-                                       ED_view3d_project_float_v2_m4(ar,
-                                                                     sv_array[j].co_link_orig_3d[k],
-                                                                     sv_array[j].co_link_orig_2d[k],
-                                                                     projectMat);
+                                       if (ar) {
+                                               ED_view3d_project_float_v2_m4(ar,
+                                                                             sv_array[j].co_link_orig_3d[k],
+                                                                             sv_array[j].co_link_orig_2d[k],
+                                                                             projectMat);
+                                       }
+                                       else {
+                                               copy_v2_v2(sv_array[j].co_link_orig_2d[k],
+                                                          sv_array[j].co_link_orig_3d[k]);
+                                       }
                                        k++;
                                }
                        }
 
-                       ED_view3d_project_float_v2_m4(ar,
-                                                     sv_array[j].co_orig_3d,
-                                                     sv_array[j].co_orig_2d,
-                                                     projectMat);
+                       if (ar) {
+                               ED_view3d_project_float_v2_m4(ar,
+                                                             sv_array[j].co_orig_3d,
+                                                             sv_array[j].co_orig_2d,
+                                                             projectMat);
+                       }
+                       else {
+                               copy_v2_v2(sv_array[j].co_orig_2d,
+                                          sv_array[j].co_orig_3d);
+                       }
 
                        j++;
                }
@@ -6016,8 +6185,10 @@ static int createVertSlideVerts(TransInfo *t)
 
        t->customData = sld;
 
-       if (rv3d)
-               calcVertSlideMouseMove(t, t->mval, true);
+       if (rv3d) {
+               calcVertSlideMouseActiveVert(t, t->mval);
+               calcVertSlideMouseActiveEdges(t, t->mval);
+       }
 
        return 1;
 }
@@ -6092,16 +6263,27 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
                                case EKEY:
                                        if (event->val == KM_PRESS) {
                                                sld->is_proportional = !sld->is_proportional;
+                                               if (sld->flipped_vtx) {
+                                                       calcVertSlideCustomPoints(t);
+                                               }
                                                return 1;
                                        }
                                        break;
                                case FKEY:
                                {
                                        if (event->val == KM_PRESS) {
-                                               if (sld->is_proportional == FALSE) {
-                                                       sld->flipped_vtx = !sld->flipped_vtx;
-                                                       calcVertSlideCustomPoints(t);
-                                               }
+                                               sld->flipped_vtx = !sld->flipped_vtx;
+                                               calcVertSlideCustomPoints(t);
+                                               return 1;
+                                       }
+                                       break;
+                               }
+                               case CKEY:
+                               {
+                                       /* use like a modifier key */
+                                       if (event->val == KM_PRESS) {
+                                               t->flag ^= T_ALT_TRANSFORM;
+                                               calcVertSlideCustomPoints(t);
                                                return 1;
                                        }
                                        break;
@@ -6125,7 +6307,11 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
 #endif
                                case MOUSEMOVE:
                                {
-                                       calcVertSlideMouseMove(t, event->mval, false);
+                                       /* don't recalculat the best edge */
+                                       const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
+                                       if (is_clamp) {
+                                               calcVertSlideMouseActiveEdges(t, event->mval);
+                                       }
                                        calcVertSlideCustomPoints(t);
                                }
                                default:
@@ -6148,6 +6334,7 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
                        const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f;
                        const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
                        const int alpha_shade = -30;
+                       const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
                        int i;
 
                        if (v3d && v3d->zbuf)
@@ -6164,10 +6351,26 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
                        glLineWidth(line_size);
                        UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
                        glBegin(GL_LINES);
-                       sv = sld->sv;
-                       for (i = 0; i < sld->totsv; i++, sv++) {
-                               glVertex3fv(sv->co_orig_3d);
-                               glVertex3fv(sv->co_link_orig_3d[sv->co_link_curr]);
+                       if (is_clamp) {
+                               sv = sld->sv;
+                               for (i = 0; i < sld->totsv; i++, sv++) {
+                                       glVertex3fv(sv->co_orig_3d);
+                                       glVertex3fv(sv->co_link_orig_3d[sv->co_link_curr]);
+                               }
+                       }
+                       else {
+                               sv = sld->sv;
+                               for (i = 0; i < sld->totsv; i++, sv++) {
+                                       float a[3], b[3];
+                                       sub_v3_v3v3(a, sv->co_link_orig_3d[sv->co_link_curr], sv->co_orig_3d);
+                                       mul_v3_fl(a, 100.0f);
+                                       negate_v3_v3(b, a);
+                                       add_v3_v3(a, sv->co_orig_3d);
+                                       add_v3_v3(b, sv->co_orig_3d);
+
+                                       glVertex3fv(a);
+                                       glVertex3fv(b);
+                               }
                        }
                        bglEnd();
 
@@ -6200,15 +6403,14 @@ static int doVertSlide(TransInfo *t, float perc)
        sv = svlist;
 
        if (sld->is_proportional == TRUE) {
-               const float tperc = perc + 1.0f;
                for (i = 0; i < sld->totsv; i++, sv++) {
-                       interp_v3_v3v3(sv->v->co, sv->co_link_orig_3d[sv->co_link_curr], sv->co_orig_3d, tperc);
+                       interp_v3_v3v3(sv->v->co, sv->co_orig_3d, sv->co_link_orig_3d[sv->co_link_curr], perc);
                }
        }
        else {
                TransDataVertSlideVert *sv_curr = &sld->sv[sld->curr_sv_index];
                const float edge_len_curr = len_v3v3(sv_curr->co_orig_3d, sv_curr->co_link_orig_3d[sv_curr->co_link_curr]);
-               const float tperc = -perc * edge_len_curr;
+               const float tperc = perc * edge_len_curr;
 
                for (i = 0; i < sld->totsv; i++, sv++) {
                        float edge_len;
@@ -6237,42 +6439,51 @@ static int doVertSlide(TransInfo *t, float perc)
 int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
 {
        char str[128];
+       char *str_p;
        float final;
        VertSlideData *sld =  t->customData;
-       int flipped = sld->flipped_vtx;
-       int is_proportional = sld->is_proportional;
+       const bool flipped = sld->flipped_vtx;
+       const bool is_proportional = sld->is_proportional;
+       const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
+       const bool is_constrained = !(is_clamp == false || hasNumInput(&t->num));
 
        final = t->values[0];
 
        snapGrid(t, &final);
 
        /* only do this so out of range values are not displayed */
-       CLAMP(final, -1.0f, 1.0f);
+       if (is_constrained) {
+               CLAMP(final, 0.0f, 1.0f);
+       }
 
+       /* header string */
+       str_p = str;
+       str_p += BLI_snprintf(str_p, sizeof(str), IFACE_("Vert Slide: "));
        if (hasNumInput(&t->num)) {
                char c[NUM_STR_REP_LEN];
-
                applyNumInput(&t->num, &final);
-
                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");
+               str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%s", &c[0]);
        }
        else {
-               BLI_snprintf(str, sizeof(str), "Vert Slide: %.2f (E)ven: %s, (F)lipped: %s",
-                            final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
+               str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%.4f ", final);
        }
-
-       CLAMP(final, -1.0f, 1.0f);
-
-       t->values[0] = final;
+       str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("(E)ven: %s, "),
+                             !is_proportional ? IFACE_("ON") : IFACE_("OFF"));
+       if (!is_proportional) {
+               str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("(F)lipped: %s, "),
+                                     flipped ? IFACE_("ON") : IFACE_("OFF"));
+       }
+       str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), IFACE_("Alt or (C)lamp: %s"),
+                             is_clamp ? IFACE_("ON") : IFACE_("OFF"));
+       /* done with header string */
 
        /*do stuff here*/
-       if (t->customData)
+       if (t->customData) {
                doVertSlide(t, final);
+       }
        else {
-               strcpy(str, "Invalid Vert Selection");
+               strcpy(str, IFACE_("Invalid Vert Selection"));
                t->state = TRANS_CANCEL;
        }
 
@@ -6323,12 +6534,12 @@ int BoneRoll(TransInfo *t, const int UNUSED(mval[2]))
 
                outputNumInput(&(t->num), c);
 
-               sprintf(str, "Roll: %s", &c[0]);
+               sprintf(str, IFACE_("Roll: %s"), &c[0]);
 
                final = DEG2RADF(final);
        }
        else {
-               sprintf(str, "Roll: %.2f", RAD2DEGF(final));
+               sprintf(str, IFACE_("Roll: %.2f"), RAD2DEGF(final));
        }
 
        /* set roll values */
@@ -6394,16 +6605,16 @@ int BakeTime(TransInfo *t, const int mval[2])
                outputNumInput(&(t->num), c);
 
                if (time >= 0.0f)
-                       sprintf(str, "Time: +%s %s", c, t->proptext);
+                       sprintf(str, IFACE_("Time: +%s %s"), c, t->proptext);
                else
-                       sprintf(str, "Time: %s %s", c, t->proptext);
+                       sprintf(str, IFACE_("Time: %s %s"), c, t->proptext);
        }
        else {
                /* default header print */
                if (time >= 0.0f)
-                       sprintf(str, "Time: +%.3f %s", time, t->proptext);
+                       sprintf(str, IFACE_("Time: +%.3f %s"), time, t->proptext);
                else
-                       sprintf(str, "Time: %.3f %s", time, t->proptext);
+                       sprintf(str, IFACE_("Time: %.3f %s"), time, t->proptext);
        }
 
        for (i = 0; i < t->total; i++, td++) {
@@ -6463,7 +6674,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
                        t->con.applySize(t, NULL, mat);
                }
 
-               sprintf(str, "Mirror%s", t->con.text);
+               sprintf(str, IFACE_("Mirror%s"), t->con.text);
 
                for (i = 0, td = t->data; i < t->total; i++, td++) {
                        if (td->flag & TD_NOACTION)
@@ -6497,9 +6708,9 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
                recalcData(t);
 
                if (t->flag & T_2D_EDIT)
-                       ED_area_headerprint(t->sa, "Select a mirror axis (X, Y)");
+                       ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y)"));
                else
-                       ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)");
+                       ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
        }
 
        return 1;
@@ -6556,7 +6767,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
 
        recalcData(t);
 
-       ED_area_headerprint(t->sa, "Align");
+       ED_area_headerprint(t->sa, IFACE_("Align"));
 
        return 1;
 }
@@ -6580,9 +6791,10 @@ void initSeqSlide(TransInfo *t)
        t->num.increment = t->snap[1];
 }
 
-static void headerSeqSlide(TransInfo *t, float val[2], char *str)
+static void headerSeqSlide(TransInfo *t, float val[2], char *str, size_t str_len)
 {
        char tvec[NUM_STR_REP_LEN * 3];
+       char *str_p;
 
        if (hasNumInput(&t->num)) {
                outputNumInput(&(t->num), tvec);
@@ -6591,7 +6803,17 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str)
                sprintf(&tvec[0], "%.0f, %.0f", val[0], val[1]);
        }
 
-       sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
+       str_p = str;
+       str_p += BLI_snprintf(str, str_len, IFACE_("Sequence Slide: %s%s, ("), &tvec[0], t->con.text);
+
+       {
+               wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
+               if (kmi) {
+                       str_p += WM_keymap_item_to_string(kmi, str_p, str_len - (str_p - str));
+               }
+       }
+       str_p += BLI_snprintf(str_p, str_len - (str_p - str), IFACE_(" or Alt) Expand to fit %s"),
+                             (t->flag & T_ALT_TRANSFORM) ? IFACE_("ON") : IFACE_("OFF"));
 }
 
 static void applySeqSlide(TransInfo *t, float val[2])
@@ -6635,7 +6857,7 @@ int SeqSlide(TransInfo *t, const int UNUSED(mval[2]))
        t->values[0] = floor(t->values[0] + 0.5f);
        t->values[1] = floor(t->values[1] + 0.5f);
 
-       headerSeqSlide(t, t->values, str);
+       headerSeqSlide(t, t->values, str, sizeof(str));
        applySeqSlide(t, t->values);
 
        recalcData(t);
@@ -6856,7 +7078,7 @@ static void headerTimeTranslate(TransInfo *t, char *str)
                        sprintf(&tvec[0], "%.4f", val);
        }
 
-       sprintf(str, "DeltaX: %s", &tvec[0]);
+       sprintf(str, IFACE_("DeltaX: %s"), &tvec[0]);
 }
 
 static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
@@ -6997,7 +7219,7 @@ static void headerTimeSlide(TransInfo *t, float sval, char *str)
                sprintf(&tvec[0], "%.4f", val);
        }
 
-       sprintf(str, "TimeSlide: %s", &tvec[0]);
+       sprintf(str, IFACE_("TimeSlide: %s"), &tvec[0]);
 }
 
 static void applyTimeSlide(TransInfo *t, float sval)
@@ -7129,7 +7351,7 @@ static void headerTimeScale(TransInfo *t, char *str)
        else
                sprintf(&tvec[0], "%.4f", t->values[0]);
 
-       sprintf(str, "ScaleX: %s", &tvec[0]);
+       sprintf(str, IFACE_("ScaleX: %s"), &tvec[0]);
 }
 
 static void applyTimeScale(TransInfo *t)
@@ -7198,3 +7420,10 @@ void BIF_TransformSetUndo(const char *UNUSED(str))
        // TRANSFORM_FIX_ME
        //Trans.undostr = str;
 }
+
+
+/* TODO, move to: transform_queries.c */
+bool checkUseLocalCenter_GraphEdit(TransInfo *t)
+{
+       return ((t->around == V3D_LOCAL) && !ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE));
+}