Walk navigation using tablet - repositioning the stylus rotates the view #83930

Open
opened 2020-12-18 15:45:28 +01:00 by Vincent Blankfield · 8 comments

System Information
Operating system: Windows-10-10.0.14393-SP0 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71

Blender Version
Broken: version: 2.92.0 Alpha, branch: master (modified), commit date: 2020-12-18 09:26, hash: fe5d2448c6
Worked: unknown

Short description of error
This is a follow-up to #83718. Specifically addressing this comment - #83718#1075294 by @PMA33.

The problem is when using a tablet in a walk navigation, lifting and repositioning the stylus is handled as if the stylus has been moved to the new position in range. This makes the view rotate a lot, making the walk navigation only usable when the stylus doesn't leave the range height.

Exact steps for others to reproduce the error

  1. In 3D Viewport execute the walk operator ({nav View > Navigation > Walk Navigation}).
  2. Use tablet to rotate view.
  3. Lift the stylus out of range.
  4. Reposition it to considerable distance and get it in range.

Result: The view rotates a lot, as if the stylus has been moved to the new location.

Expected: View doesn't move, new stylus location is assumed a new reference point.

Possible Fix

First of all, we need to reset walk->is_cursor_absolute when going from absolute to relative. Because currently, as long as a tablet has been used once, during the walk modal running, walk->is_cursor_absolute will stay absolute (even if a relative pointing device is used afterwards).

diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 665d704e6b2..79f66cb9e48 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -705,12 +705,12 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event)
     }

     if ((walk->is_cursor_absolute == false) && event->tablet.is_motion_absolute) {
-      walk->is_cursor_absolute = true;
       copy_v2_v2_int(walk->prev_mval, event->mval);
       copy_v2_v2_int(walk->center_mval, event->mval);
       /* without this we can't turn 180d */
       CLAMP_MIN(walk->mouse_speed, 4.0f);
     }
+    walk->is_cursor_absolute = event->tablet.is_motion_absolute;
 #endif /* USE_TABLET_SUPPORT */

     walk->moffset[0] += event->mval[0] - walk->prev_mval[0];

Second we'll need a (reliable) relative position event when a tablet goes out of range so the absolute coordinates get re-centered each time the tablet goes in range. For that we can send a dummy mouse move event on WT_PROXIMITY, when not inRange.

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 7e800619dda..e375b99cb41 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1614,6 +1614,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
         case WT_PROXIMITY: {
           bool inRange = LOWORD(lParam);
           window->processWintabProximityEvent(inRange);
+          if (!inRange) {
+            /* Send a dummy mouse event to be able to detect that the tablet went out of range. */
+            event = processCursorEvent(window);
+          }
           break;
         }
         case WT_PACKET:

Not sure if this (second part) is an acceptable solution, maybe there's a more elegant one. Maybe @PrototypeNM1 can take a look. Also, I have no idea how this behaves on the other platforms. I tested this with WinTab only. Triaging help on other platforms is appreciated.

Note that the proposed fix doesn't work well if the stylus went in range not over the Blender window. Those events may also be handled if this is a way to go.

**System Information** Operating system: Windows-10-10.0.14393-SP0 64 Bits Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71 **Blender Version** Broken: version: 2.92.0 Alpha, branch: master (modified), commit date: 2020-12-18 09:26, hash: `fe5d2448c6` Worked: unknown **Short description of error** This is a follow-up to #83718. Specifically addressing this comment - #83718#1075294 by @PMA33. The problem is when using a tablet in a walk navigation, lifting and repositioning the stylus is handled as if the stylus has been moved to the new position in range. This makes the view rotate a lot, making the walk navigation only usable when the stylus doesn't leave the range height. **Exact steps for others to reproduce the error** 1. In 3D Viewport execute the walk operator ({nav View > Navigation > Walk Navigation}). 2. Use tablet to rotate view. 3. Lift the stylus out of range. 4. Reposition it to considerable distance and get it in range. Result: The view rotates a lot, as if the stylus has been moved to the new location. Expected: View doesn't move, new stylus location is assumed a new reference point. **Possible Fix** First of all, we need to reset `walk->is_cursor_absolute` when going from absolute to relative. Because currently, as long as a tablet has been used once, during the walk modal running, `walk->is_cursor_absolute` will stay absolute (even if a relative pointing device is used afterwards). ``` diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 665d704e6b2..79f66cb9e48 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -705,12 +705,12 @@ static void walkEvent(bContext *C, WalkInfo *walk, const wmEvent *event) } if ((walk->is_cursor_absolute == false) && event->tablet.is_motion_absolute) { - walk->is_cursor_absolute = true; copy_v2_v2_int(walk->prev_mval, event->mval); copy_v2_v2_int(walk->center_mval, event->mval); /* without this we can't turn 180d */ CLAMP_MIN(walk->mouse_speed, 4.0f); } + walk->is_cursor_absolute = event->tablet.is_motion_absolute; #endif /* USE_TABLET_SUPPORT */ walk->moffset[0] += event->mval[0] - walk->prev_mval[0]; ``` Second we'll need a (reliable) relative position event when a tablet goes out of range so the absolute coordinates get re-centered each time the tablet goes in range. For that we can send a dummy mouse move event on WT_PROXIMITY, when not `inRange`. ``` diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 7e800619dda..e375b99cb41 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1614,6 +1614,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, case WT_PROXIMITY: { bool inRange = LOWORD(lParam); window->processWintabProximityEvent(inRange); + if (!inRange) { + /* Send a dummy mouse event to be able to detect that the tablet went out of range. */ + event = processCursorEvent(window); + } break; } case WT_PACKET: ``` Not sure if this (second part) is an acceptable solution, maybe there's a more elegant one. Maybe @PrototypeNM1 can take a look. Also, I have no idea how this behaves on the other platforms. I tested this with WinTab only. Triaging help on other platforms is appreciated. Note that the proposed fix doesn't work well if the stylus went in range not over the Blender window. Those events may also be handled if this is a way to go.

Added subscribers: @PMA33, @PrototypeNM1, @VincentBlankfield

Added subscribers: @PMA33, @PrototypeNM1, @VincentBlankfield

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Hi @VincentBlankfield thanks for the report and the patch. Could you please send the proposed fix as a patch? You can either use arcanist or https://developer.blender.org/differential/diff/create/ .

Then @PrototypeNM1 can take a look at it and if things work, commit to master or provide feedback for changes.

Hi @VincentBlankfield thanks for the report and the patch. Could you please send the proposed fix as a patch? You can either use `arcanist` or https://developer.blender.org/differential/diff/create/ . Then @PrototypeNM1 can take a look at it and if things work, commit to master or provide feedback for changes.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

@PrototypeNM1 : From reading here and in D9899, I assume this can be confirmed?

@PrototypeNM1 : From reading here and in [D9899](https://archive.blender.org/developer/D9899), I assume this can be confirmed?

Yep, confirmed.

Yep, confirmed.
Nicholas Rishel self-assigned this 2021-02-16 16:58:54 +01:00

Added subscriber: @StanislavOvcharov

Added subscriber: @StanislavOvcharov
Thomas Dinges added this to the 2.93 LTS milestone 2023-02-07 18:40:57 +01:00
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:23:49 +01:00
Pratik Borhade removed this from the 2.93 LTS milestone 2023-07-31 13:06:22 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#83930
No description provided.