[Bf-blender-cvs] [c017e1cb676] master: Fix T80409: Walk rotation speed depends on view size
Campbell Barton
noreply at git.blender.org
Thu Sep 3 06:36:28 CEST 2020
Commit: c017e1cb676314690a8c0b7da154a0815024171e
Author: Campbell Barton
Date: Thu Sep 3 14:31:26 2020 +1000
Branches: master
https://developer.blender.org/rBc017e1cb676314690a8c0b7da154a0815024171e
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.
===================================================================
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 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
More information about the Bf-blender-cvs
mailing list