diff options
author | Martin Poirier <theeth@yahoo.com> | 2007-12-26 06:06:59 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2007-12-26 06:06:59 +0300 |
commit | b0b3a69c19fd60e6c48a877b22cab0ba48882c20 (patch) | |
tree | e4f152fae09977ebc1cf8bc896a35e296c3f3841 /source | |
parent | 6e812d5901bac112de3168ec530c42681216f6ec (diff) |
== Transform: Warp ==
Adding special hotkey (MMB) to reverse the direction of the warp.
Normal input is 0..360 mapped to the horizontal position of the mouse on the 3D view (the 3D view becomes a sort of giant horizontal slider), pressing MMB reverses the value to 0..-360 and back if you press it again.
I've used MMB mostly because it's unused in Warp, easily accessible and already used to switches mode for Shear (shear x/y).
Indirectly suggested by a user question on ba.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/transform.h | 1 | ||||
-rw-r--r-- | source/blender/src/transform.c | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/include/transform.h b/source/blender/include/transform.h index b2a3913465f..58cbd5c8755 100644 --- a/source/blender/include/transform.h +++ b/source/blender/include/transform.h @@ -303,6 +303,7 @@ void convertVecToDisplayNum(float *vec, float *num); void convertDisplayNumToVec(float *num, float *vec); void initWarp(TransInfo *t); +int handleEventWarp(TransInfo *t, unsigned short event, short val); int Warp(TransInfo *t, short mval[2]); void initShear(TransInfo *t); diff --git a/source/blender/src/transform.c b/source/blender/src/transform.c index 632af9e269b..82e7a446de5 100644 --- a/source/blender/src/transform.c +++ b/source/blender/src/transform.c @@ -1399,6 +1399,7 @@ void initWarp(TransInfo *t) t->mode = TFM_WARP; t->transform = Warp; + t->handleEvent = handleEventWarp; t->idx_max = 0; t->num.idx_max = 0; @@ -1435,6 +1436,24 @@ void initWarp(TransInfo *t) t->val= (max[0]-min[0])/2.0f; /* t->val is X dimension projected boundbox */ } +int handleEventWarp(TransInfo *t, unsigned short event, short val) +{ + int status = 0; + + if (event == MIDDLEMOUSE && val) + { + // Use customData pointer to signal warp direction + if (t->customData == 0) + t->customData = (void*)1; + else + t->customData = 0; + + status = 1; + } + + return status; +} + int Warp(TransInfo *t, short mval[2]) { TransData *td = t->data; @@ -1465,6 +1484,11 @@ int Warp(TransInfo *t, short mval[2]) /* amount of degrees for warp */ circumfac= 360.0f * InputHorizontalRatio(t, mval); + + if (t->customData) /* non-null value indicates reversed input */ + { + circumfac *= -1; + } snapGrid(t, &circumfac); applyNumInput(&t->num, &circumfac); |