From 9449866bdca7736155b1d8a42bfb230ec3084d51 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 14 Feb 2013 14:01:02 +0000 Subject: fix (for one case of...) [#33949] T_ALT_TRANSFORM conflicts with "emulate 3 button mouse" ShrinkFatten operator now uses scale key to toggle 'Even thickness' option. With the default keymap this is Alt+S,S. Added functionality so the header print can get the key used for the modal keymap, some other operators should make use of this too. --- source/blender/editors/transform/transform.c | 34 ++++++++++++++++++++++------ source/blender/editors/transform/transform.h | 1 + 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/transform') diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a76fd4a8746..ae7e3eeba28 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -958,6 +958,10 @@ int transformEvent(TransInfo *t, wmEvent *event) initSnapping(t, NULL); // need to reinit after mode change t->redraw |= TREDRAW_HARD; } + else if (t->mode == TFM_SHRINKFATTEN) { + t->flag ^= T_ALT_TRANSFORM; + t->redraw |= TREDRAW_HARD; + } else if (t->mode == TFM_RESIZE) { if (t->options & CTX_MOVIECLIP) { restoreTransObjects(t); @@ -1920,6 +1924,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int } + t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap); + initSnapping(t, op); // Initialize snapping data AFTER mode flags /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */ @@ -4054,7 +4060,8 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) { float distance; int i; - char str[64]; + char str[128]; + char *str_p; TransData *td = t->data; distance = -t->values[0]; @@ -4064,18 +4071,30 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) applyNumInput(&t->num, &distance); /* header print for NumInput */ + str_p = str; + str_p += BLI_snprintf(str_p, sizeof(str), "Shrink/Fatten:"); if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; - outputNumInput(&(t->num), c); - - sprintf(str, "Shrink/Fatten: %s %s", c, t->proptext); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s", c); } else { /* default header print */ - sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %.4f", distance); } + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s, (", t->proptext); + { + wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE); + if (kmi) { + str_p += WM_keymap_item_to_string(kmi, str_p, sizeof(str) - (str_p - str)); + } + } + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), ") Even Thickness %s", + (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF"); + /* done with header string */ + + t->values[0] = -distance; for (i = 0; i < t->total; i++, td++) { @@ -6398,14 +6417,15 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2])) /* header string */ str_p = str; + str_p += BLI_snprintf(str_p, sizeof(str), "Vert Slide: "); if (hasNumInput(&t->num)) { char c[NUM_STR_REP_LEN]; applyNumInput(&t->num, &final); outputNumInput(&(t->num), c); - str_p += BLI_snprintf(str, sizeof(str), "Vert Slide: %s", &c[0]); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%s", &c[0]); } else { - str_p += BLI_snprintf(str_p, sizeof(str), "Vert Slide: %.4f ", final); + str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%.4f ", final); } str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(E)ven: %s, ", !is_proportional ? "ON" : "OFF"); if (!is_proportional) { diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 55b7e9fae60..78f346be2aa 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -352,6 +352,7 @@ typedef struct TransInfo { struct Scene *scene; struct ToolSettings *settings; struct wmTimer *animtimer; + struct wmKeyMap *keymap; /* so we can do lookups for header text */ int mval[2]; /* current mouse position */ struct Object *obedit; void *draw_handle_apply; -- cgit v1.2.3