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:
authorTon Roosendaal <ton@blender.org>2013-01-08 20:54:26 +0400
committerTon Roosendaal <ton@blender.org>2013-01-08 20:54:26 +0400
commit4737e08cb9a59c1a598bc42e1eb2b2f20852b14c (patch)
treebc877a2088be46b2649c1b3e7e2fe9dee7f79488 /source/blender/editors/space_view3d/view3d_fly.c
parentb0c084c6cca1dd9703f580427d838ee9e6d9f849 (diff)
Added trackpad (and magic mouse) support to control speed in Fly Mode in 3d.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_fly.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index a749a815546..c2e75a1c5d9 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -76,7 +76,8 @@ enum {
FLY_MODAL_PRECISION_ENABLE,
FLY_MODAL_PRECISION_DISABLE,
FLY_MODAL_FREELOOK_ENABLE,
- FLY_MODAL_FREELOOK_DISABLE
+ FLY_MODAL_FREELOOK_DISABLE,
+ FLY_MODAL_SPEED, /* mousepan typically */
};
@@ -132,6 +133,8 @@ void fly_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_ACCELERATE);
WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_DECELERATE);
+ WM_modalkeymap_add_item(keymap, MOUSEPAN, 0, 0, 0, FLY_MODAL_SPEED);
+
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, FLY_MODAL_PAN_ENABLE);
/* XXX - Bug in the event system, middle mouse release doesnt work */
WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, FLY_MODAL_PAN_DISABLE);
@@ -544,7 +547,22 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
case FLY_MODAL_CONFIRM:
fly->state = FLY_CONFIRM;
break;
-
+
+ /* speed adjusting with mousepan (trackpad) */
+ case FLY_MODAL_SPEED:
+ {
+ float fac = 0.02f * (event->prevy - event->y);
+
+ /* allowing to brake immediate */
+ if (fac > 0.0f && fly->speed < 0.0f)
+ fly->speed = 0.0f;
+ else if (fac < 0.0f && fly->speed > 0.0f)
+ fly->speed = 0.0f;
+ else
+ fly->speed += fly->grid * fac;
+
+ break;
+ }
case FLY_MODAL_ACCELERATE:
{
double time_currwheel;