diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 18:01:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 18:01:02 +0400 |
commit | 9449866bdca7736155b1d8a42bfb230ec3084d51 (patch) | |
tree | 4287cbbe7bee19d0d01bd6bdf52313a484449e0c /source/blender/editors | |
parent | ceb3624b115848d96f11f1507474ee5a61f9e0d0 (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/metaball/mball_ops.c | 7 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 34 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 1 |
3 files changed, 31 insertions, 11 deletions
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c index e98654f589a..f91d57424a1 100644 --- a/source/blender/editors/metaball/mball_ops.c +++ b/source/blender/editors/metaball/mball_ops.c @@ -28,10 +28,6 @@ * \ingroup edmeta */ - -#include "WM_api.h" -#include "WM_types.h" - #include "RNA_access.h" #include "ED_mball.h" @@ -40,6 +36,9 @@ #include "BLI_utildefines.h" +#include "WM_api.h" +#include "WM_types.h" + #include "mball_intern.h" void ED_operatortypes_metaball(void) 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; |