[Bf-blender-cvs] [95b13ef] epic-navigation: Cleanup pre-review

Dalai Felinto noreply at git.blender.org
Fri Nov 14 01:49:27 CET 2014


Commit: 95b13efdb58c4361aa24128e372957dbcd4d6c64
Author: Dalai Felinto
Date:   Thu Nov 13 22:38:12 2014 -0200
Branches: epic-navigation
https://developer.blender.org/rB95b13efdb58c4361aa24128e372957dbcd4d6c64

Cleanup pre-review

===================================================================

M	source/blender/editors/space_view3d/view3d_walk.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 56a2c9b..d4c1600 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -64,8 +64,6 @@
 
 /* prototypes */
 static float getVelocityZeroTime(const float gravity, const float velocity);
-static void walk_non_modal(struct bContext *C, struct wmOperator *op);
-static bool running_non_modal = false;
 
 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
 enum {
@@ -105,17 +103,6 @@ typedef enum {
 	WALK_BIT_INIT     = 1 << 6,
 } eWalkDirectionFlag;
 
-typedef enum eWalkKeyMode{
-	WALK_KEY_NULL    = 0,
-	WALK_KEY_FORWARD  = 1 << 1,
-	WALK_KEY_BACKWARD = 1 << 2,
-	WALK_KEY_LEFT     = 1 << 3,
-	WALK_KEY_RIGHT    = 1 << 4,
-	WALK_KEY_UP       = 1 << 5,
-	WALK_KEY_DOWN     = 1 << 6,
-	WALK_KEY_STOP     = 1 << 7,
-} eWalkKeyMode;
-
 typedef enum eWalkTeleportState {
 	WALK_TELEPORT_STATE_OFF = 0,
 	WALK_TELEPORT_STATE_ON,
@@ -481,7 +468,6 @@ enum {
 /* keep the previous speed until user changes userpreferences */
 static float base_speed = -1.f;
 static float userdef_speed = -1.f;
-static double non_modal_time = 0.0;
 
 static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op, const wmEvent *event)
 {
@@ -531,8 +517,6 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op, const wmEv
 	walk->mouse_mode = RNA_enum_get(op->ptr, "mouse_mode");
 	walk->use_mouse = walk->mouse_mode != WALK_MOUSE_NULL;
 
-	walk->time_lastdraw = PIL_check_seconds_timer();
-
 	/* user preference settings */
 	walk->teleport.duration = U.walk_navigation.teleport_time;
 	walk->mouse_speed = U.walk_navigation.mouse_speed;
@@ -565,14 +549,17 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op, const wmEv
 #endif
 	zero_v3(walk->dvec_prev);
 
-	walk->timer = NULL;
+	walk->timer = WM_event_add_timer(CTX_wm_manager(C), win, TIMER, 0.01f);
 
 	walk->ndof = NULL;
 
+	walk->time_lastdraw = PIL_check_seconds_timer();
+
 	walk->draw_handle_pixel = NULL;
 
 	walk->rv3d->rflag |= RV3D_NAVIGATING;
 
+
 	walk->v3d_camera_control = ED_view3d_cameracontrol_acquire(
 	        walk->scene, walk->v3d, walk->rv3d,
 	        (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0);
@@ -587,8 +574,6 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op, const wmEv
 	walk->init_mval[0] = event->x;
 	walk->init_mval[1] = event->y;
 
-	walk->timer = WM_event_add_timer(CTX_wm_manager(C), win, TIMER, 0.01f);
-
 	if (walk->use_mouse) {
 		walk->draw_handle_pixel = ED_region_draw_cb_activate(walk->ar->type, drawWalkPixel, walk, REGION_DRAW_POST_PIXEL);
 
@@ -1108,13 +1093,13 @@ static int walkApply(bContext *C, WalkInfo *walk)
 			/* time how fast it takes for us to redraw,
 			 * this is so simple scenes don't walk too fast */
 			double time_current;
-			float time_redraw = 1.0f;
+			float time_redraw;
 #ifdef NDOF_WALK_DRAW_TOOMUCH
 			walk->redraw = 1;
 #endif
-
 			time_current = PIL_check_seconds_timer();
 			time_redraw = (float)(time_current - walk->time_lastdraw);
+
 			walk->time_lastdraw = time_current;
 
 			/* base speed in m/s */
@@ -1482,13 +1467,6 @@ static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event)
 	return exit_code;
 }
 
-static void walk_non_modal(bContext *C, wmOperator *op)
-{
-	WalkInfo *walk = op->customdata;
-	walk->active_directions = RNA_enum_get(op->ptr, "initial_direction");
-	WM_event_add_modal_handler(C, op);
-}
-
 static EnumPropertyItem walk_navigation_mouse_mode_items[] = {
 	{WALK_MOUSE_LOOKAROUND, "LOOK_AROUND", 0, "Look Around", "Rotates the viewport camera"},
 	{WALK_MOUSE_MOVEHORIZONTAL, "MOVE_HORIZONTAL", 0, "Move Horizontally", "Moves the camera forward and backward and rotates left and right"},
@@ -1528,6 +1506,6 @@ void VIEW3D_OT_walk(wmOperatorType *ot)
 
 	prop = RNA_def_enum(ot->srna, "mouse_mode", walk_navigation_mouse_mode_items, WALK_MOUSE_LOOKAROUND, "Mouse Mode", "");
 	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-	prop = RNA_def_enum(ot->srna, "initial_direction", walk_navigation_initial_direction_items, WALK_KEY_NULL, "Key Mode", "");
+	prop = RNA_def_enum(ot->srna, "initial_direction", walk_navigation_initial_direction_items, 0, "Initial Direction", "");
 	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }




More information about the Bf-blender-cvs mailing list