diff options
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_walk.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 243c6e5c8c3..0bda6e37fd1 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -38,7 +38,7 @@ #include "BKE_context.h" #include "BKE_report.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BIF_gl.h" @@ -62,6 +62,9 @@ #define USE_TABLET_SUPPORT +/* ensure the target position is one we can reach, see: T45771 */ +#define USE_PIXELSIZE_NATIVE_SUPPORT + /* prototypes */ static float getVelocityZeroTime(const float gravity, const float velocity); @@ -519,7 +522,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) walk->speed = 0.0f; walk->is_fast = false; walk->is_slow = false; - walk->grid = 1.f / walk->scene->unit.scale_length; + walk->grid = (walk->scene->unit.system == USER_UNIT_NONE) ? 1.f : 1.f / walk->scene->unit.scale_length; /* user preference settings */ walk->teleport.duration = U.walk_navigation.teleport_time; @@ -578,6 +581,16 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) walk->center_mval[0] = walk->ar->winx * 0.5f; walk->center_mval[1] = walk->ar->winy * 0.5f; +#ifdef USE_PIXELSIZE_NATIVE_SUPPORT + walk->center_mval[0] += walk->ar->winrct.xmin; + walk->center_mval[1] += walk->ar->winrct.ymin; + + WM_cursor_compatible_xy(win, &walk->center_mval[0], &walk->center_mval[1]); + + walk->center_mval[0] -= walk->ar->winrct.xmin; + walk->center_mval[1] -= walk->ar->winrct.ymin; +#endif + copy_v2_v2_int(walk->prev_mval, walk->center_mval); WM_cursor_warp(win, |