From 33b624cb5ff28af208ad95c1cf6d64c45077eb50 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Jun 2010 23:25:38 +0000 Subject: [#22307] Camera Fly Mode Rolls Camera on local Z-axis z-roll was enabled by default, also made rotate less sensitive. --- source/blender/editors/space_view3d/view3d_view.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/space_view3d/view3d_view.c') diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 84fe927f4ab..585e3c03e58 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -2005,7 +2005,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even fly->axis= 2; fly->pan_view= FALSE; fly->xlock= FALSE; - fly->zlock= TRUE; + fly->zlock= FALSE; fly->xlock_momentum=0.0f; fly->zlock_momentum=0.0f; fly->grid= 1.0f; @@ -2277,6 +2277,11 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) static int flyApply(bContext *C, FlyInfo *fly) { + +#define FLY_ROTATE_FAC 2.5f /* more is faster */ +#define FLY_ZUP_CORRECT_FAC 0.1f /* ammount to correct per step */ +#define FLY_ZUP_CORRECT_ACCEL 0.05f /* increase upright momentum each step */ + /* fly mode - Shift+F a fly loop where the user can move move the view as if they are flying @@ -2392,7 +2397,7 @@ static int flyApply(bContext *C, FlyInfo *fly) upvec[1]=0; upvec[2]=0; mul_m3_v3(mat, upvec); - axis_angle_to_quat( tmp_quat, upvec, (float)moffset[1]*-time_redraw*20); /* Rotate about the relative up vec */ + axis_angle_to_quat( tmp_quat, upvec, (float)moffset[1] * time_redraw * -FLY_ROTATE_FAC); /* Rotate about the relative up vec */ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat); if (fly->xlock) fly->xlock = 2; /*check for rotation*/ @@ -2424,7 +2429,7 @@ static int flyApply(bContext *C, FlyInfo *fly) mul_m3_v3(mat, upvec); } - axis_angle_to_quat( tmp_quat, upvec, (float)moffset[0]*time_redraw*20); /* Rotate about the relative up vec */ + axis_angle_to_quat( tmp_quat, upvec, (float)moffset[0] * time_redraw * FLY_ROTATE_FAC); /* Rotate about the relative up vec */ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat); if (fly->xlock) fly->xlock = 2;/*check for rotation*/ @@ -2445,10 +2450,10 @@ static int flyApply(bContext *C, FlyInfo *fly) upvec[2]=1; mul_m3_v3(mat, upvec); - axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->zlock_momentum*0.1); /* Rotate about the relative up vec */ + axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->zlock_momentum * FLY_ZUP_CORRECT_FAC); /* Rotate about the relative up vec */ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat); - fly->zlock_momentum += 0.05f; + fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL; } else { fly->zlock=1; /* dont check until the view rotates again */ fly->zlock_momentum= 0.0f; -- cgit v1.2.3