Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_view3d/view3d_walk.c
| Context not available. | |||||
| /* mouse reverse */ | /* mouse reverse */ | ||||
| bool is_reversed; | bool is_reversed; | ||||
| bool is_absolute_cursor; | |||||
| /* gravity system */ | /* gravity system */ | ||||
| eWalkGravityState gravity; | eWalkGravityState gravity; | ||||
| Context not available. | |||||
| walk->is_reversed = ((U.walk_navigation.flag & USER_WALK_MOUSE_REVERSE) != 0); | walk->is_reversed = ((U.walk_navigation.flag & USER_WALK_MOUSE_REVERSE) != 0); | ||||
| /* initialize on first mousemove */ | |||||
| walk->is_absolute_cursor = false; | |||||
| walk->active_directions = 0; | walk->active_directions = 0; | ||||
| #ifdef NDOF_WALK_DRAW_TOOMUCH | #ifdef NDOF_WALK_DRAW_TOOMUCH | ||||
| Context not available. | |||||
| } | } | ||||
| else if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { | else if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { | ||||
| if (!walk->is_absolute_cursor && WM_event_is_absolute(event)) { | |||||
| walk->is_absolute_cursor = true; | |||||
| } | |||||
| walk->moffset[0] += event->mval[0] - walk->prev_mval[0]; | walk->moffset[0] += event->mval[0] - walk->prev_mval[0]; | ||||
| walk->moffset[1] += event->mval[1] - walk->prev_mval[1]; | walk->moffset[1] += event->mval[1] - walk->prev_mval[1]; | ||||
| copy_v2_v2_int(walk->prev_mval, event->mval); | if (walk->is_absolute_cursor) { | ||||
| copy_v2_v2_int(walk->prev_mval, walk->center_mval); | |||||
| } | |||||
| else { | |||||
| copy_v2_v2_int(walk->prev_mval, event->mval); | |||||
| } | |||||
| if ((walk->center_mval[0] != event->mval[0]) || | if ((walk->center_mval[0] != event->mval[0]) || | ||||
| (walk->center_mval[1] != event->mval[1])) | (walk->center_mval[1] != event->mval[1])) | ||||
| Context not available. | |||||
| static int walkApply(bContext *C, WalkInfo *walk) | static int walkApply(bContext *C, WalkInfo *walk) | ||||
| { | { | ||||
| /* scale absolute cursor up to compensate for time */ | |||||
| #define WALK_ROTATE_FAC_ABSOLUTE 0.8f | |||||
| #define WALK_ROTATE_FAC 2.2f /* more is faster */ | #define WALK_ROTATE_FAC 2.2f /* more is faster */ | ||||
| #define WALK_TOP_LIMIT DEG2RADF(85.0f) | #define WALK_TOP_LIMIT DEG2RADF(85.0f) | ||||
| #define WALK_BOTTOM_LIMIT DEG2RADF(-80.0f) | #define WALK_BOTTOM_LIMIT DEG2RADF(-80.0f) | ||||
| Context not available. | |||||
| /* speed factor */ | /* speed factor */ | ||||
| y *= WALK_ROTATE_FAC; | y *= WALK_ROTATE_FAC; | ||||
| if (walk->is_absolute_cursor) { | |||||
| y *= time_redraw * WALK_ROTATE_FAC_ABSOLUTE; | |||||
| } | |||||
| /* user adjustement factor */ | /* user adjustement factor */ | ||||
| y *= walk->mouse_speed; | y *= walk->mouse_speed; | ||||
| Context not available. | |||||
| /* speed factor */ | /* speed factor */ | ||||
| x *= WALK_ROTATE_FAC; | x *= WALK_ROTATE_FAC; | ||||
| if (walk->is_absolute_cursor) { | |||||
| x *= time_redraw * WALK_ROTATE_FAC_ABSOLUTE; | |||||
| } | |||||
| /* user adjustement factor */ | /* user adjustement factor */ | ||||
| x *= walk->mouse_speed; | x *= walk->mouse_speed; | ||||
| Context not available. | |||||