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 <mano-wii>2022-08-03 21:12:18 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-08-04 16:54:29 +0300
commit791bfae1d64b8969a7edbc6b020f7fba873f77ee (patch)
tree8dd516243342af87c757244ca2548bec8560ce5a /source/blender/editors/transform
parentc67d4117d4bd40d18681eecbcf72108c3d9829b6 (diff)
Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in Edit Mode
Add specific modal keyitem for Vert/Edge Slide or TrackBall. Note that there is a workround to avoid repeated keys in the status bar. Reviewed By: campbellbarton Maniphest Tasks: T100129 Differential Revision: https://developer.blender.org/D15597
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform.c92
-rw-r--r--source/blender/editors/transform/transform.h3
2 files changed, 79 insertions, 16 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 8dcbf07b776..7567fd0a91d 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -641,10 +641,48 @@ static bool transform_modal_item_poll(const wmOperator *op, int value)
}
case TFM_MODAL_TRANSLATE:
case TFM_MODAL_ROTATE:
- case TFM_MODAL_RESIZE: {
+ case TFM_MODAL_RESIZE:
+ case TFM_MODAL_VERT_EDGE_SLIDE:
+ case TFM_MODAL_TRACKBALL: {
if (!transform_mode_is_changeable(t->mode)) {
return false;
}
+ if (value == TFM_MODAL_TRANSLATE && t->mode == TFM_TRANSLATION) {
+ return false;
+ }
+ if (value == TFM_MODAL_ROTATE && t->mode == TFM_ROTATION) {
+ return false;
+ }
+ if (value == TFM_MODAL_RESIZE && t->mode == TFM_RESIZE) {
+ return false;
+ }
+ if (value == TFM_MODAL_VERT_EDGE_SLIDE &&
+ (t->data_type != &TransConvertType_Mesh ||
+ /* WORKAROUND: Avoid repeated keys in status bar.
+ *
+ * Previously, `Vert/Edge Slide` and `Move` were triggered by the same modal key.
+ * But now, to fix T100129, `Vert/Edge Slide` has its own modal key.
+ * However by default it uses the same key as `Move` (G).
+ * So, to avoid displaying the same key twice (G and G), only display this modal key
+ * during the `Move` operation.
+ *
+ * Ideally we should check if it really uses the same key. */
+ t->mode != TFM_TRANSLATION)) {
+ return false;
+ }
+ if (value == TFM_MODAL_TRACKBALL &&
+ /* WORKAROUND: Avoid repeated keys in status bar.
+ *
+ * Previously, `Trackball` and `Rotate` were triggered by the same modal key.
+ * But now, to fix T100129, `Trackball` has its own modal key.
+ * However by default it uses the same key as `Rotate` (R).
+ * So, to avoid displaying the same key twice (R and R), only display this modal key
+ * during the `Rotate` operation.
+ *
+ * Ideally we should check if it really uses the same key. */
+ t->mode != TFM_ROTATION) {
+ return false;
+ }
break;
}
}
@@ -691,7 +729,9 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
"Toggle Direction for Node Auto-Offset",
""},
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""},
+ {TFM_MODAL_VERT_EDGE_SLIDE, "VERT_EDGE_SLIDE", 0, "Vert/Edge Slide", ""},
{TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
+ {TFM_MODAL_TRACKBALL, "TRACKBALL", 0, "TrackBall", ""},
{TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
{TFM_MODAL_AUTOCONSTRAINT, "AUTOCONSTRAIN", 0, "Automatic Constraint", ""},
{TFM_MODAL_AUTOCONSTRAINTPLANE, "AUTOCONSTRAINPLANE", 0, "Automatic Constraint Plane", ""},
@@ -934,8 +974,15 @@ int transformEvent(TransInfo *t, const wmEvent *event)
handled = true;
break;
case TFM_MODAL_TRANSLATE:
+ case TFM_MODAL_VERT_EDGE_SLIDE:
/* only switch when... */
- if (t->mode == TFM_TRANSLATION) {
+ if (!transform_mode_is_changeable(t->mode)) {
+ break;
+ }
+ if (event->val == TFM_MODAL_VERT_EDGE_SLIDE) {
+ if (ELEM(t->mode, TFM_VERT_SLIDE, TFM_EDGE_SLIDE)) {
+ break;
+ }
if ((t->obedit_type == OB_MESH) && (t->spacetype == SPACE_VIEW3D)) {
restoreTransObjects(t);
resetTransModal(t);
@@ -969,7 +1016,10 @@ int transformEvent(TransInfo *t, const wmEvent *event)
handled = true;
}
}
- else if (transform_mode_is_changeable(t->mode)) {
+ else {
+ if (t->mode == TFM_TRANSLATION) {
+ break;
+ }
restoreTransObjects(t);
resetTransModal(t);
resetTransRestrictions(t);
@@ -980,23 +1030,33 @@ int transformEvent(TransInfo *t, const wmEvent *event)
}
break;
case TFM_MODAL_ROTATE:
+ case TFM_MODAL_TRACKBALL:
/* only switch when... */
+ if (!transform_mode_is_changeable(t->mode)) {
+ break;
+ }
+ if (event->val == TFM_MODAL_TRACKBALL) {
+ if (t->mode == TFM_TRACKBALL) {
+ break;
+ }
+ }
+ else if (t->mode == TFM_ROTATION) {
+ break;
+ }
if (!(t->options & CTX_TEXTURE_SPACE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
- if (transform_mode_is_changeable(t->mode)) {
- restoreTransObjects(t);
- resetTransModal(t);
- resetTransRestrictions(t);
+ restoreTransObjects(t);
+ resetTransModal(t);
+ resetTransRestrictions(t);
- if (t->mode == TFM_ROTATION) {
- transform_mode_init(t, NULL, TFM_TRACKBALL);
- }
- else {
- transform_mode_init(t, NULL, TFM_ROTATION);
- }
- initSnapping(t, NULL); /* need to reinit after mode change */
- t->redraw |= TREDRAW_HARD;
- handled = true;
+ if (event->val == TFM_MODAL_TRACKBALL) {
+ transform_mode_init(t, NULL, TFM_TRACKBALL);
}
+ else {
+ transform_mode_init(t, NULL, TFM_ROTATION);
+ }
+ initSnapping(t, NULL); /* need to reinit after mode change */
+ t->redraw |= TREDRAW_HARD;
+ handled = true;
}
break;
case TFM_MODAL_RESIZE:
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index fc59787e1ec..fee6acfbfa7 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -253,6 +253,9 @@ enum {
TFM_MODAL_AUTOCONSTRAINTPLANE = 29,
TFM_MODAL_PRECISION = 30,
+
+ TFM_MODAL_VERT_EDGE_SLIDE = 31,
+ TFM_MODAL_TRACKBALL = 32,
};
/** \} */