Open willgfx opened 2 years ago
cc @bruvzg
For now, this GDScript workaround can be used to correct the issue in your projects until there's an engine-side fix:
var pressure
var pressure_buf = [0, 0] # past pressure value buffer
func _input(event):
if event is InputEventMouseMotion:
pressure = event.get_pressure()
# If a pressure value of 1 is encountered, "correct" the value by
# extrapolating from the delta of the past two values. This will
# correct the jumping to 1 error while also allowing values that
# are "supposed" to be 1.
if pressure == 1 && pressure_buf[0] != 0:
pressure = min(1, pressure_buf[0] + pressure_buf[0] - pressure_buf[1])
pressure_buf.pop_back()
pressure_buf.push_front(pressure)
This happens when the mouse is moved and it sends it's own Mouse Motion event. There are three problems here:
Godot version
3.3.3.stable
System information
Linux (EndeavourOS [Arch]), Huion Kamvas Pro 20 Tablet Display & XPS 13 7390 2-in-1 Screen
Issue description
This seems to be a Linux-only issue, I am not able to reproduce the bug on Windows with the same hardware.
Tablet pressure value will jump to 1 randomly for periods of 1 to 2 frames. These do not correspond to dumps from usbhid-dump. (https://digimend.github.io/support/howto/trbl/locating_failure/), and I am not seeing the issue in other software (Krita, MyPaint, GNOME Settings tablet tester).
Tested on both a Huion Kamvas Pro 20 Tablet Display and XPS 13 7390 2-in-1 tablet.
Steps to reproduce
Use the tablet pen at varying levels of pressure. You will see the printed pressure value randomly jump to 1 for 1 to 2 frame periods.![Screenshot from 2021-09-24 18-54-20](https://user-images.githubusercontent.com/21956520/134750388-e8495d70-9af0-4fbd-8a8c-0ab511bacb2c.png)
Minimal reproduction project
TabletPressure.zip