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_shrink_fatten.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_shrink_fatten.c')
-rw-r--r--source/blender/editors/transform/transform_mode_shrink_fatten.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_mode_shrink_fatten.c b/source/blender/editors/transform/transform_mode_shrink_fatten.c
index cdea388529f..6058a2824e9 100644
--- a/source/blender/editors/transform/transform_mode_shrink_fatten.c
+++ b/source/blender/editors/transform/transform_mode_shrink_fatten.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 (Shrink-Fatten)
* \{ */
+static eRedrawFlag shrinkfatten_handleEvent(struct TransInfo *t, const wmEvent *event)
+{
+ BLI_assert(t->mode == TFM_SHRINKFATTEN);
+ wmKeyMapItem *kmi = t->custom.mode.data;
+ if (event->type == kmi->type && event->val == kmi->val) {
+ /* Allows the 'Even Thickness' effect to be enabled as a toogle. */
+ t->flag ^= T_ALT_TRANSFORM;
+ return TREDRAW_HARD;
+ }
+ return TREDRAW_NOTHING;
+}
+
static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
{
float distance;
@@ -78,7 +91,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
ofs += BLI_strncpy_rlen(str + ofs, ", (", sizeof(str) - ofs);
if (t->keymap) {
- wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
+ wmKeyMapItem *kmi = t->custom.mode.data;
if (kmi) {
ofs += WM_keymap_item_to_string(kmi, false, str + ofs, sizeof(str) - ofs);
}
@@ -121,6 +134,7 @@ void initShrinkFatten(TransInfo *t)
else {
t->mode = TFM_SHRINKFATTEN;
t->transform = applyShrinkFatten;
+ t->handleEvent = shrinkfatten_handleEvent;
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
@@ -134,6 +148,9 @@ void initShrinkFatten(TransInfo *t)
t->num.unit_type[0] = B_UNIT_LENGTH;
t->flag |= T_NO_CONSTRAINT;
+
+ /* Workaround to use the same key as the modal keymap. */
+ t->custom.mode.data = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
}
}
/** \} */