Platforms: Win32 Use Message Time for WinTab events #116114
No reviewers
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116114
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Harley/blender:WinTabMessageTimes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
WinTab events are all created in result of windows messages, so for
these use the last message time, rather than supplied time, to ensure
the times are consistent with other event times.
In the Wacom reference page the say that the "pkTime" is "In absolute mode, specifies the system time at which the event was posted. In relative mode, specifies the elapsed time in milliseconds since the last packet". This second format is not compatible with blender event times. https://developer-docs.wacom.com/docs/icbt/windows/wintab/wintab-reference/
I Vaguely remember @PrototypeNM1 fighting with this, and i'd like to get his opinion before making changes here
The
GetMessageTime()
API only has a resolution of 16ms (62.5 fps). For smooth strokes from tablets we want as much resolution as we can get. And the potential issue is not just that we'd only get 16ms resolution, but that by rounding the native tablet frequency to another frequency that points would be poorly spaced as well.I think we want to get the time from the tablet API. If some offsets needs to be applied to make it match other times, perhaps that offset could be computed at the start of the stroke (i.e. pen/mouse down) and stay fixed for the duration.
I vaguely remember that we can limit reading the Wintab packets constrained to those associated to the current
WT_PACKET
Windows message, currently I believe we drain the whole Wintab packet queue. If we're going to use the message origination time we will probably want to limit what we read to have closer timestamps.I also wonder if e.g. stroke smoothing or similar operations take time between
INBETWEEN_MOUSEMOVE
s into consideration? If so this could cause a regression from timestamps not differing.Its more complicated than that. Our general "get tick count" routine uses a high performance timer with a resolution of <1us. The
getMilliSeconds
might appear to fallback to usingGetTickCount
if there is no high res timer, but that can no longer happen as such a timer is guaranteed since Windows XP. We convert this value to milliseconds though so the resolution is 1ms.Our new
getMessageTime
uses this timer's value and subtracts the difference between the 32-bitGetMessageTime
andGetTickCount
. So we end up with a 64 timer with good accuracy that doesn't roll over. But the portion of this time value from when a windows message is delivered to when we collect it has a resolution of 16ms.Do we really space the points using time and not just position?
AFAIK with this change we will receive the same number of messages from Wintab and send the same number of events to Blender at the same time they always have. With the only change being our own timestamp in the Blender events will be of a format that matches the format of other event times. We use detect double-click by comparing subsequent values, but not sure we use it anywhere else yet.
GetTickCount
is the time the event is being processed, not the time the event happened. Its accuracy does not help because it's not measuring the right thing.With high frequency tablet events you will end up processing a few events together every time, and then you'll have clumps of events that have nearly the same time because they happened to be processed together.
We indeed do not seem to be using it in the brush code. If it was accurate we could use it for the airbrush, to properly match position and time.
If it's not trivial to keep the accuracy I guess it's to lose it. But I would like to see a comment noting the loss of accuracy and that it's okay because it's only used for double click checking.
Checkout
From your project repository, check out a new branch and test the changes.