diff options
Diffstat (limited to 'source/blender/editors/transform/transform_input.c')
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index b60c8bf47f6..5b5c4902377 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -30,10 +30,13 @@ #include "DNA_screen_types.h" +#include "BKE_context.h" + #include "BLI_math.h" #include "BLI_utildefines.h" #include "WM_types.h" +#include "WM_api.h" #include "transform.h" @@ -341,14 +344,42 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) break; } + /* 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 */ + if (t->flag & T_MODAL) { + t->flag |= T_MODAL_CURSOR_SET; + WM_cursor_modal_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) { + t->flag |= T_MODAL_CURSOR_SET; + WM_cursor_modal_set(win, CURSOR_NONE); + } + break; + default: + break; + } + /* if we've allocated new data, free the old data * less hassle then checking before every alloc above */ if (mi_data_prev && (mi_data_prev != mi->data)) { MEM_freeN(mi_data_prev); } - /* bootstrap mouse input with initial values */ - applyMouseInput(t, mi, mi->imval, t->values); + /* Don't write into the values when non-modal because they are already set from operator redo values. */ + if (t->flag & T_MODAL) { + /* bootstrap mouse input with initial values */ + applyMouseInput(t, mi, mi->imval, t->values); + } } void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float values[3])) @@ -391,6 +422,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); } |