Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2020-12-07 23:36:11 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2020-12-07 23:36:23 +0300
commitc822f66bb83eaa0baf90ce662375c0b0aefb9dec (patch)
treefadf738b35fe7a790997b8d58c222d38ecb89e0f /source/blender/editors/transform/transform_mode_edge_seq_slide.c
parent29fb12da589eeb3bbc31b81874526208b35334cb (diff)
Fix T83307: Some modal keys of transform operators don't correspond to the expected effect
The transform modes `shrinkfatten` and `seq_slide` have a special way of handling events. They use modal events in a different way than expected. Therefore, this commit adds special event handles for these modes and removes the keymodal tips from the status bar. These effects are already described in the header anyway.
Diffstat (limited to 'source/blender/editors/transform/transform_mode_edge_seq_slide.c')
-rw-r--r--source/blender/editors/transform/transform_mode_edge_seq_slide.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
index dfa5c164acf..1682b5bfe31 100644
--- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
@@ -32,6 +32,7 @@
#include "ED_screen.h"
#include "WM_api.h"
+#include "WM_types.h"
#include "UI_interface.h"
@@ -45,6 +46,18 @@
/** \name Transform (Sequencer Slide)
* \{ */
+static eRedrawFlag seq_slide_handleEvent(struct TransInfo *t, const wmEvent *event)
+{
+ BLI_assert(t->mode == TFM_SEQ_SLIDE);
+ wmKeyMapItem *kmi = t->custom.mode.data;
+ if (event->type == kmi->type && event->val == kmi->val) {
+ /* Allows the 'Expand to fit' effect to be enabled as a toogle. */
+ t->flag ^= T_ALT_TRANSFORM;
+ return TREDRAW_HARD;
+ }
+ return TREDRAW_NOTHING;
+}
+
static void headerSeqSlide(TransInfo *t, const float val[2], char str[UI_MAX_DRAW_STR])
{
char tvec[NUM_STR_REP_LEN * 3];
@@ -61,7 +74,7 @@ static void headerSeqSlide(TransInfo *t, const float val[2], char str[UI_MAX_DRA
str + ofs, UI_MAX_DRAW_STR - ofs, TIP_("Sequence Slide: %s%s, ("), &tvec[0], t->con.text);
if (t->keymap) {
- wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
+ wmKeyMapItem *kmi = t->custom.mode.data;
if (kmi) {
ofs += WM_keymap_item_to_string(kmi, false, str + ofs, UI_MAX_DRAW_STR - ofs);
}
@@ -91,7 +104,7 @@ static void applySeqSlideValue(TransInfo *t, const float val[2])
static void applySeqSlide(TransInfo *t, const int mval[2])
{
char str[UI_MAX_DRAW_STR];
- float values_final[2] = {0.0f};
+ float values_final[3] = {0.0f};
snapSequenceBounds(t, mval);
if (applyNumInput(&t->num, values_final)) {
@@ -126,6 +139,7 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
void initSeqSlide(TransInfo *t)
{
t->transform = applySeqSlide;
+ t->handleEvent = seq_slide_handleEvent;
initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
@@ -142,5 +156,8 @@ void initSeqSlide(TransInfo *t)
* (supporting frames in addition to "natural" time...). */
t->num.unit_type[0] = B_UNIT_NONE;
t->num.unit_type[1] = B_UNIT_NONE;
+
+ /* Workaround to use the same key as the modal keymap. */
+ t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
}
/** \} */