[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59791] trunk/blender/source/blender/ editors/space_view3d/view3d_fly.c: tweaks to fly mode

Campbell Barton ideasman42 at gmail.com
Wed Sep 4 03:49:21 CEST 2013


Revision: 59791
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59791
Author:   campbellbarton
Date:     2013-09-04 01:49:20 +0000 (Wed, 04 Sep 2013)
Log Message:
-----------
tweaks to fly mode
- rotating the view is faster.
- arrow keys work (was only wasd-rf before)
- when stationary wheel or +/- will set z direction (so mouse wheel always sets the fly axis back to z)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_fly.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_fly.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_fly.c	2013-09-04 01:29:34 UTC (rev 59790)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_fly.c	2013-09-04 01:49:20 UTC (rev 59791)
@@ -159,6 +159,11 @@
 	WM_modalkeymap_add_item(keymap, RKEY, KM_PRESS, 0, 0, FLY_MODAL_DIR_UP);
 	WM_modalkeymap_add_item(keymap, FKEY, KM_PRESS, 0, 0, FLY_MODAL_DIR_DOWN);
 
+	WM_modalkeymap_add_item(keymap, UPARROWKEY, KM_PRESS, 0, 0, FLY_MODAL_DIR_FORWARD);
+	WM_modalkeymap_add_item(keymap, DOWNARROWKEY, KM_PRESS, 0, 0, FLY_MODAL_DIR_BACKWARD);
+	WM_modalkeymap_add_item(keymap, LEFTARROWKEY, KM_PRESS, 0, 0, FLY_MODAL_DIR_LEFT);
+	WM_modalkeymap_add_item(keymap, RIGHTARROWKEY, KM_PRESS, 0, 0, FLY_MODAL_DIR_RIGHT);
+
 	WM_modalkeymap_add_item(keymap, XKEY, KM_PRESS, 0, 0, FLY_MODAL_AXIS_LOCK_X);
 	WM_modalkeymap_add_item(keymap, ZKEY, KM_PRESS, 0, 0, FLY_MODAL_AXIS_LOCK_Z);
 
@@ -580,6 +585,12 @@
 				double time_currwheel;
 				float time_wheel;
 
+				/* not quite correct but avoids confusion WASD/arrow keys 'locking up' */
+				if (fly->axis == -1) {
+					fly->axis = 2;
+					fly->speed = fabsf(fly->speed);
+				}
+
 				time_currwheel = PIL_check_seconds_timer();
 				time_wheel = (float)(time_currwheel - fly->time_lastwheel);
 				fly->time_lastwheel = time_currwheel;
@@ -599,6 +610,12 @@
 				double time_currwheel;
 				float time_wheel;
 
+				/* not quite correct but avoids confusion WASD/arrow keys 'locking up' */
+				if (fly->axis == -1) {
+					fly->axis = 2;
+					fly->speed = -fabsf(fly->speed);
+				}
+
 				time_currwheel = PIL_check_seconds_timer();
 				time_wheel = (float)(time_currwheel - fly->time_lastwheel);
 				fly->time_lastwheel = time_currwheel;
@@ -806,9 +823,10 @@
 
 static int flyApply(bContext *C, FlyInfo *fly)
 {
-#define FLY_ROTATE_FAC 2.5f /* more is faster */
+#define FLY_ROTATE_FAC 10.0f /* more is faster */
 #define FLY_ZUP_CORRECT_FAC 0.1f /* amount to correct per step */
 #define FLY_ZUP_CORRECT_ACCEL 0.05f /* increase upright momentum each step */
+#define FLY_SMOOTH_FAC 20.0f  /* higher value less lag */
 
 	/* fly mode - Shift+F
 	 * a fly loop where the user can move move the view as if they are flying
@@ -1052,7 +1070,7 @@
 			}
 
 			/* impose a directional lag */
-			interp_v3_v3v3(dvec, dvec_tmp, fly->dvec_prev, (1.0f / (1.0f + (time_redraw * 5.0f))));
+			interp_v3_v3v3(dvec, dvec_tmp, fly->dvec_prev, (1.0f / (1.0f + (time_redraw * FLY_SMOOTH_FAC))));
 
 			if (rv3d->persp == RV3D_CAMOB) {
 				Object *lock_ob = fly->root_parent ? fly->root_parent : fly->v3d->camera;




More information about the Bf-blender-cvs mailing list