mbrlabs / Lorien

Infinite canvas drawing/whiteboarding app for Windows, Linux and macOS. Made with Godot.
MIT License
5.51k stars 236 forks source link

Pen movement on canvas area not working #303

Open Zacrain opened 1 month ago

Zacrain commented 1 month ago

Lorien version: Current main branch. Commit hash: 0bd6fff

OS/device including version: Windows 10 Wacom Intuos BT M CTL-6100WL, Driver version: 6.4.7-3

Issue description: The movement of the graphic tablet's pen is not reflected on the canvas. I can draw a point where the cursor is currently at, but I can't move it with the pen. There are no issues with my mouse though. Clicking buttons like selecting tools works using the pen as long as I moved the cursor into the top bar before with my mouse (or with the pen if I moved it out of the window and move it back again).

Steps to reproduce:

Further Observations: The positional information is correctly received at all times when using the pen. I've tested this by simply adding a print at _process_event(...) in InfiniteCanvas.gd:

func _process_event(event: InputEvent) -> void:
    if event is InputEventMouseMotion:
        print("Mouse position at: ", event.position)
        info.current_pressure = event.pressure
                #...

However, there seems to be a problem with the tool's cursor on the canvas in some way which leads to it not being updated correctly when using a pen. Which I find curious as pen movements are usually handled simply as mouse movements in Godot, if I'm not mistaken. Therefore I wonder whether there is something specific to the project which is causing this issue.

Recognition of applied pressure seems to be working.

Zacrain commented 1 month ago

This seems to be an issue related to how Godot 4.x processes pen inputs. As a workaround it was suggested to switch from absolute to relative positioning in the graphic tablet's driver settings. Godot currently does not seem to be able to process absolute positioning of pens sufficiently.

See: https://github.com/godotengine/godot/issues/76451 https://github.com/godotengine/godot/issues/75903

So in my Wacom tablet settings setting to "mouse mode" fixed this for now: image

However, the pen works in pen mode (absolute positioning) completely fine in Lorien's toolbar. Just not on the canvas. 🤔

Update: When switching to mouse mode (relative positioning) pen pressure doesn't work anymore, meaning it becomes constant. Using pen mode but deactivating "Windows Ink" surprisingly also allevieates the movement issue but then the pen pressure is constant as well.

mbrlabs commented 1 month ago

That's odd, thanks for the report! Does this only happen on the latest main branch? Did you test this with v0.6.0 as well?

I'm on Linux and here both absolute and relative positioning work fine with Wacoms.

mzpsh commented 1 month ago

Confirming this on windows with huion h420 with latest build from https://github.com/mbrlabs/Lorien/actions/runs/10863437411.

Zacrain commented 1 month ago

That's odd, thanks for the report! Does this only happen on the latest main branch? Did you test this with v0.6.0 as well?

I'm on Linux and here both absolute and relative positioning work fine with Wacoms.

It doesn't happen on v0.6.0, which suggests that it might indeed be a problem stemming from Godot 4.x.

mbrlabs commented 1 month ago

Alright, can confirm as well on my old Windows 10 box. I'll look into it!

mbrlabs commented 1 month ago

I think i fixed it or at least found a workaround. When changing the Windows tablet driver (in Godot's advanced project settings: Input Devices -> Pen Tablet -> Driver) to wintab it works. The default is winink.

If this works for you as well we should make it the default for Windows and provide an option in the settings to switch between all available drivers.

CI builds for testing: https://github.com/mbrlabs/Lorien/actions/runs/10983725293

mzpsh commented 1 month ago

I think i fixed it or at least found a workaround. When changing the Windows tablet driver (in Godot's advanced project settings: Input Devices -> Pen Tablet -> Driver) to wintab it works. The default is winink.

If this works for you as well we should make it the default for Windows and provide an option in the settings to switch between all available drivers.

CI builds for testing: https://github.com/mbrlabs/Lorien/actions/runs/10983725293

It still doesnt work on me with the latest build. FYI the pressure works, just like before. Perhaps Godot's problem?

mbrlabs commented 1 month ago

@mzpsh Did you try the CI build from the PR? I did not merge this yet into the main branch.

mzpsh commented 1 month ago

@mbrlabs Yes, I did try the build from the CI. Also tried that tablet_driver branch on godot, and tried to tweak tablet driver and emulate mouse from touch/touch from mouse, still no luck.

mbrlabs commented 1 month ago

Ok, thank you for testing! At least it seems to work for Wacoms now so i'm merging the PR and hope it also works for @Zacrain.

Huion tablets like yours might need a different treatment...or a fix in Godot itself. By the way: are you on Windows 10 or 11?

mzpsh commented 1 month ago

Windows 10 19044, ltsc 2021. Yes, I think I'll open a new issue on huion tablet, either here or on godot.

mbrlabs commented 1 month ago

@mzpsh ok, so i got a Huion 420X to test this. I installed the latest drivers (v15.7.6.1314) on Windows 10 and for me the wintab driver in the Lorien settings works fine right out of the box. winink has the same issue as Wacom.

Maybe your Huion driver is outdated or your device is not supported anymore?