Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / transform / transform_input.c
index df77b6129a7f6b12fdf5853d6384a3dd4e537803..2004bba4f091385bb13e442fc3b588c01c28ff91 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "transform.h"
 
-#include "MEM_guardedalloc.h" 
+#include "MEM_guardedalloc.h"
 
 /* ************************** INPUT FROM MOUSE *************************** */
 
@@ -128,7 +128,7 @@ void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, const int mval_start[
        int *data;
 
        mi->data = MEM_reallocN(mi->data, sizeof(int) * 4);
-       
+
        data = mi->data;
 
        data[0] = mval_start[0];
@@ -143,7 +143,7 @@ static void InputCustomRatioFlip(TransInfo *UNUSED(t), MouseInput *mi, const dou
        double distance;
        double dx, dy;
        const int *data = mi->data;
-       
+
        if (data) {
                int mdx, mdy;
                dx = data[2] - data[0];
@@ -347,20 +347,24 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
        /* setup for the mouse cursor: either set a custom one,
         * or hide it if it will be drawn with the helpline */
        wmWindow *win = CTX_wm_window(t->context);
-       switch(t->helpline) {
-        case HLP_NONE:
-                /* INPUT_VECTOR, INPUT_CUSTOM_RATIO, INPUT_CUSTOM_RATIO_FLIP */
-                WM_cursor_set(win, BC_HANDCURSOR);
-                break;
-        case HLP_SPRING:
-        case HLP_ANGLE:
-        case HLP_TRACKBALL:
-        case HLP_HARROW:
-        case HLP_VARROW:
-                WM_cursor_set(win, CURSOR_NONE);
-                break;
-        default:
-                break;
+       switch (t->helpline) {
+               case HLP_NONE:
+                       /* INPUT_VECTOR, INPUT_CUSTOM_RATIO, INPUT_CUSTOM_RATIO_FLIP */
+                       if (t->flag & T_MODAL) {
+                               WM_cursor_set(win, BC_NSEW_SCROLLCURSOR);
+                       }
+                       break;
+               case HLP_SPRING:
+               case HLP_ANGLE:
+               case HLP_TRACKBALL:
+               case HLP_HARROW:
+               case HLP_VARROW:
+                       if (t->flag & T_MODAL) {
+                               WM_cursor_set(win, CURSOR_NONE);
+                       }
+                       break;
+               default:
+                       break;
        }
 
        /* if we've allocated new data, free the old data
@@ -413,6 +417,17 @@ void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float outp
                mi->apply(t, mi, mval_db, output);
        }
 
+       if (!is_zero_v3(t->values_modal_offset)) {
+               float values_ofs[3];
+               if (t->con.mode & CON_APPLY) {
+                       mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset);
+               }
+               else {
+                       copy_v3_v3(values_ofs, t->values_modal_offset);
+               }
+               add_v3_v3(t->values, values_ofs);
+       }
+
        if (mi->post) {
                mi->post(t, output);
        }