diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-13 18:22:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-13 18:22:37 +0400 |
commit | 587b91be4ad3234d540d363908c628e35355734a (patch) | |
tree | 7e098145feafd2c71ff9f0d23f8c704bb6cb86cc /source/blender/editors/transform | |
parent | af5d994b155650ef390635030bb5e9b528637695 (diff) |
transform feature - G-key during transform toggles slide (edge slide or vertex slide), similar to how trackbacll rotate toggles.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r-- | source/blender/editors/transform/transform.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 63663b408ca..8ce388af89a 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -880,19 +880,45 @@ int transformEvent(TransInfo *t, wmEvent *event) break; case TFM_MODAL_TRANSLATE: /* only switch when... */ - if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) { + if (ELEM5(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) { + if (t->mode == TFM_EDGE_SLIDE) { + freeEdgeSlideVerts(t); + } + else if (t->mode == TFM_VERT_SLIDE) { + freeVertSlideVerts(t); + } resetTransRestrictions(t); restoreTransObjects(t); initTranslation(t); initSnapping(t, NULL); // need to reinit after mode change t->redraw |= TREDRAW_HARD; + WM_event_add_mousemove(t->context); } - else if (t->mode == TFM_TRANSLATION) { - if (t->options & (CTX_MOVIECLIP | CTX_MASK)) { - restoreTransObjects(t); + else { + if (t->obedit && t->obedit->type == OB_MESH) { + if (t->mode == TFM_TRANSLATION) { + resetTransRestrictions(t); + restoreTransObjects(t); - t->flag ^= T_ALT_TRANSFORM; - t->redraw |= TREDRAW_HARD; + /* first try edge slide */ + initEdgeSlide(t); + /* if that fails, do vertex slide */ + if (t->state == TRANS_CANCEL) { + t->state = TRANS_STARTING; + initVertSlide(t); + } + initSnapping(t, NULL); // need to reinit after mode change + t->redraw |= TREDRAW_HARD; + WM_event_add_mousemove(t->context); + } + } + else if (t->options & (CTX_MOVIECLIP | CTX_MASK)) { + if (t->mode == TFM_TRANSLATION) { + restoreTransObjects(t); + + t->flag ^= T_ALT_TRANSFORM; + t->redraw |= TREDRAW_HARD; + } } } break; @@ -6184,7 +6210,6 @@ static int doVertSlide(TransInfo *t, float perc) else { madd_v3_v3v3fl(sv->v->co, sv->co_orig_3d, dir, tperc); } - printf("%.6f\n", tperc); } else { copy_v3_v3(sv->v->co, sv->co_orig_3d); |