Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-09-03 07:31:26 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-09-03 07:31:26 +0300
commitc017e1cb676314690a8c0b7da154a0815024171e (patch)
treedf1df96fa52f53489ab269581b21812ba3882d5b /source/blender
parentfc6b0c6f85fa19856946b209a993d0054bef697c (diff)
Fix T80409: Walk rotation speed depends on view size
Use a fixed speed for rotating the view in walk mode, Keep the current behavior for tablet input and fly mode.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 2cc41097070..2fb44c29d2e 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -985,7 +985,8 @@ static float getVelocityZeroTime(const float gravity, const float velocity)
static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
{
-#define WALK_ROTATE_FAC 2.2f /* more is faster */
+#define WALK_ROTATE_RELATIVE_FAC 2.2f /* More is faster, relative to region size. */
+#define WALK_ROTATE_CONSTANT_FAC DEG2RAD(0.15f) /* More is faster, radians per-pixel. */
#define WALK_TOP_LIMIT DEG2RADF(85.0f)
#define WALK_BOTTOM_LIMIT DEG2RADF(-80.0f)
#define WALK_MOVE_SPEED base_speed
@@ -1063,10 +1064,19 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
float y;
/* relative offset */
- y = (float)moffset[1] / region->winy;
+ y = (float)moffset[1];
- /* speed factor */
- y *= WALK_ROTATE_FAC;
+ /* Speed factor. */
+#ifdef USE_TABLET_SUPPORT
+ if (walk->is_cursor_absolute) {
+ y /= region->winy;
+ y *= WALK_ROTATE_RELATIVE_FAC;
+ }
+ else
+#endif
+ {
+ y *= WALK_ROTATE_CONSTANT_FAC;
+ }
/* user adjustment factor */
y *= walk->mouse_speed;
@@ -1103,10 +1113,19 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
}
/* relative offset */
- x = (float)moffset[0] / region->winx;
+ x = (float)moffset[0];
- /* speed factor */
- x *= WALK_ROTATE_FAC;
+ /* Speed factor. */
+#ifdef USE_TABLET_SUPPORT
+ if (walk->is_cursor_absolute) {
+ x /= region->winx;
+ x *= WALK_ROTATE_RELATIVE_FAC;
+ }
+ else
+#endif
+ {
+ x *= WALK_ROTATE_CONSTANT_FAC;
+ }
/* user adjustment factor */
x *= walk->mouse_speed;
@@ -1320,10 +1339,7 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
}
return OPERATOR_FINISHED;
-#undef WALK_ROTATE_FAC
-#undef WALK_ZUP_CORRECT_FAC
-#undef WALK_ZUP_CORRECT_ACCEL
-#undef WALK_SMOOTH_FAC
+#undef WALK_ROTATE_RELATIVE_FAC
#undef WALK_TOP_LIMIT
#undef WALK_BOTTOM_LIMIT
#undef WALK_MOVE_SPEED