diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-08-08 16:59:29 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-08-08 16:59:29 +0300 |
commit | b72eddac6190353714745756dcc335f98cda1369 (patch) | |
tree | d5afab74286cffc620ccd9e7018b28a03f5d3884 | |
parent | 4b3315fc98a9edb254bf99e2747fbccb7813a34b (diff) |
Fix T100280: GG not toggling the offset transform mode in tracker
Caused by {rB791bfae1d64b}.
The solution was to create the special handle for the Move Clip and Mask
transformation.
One change that cannot be reversed is showing the `G` shortcut in the
statusbar.
But the description of this shortcut was not even correct before.
4 files changed, 30 insertions, 7 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 7567fd0a91d..bb1776e2756 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1008,13 +1008,6 @@ int transformEvent(TransInfo *t, const wmEvent *event) t->redraw |= TREDRAW_HARD; handled = true; } - else if (t->options & (CTX_MOVIECLIP | CTX_MASK)) { - restoreTransObjects(t); - - t->flag ^= T_ALT_TRANSFORM; - t->redraw |= TREDRAW_HARD; - handled = true; - } } else { if (t->mode == TFM_TRANSLATION) { diff --git a/source/blender/editors/transform/transform_mode_resize.c b/source/blender/editors/transform/transform_mode_resize.c index 1ccda96fecb..309b8759320 100644 --- a/source/blender/editors/transform/transform_mode_resize.c +++ b/source/blender/editors/transform/transform_mode_resize.c @@ -287,6 +287,7 @@ void initResize(TransInfo *t, float mouse_dir_constraint[3]) { t->mode = TFM_RESIZE; t->transform = applyResize; + t->handleEvent = NULL; t->tsnap.applySnap = ApplySnapResize; t->tsnap.distance = ResizeBetween; diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c index a7207b36578..ece9fe8855f 100644 --- a/source/blender/editors/transform/transform_mode_rotate.c +++ b/source/blender/editors/transform/transform_mode_rotate.c @@ -351,6 +351,7 @@ void initRotation(TransInfo *t) t->mode = TFM_ROTATION; t->transform = applyRotation; + t->handleEvent = NULL; t->transform_matrix = applyRotationMatrix; t->tsnap.applySnap = ApplySnapRotation; t->tsnap.distance = RotationBetween; diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c index 04a41814b53..c4f3d5575cd 100644 --- a/source/blender/editors/transform/transform_mode_translate.c +++ b/source/blender/editors/transform/transform_mode_translate.c @@ -56,6 +56,8 @@ struct TranslateCustomData { struct { enum eTranslateRotateMode rotate_mode; } prev; + + const wmKeyMapItem *move_kmi; }; /** \} */ @@ -170,6 +172,27 @@ static void transdata_elem_translate_fn(void *__restrict iter_data_v, /** \} */ /* -------------------------------------------------------------------- */ +/** \name Events to Move Clip and Mask + * \{ */ + +static eRedrawFlag translate_handleEvent(struct TransInfo *t, const wmEvent *event) +{ + BLI_assert(t->options & (CTX_MOVIECLIP | CTX_MASK)); + struct TranslateCustomData *custom_data = t->custom.mode.data; + const wmKeyMapItem *kmi = custom_data->move_kmi; + if (kmi && event->type == kmi->type && event->val == kmi->val) { + /* Toggles the handle offset effect. */ + restoreTransObjects(t); + + t->flag ^= T_ALT_TRANSFORM; + return TREDRAW_HARD; + } + return TREDRAW_NOTHING; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Transform (Translation) * \{ */ @@ -620,6 +643,11 @@ void initTranslation(TransInfo *t) custom_data->prev.rotate_mode = TRANSLATE_ROTATE_OFF; t->custom.mode.data = custom_data; t->custom.mode.use_free = true; + + if (t->keymap && (t->options & (CTX_MOVIECLIP | CTX_MASK))) { + custom_data->move_kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE); + t->handleEvent = translate_handleEvent; + } } /** \} */ |