diff options
5 files changed, 20 insertions, 29 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 73f05fb3d80..fd9d699ed01 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -5131,6 +5131,8 @@ def km_transform_modal_map(_params): ("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None), ("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, None), ("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', "shift": True}, None), + ("PRECISION", {"type": 'LEFT_SHIFT', "value": 'ANY', "any": True}, None), + ("PRECISION", {"type": 'RIGHT_SHIFT', "value": 'ANY', "any": True}, None), ]) return keymap diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index 4cffb6805a0..234781b7bc8 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -3962,6 +3962,8 @@ def km_transform_modal_map(_params): ("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None), ("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'ANY'}, None), ("AUTOCONSTRAINPLANE", {"type": 'MIDDLEMOUSE', "value": 'ANY', "shift": True}, None), + ("PRECISION", {"type": 'LEFT_SHIFT', "value": 'ANY', "any": True}, None), + ("PRECISION", {"type": 'RIGHT_SHIFT', "value": 'ANY', "any": True}, None), ]) return keymap diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index d46cdb62f30..2fbcbe22349 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -695,6 +695,7 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""}, {TFM_MODAL_AUTOCONSTRAINT, "AUTOCONSTRAIN", 0, "Automatic Constraint", ""}, {TFM_MODAL_AUTOCONSTRAINTPLANE, "AUTOCONSTRAINPLANE", 0, "Automatic Constraint Plane", ""}, + {TFM_MODAL_PRECISION, "PRECISION", 0, "Precision Mode", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -806,8 +807,6 @@ int transformEvent(TransInfo *t, const wmEvent *event) const int modifiers_prev = t->modifiers; const int mode_prev = t->mode; - t->redraw |= handleMouseInput(t, &t->mouse, event); - /* Handle modal numinput events first, if already activated. */ if (((event->val == KM_PRESS) || (event->type == EVT_MODAL_MAP)) && hasNumInput(&t->num) && handleNumInput(t->context, &(t->num), event)) { @@ -1095,6 +1094,19 @@ int transformEvent(TransInfo *t, const wmEvent *event) handled = true; } break; + case TFM_MODAL_PRECISION: + if (event->prevval == KM_PRESS) { + t->modifiers |= MOD_PRECISION; + /* Shift is modifier for higher precision transform. */ + t->mouse.precision = 1; + t->redraw |= TREDRAW_HARD; + } + else if (event->prevval == KM_RELEASE) { + t->modifiers &= ~MOD_PRECISION; + t->mouse.precision = 0; + t->redraw |= TREDRAW_HARD; + } + break; /* Those two are only handled in transform's own handler, see T44634! */ case TFM_MODAL_EDGESLIDE_UP: case TFM_MODAL_EDGESLIDE_DOWN: diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index fe2c3d2fcdf..be04feb17c8 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -285,6 +285,8 @@ enum { TFM_MODAL_AUTOCONSTRAINT = 28, TFM_MODAL_AUTOCONSTRAINTPLANE = 29, + + TFM_MODAL_PRECISION = 30, }; /** \} */ @@ -720,9 +722,6 @@ typedef enum { void initMouseInput( TransInfo *t, MouseInput *mi, const float center[2], const int mval[2], const bool precision); void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode); -eRedrawFlag handleMouseInput(struct TransInfo *t, - struct MouseInput *mi, - const struct wmEvent *event); void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, const int mval[2], diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index ec84eab27a9..bfeb96d18c4 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -499,28 +499,4 @@ void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float outp } } -eRedrawFlag handleMouseInput(TransInfo *t, MouseInput *mi, const wmEvent *event) -{ - eRedrawFlag redraw = TREDRAW_NOTHING; - - switch (event->type) { - case EVT_LEFTSHIFTKEY: - case EVT_RIGHTSHIFTKEY: - if (event->val == KM_PRESS) { - t->modifiers |= MOD_PRECISION; - /* Shift is modifier for higher precision transform. */ - mi->precision = 1; - redraw = TREDRAW_HARD; - } - else if (event->val == KM_RELEASE) { - t->modifiers &= ~MOD_PRECISION; - mi->precision = 0; - redraw = TREDRAW_HARD; - } - break; - } - - return redraw; -} - /** \} */ |