diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-10 08:19:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-10 08:19:25 +0400 |
commit | d3ffa53f78a7985a316e4f77219f8f5348cbab7a (patch) | |
tree | 200c5cd4243d69b91a8788bb5be4f7dce85093fc /source/blender/editors | |
parent | b1b07fb95147ba4f0a4b97909f3adfe4c2c6e6bf (diff) |
change fly mode behavior to address issue raised in [#30508] - there being no way to pause.
now when reversing direction immediately - fly mode translation will pause until pressed again.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_fly.c | 76 |
1 files changed, 56 insertions, 20 deletions
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 89794706181..82d687a866e 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -582,35 +582,68 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) /* implement WASD keys */ case FLY_MODAL_DIR_FORWARD: - if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather than stopping, game like motion */ - else if (fly->axis==2) fly->speed += fly->grid; /* increase like mousewheel if were already - * moving in that difection*/ - fly->axis= 2; + if (fly->axis == 2 && fly->speed < 0.0f) { /* reverse direction stops, tap again to continue */ + fly->axis = -1; + } + else { + if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather than stopping, game like motion */ + else if (fly->axis==2) fly->speed += fly->grid; /* increase like mousewheel if were already + * moving in that difection*/ + fly->axis= 2; + } break; case FLY_MODAL_DIR_BACKWARD: - if (fly->speed > 0.0f) fly->speed= -fly->speed; - else if (fly->axis==2) fly->speed -= fly->grid; - fly->axis= 2; + if (fly->axis == 2 && fly->speed > 0.0f) { /* reverse direction stops, tap again to continue */ + fly->axis = -1; + } + else { + if (fly->speed > 0.0f) fly->speed= -fly->speed; + else if (fly->axis==2) fly->speed -= fly->grid; + + fly->axis= 2; + } break; case FLY_MODAL_DIR_LEFT: - if (fly->speed < 0.0f) fly->speed= -fly->speed; - else if (fly->axis==0) fly->speed += fly->grid; - fly->axis= 0; + if (fly->axis == 0 && fly->speed < 0.0f) { /* reverse direction stops, tap again to continue */ + fly->axis = -1; + } + else { + if (fly->speed < 0.0f) fly->speed= -fly->speed; + else if (fly->axis==0) fly->speed += fly->grid; + + fly->axis= 0; + } break; case FLY_MODAL_DIR_RIGHT: - if (fly->speed > 0.0f) fly->speed= -fly->speed; - else if (fly->axis==0) fly->speed -= fly->grid; - fly->axis= 0; + if (fly->axis == 0 && fly->speed > 0.0f) { /* reverse direction stops, tap again to continue */ + fly->axis = -1; + } + else { + if (fly->speed > 0.0f) fly->speed= -fly->speed; + else if (fly->axis==0) fly->speed -= fly->grid; + + fly->axis= 0; + } break; case FLY_MODAL_DIR_DOWN: - if (fly->speed < 0.0f) fly->speed= -fly->speed; - else if (fly->axis==1) fly->speed += fly->grid; - fly->axis= 1; + if (fly->axis == 1 && fly->speed < 0.0f) { /* reverse direction stops, tap again to continue */ + fly->axis = -1; + } + else { + if (fly->speed < 0.0f) fly->speed= -fly->speed; + else if (fly->axis==1) fly->speed += fly->grid; + fly->axis= 1; + } break; case FLY_MODAL_DIR_UP: - if (fly->speed > 0.0f) fly->speed= -fly->speed; - else if (fly->axis==1) fly->speed -= fly->grid; - fly->axis= 1; + if (fly->axis == 1 && fly->speed > 0.0f) { /* reverse direction stops, tap again to continue */ + fly->axis = -1; + } + else { + if (fly->speed > 0.0f) fly->speed= -fly->speed; + else if (fly->axis==1) fly->speed -= fly->grid; + fly->axis= 1; + } break; case FLY_MODAL_AXIS_LOCK_X: @@ -932,7 +965,10 @@ static int flyApply(bContext *C, FlyInfo *fly) } } - + if (fly->axis == -1) { + /* pause */ + zero_v3(dvec_tmp); + } if (!fly->use_freelook) { /* Normal operation */ /* define dvec, view direction vector */ |