armory3d / armortools

3D Content Creation Tools
https://armorpaint.org
Other
3.29k stars 336 forks source link

Pen Pressure not working on Xp-pen Artist Pro 22 - Linux #707

Closed edap closed 1 year ago

edap commented 3 years ago

ArmorPaint version: v0.8 (2020-08-25)

OS/device including version: latest Ubuntu

Issue description: Hello, I have noticed that the mouse pressure is not working with the tablet Xp-pen Artist Pro 22, but it is working with the Wacom tablet. I have already tested it with different sensitivity values, but they are not effecting the pen's pressure.

Steps to reproduce:

Try do draw a line with a different pen's pressure.

yosoyfreeman commented 3 years ago

Hi! i has been doing some research and i think i know what the problem is. Seems like Armor paint is working not with the direct input, but the wacom input. So, with thablets from different vendors who works out of the box or with the touch modules the preasure does not work. In HUION, I fixed it using the digimend driver. (Even when my tablet is supported but the wacom controls does not work). That drivers trick the system to think that the pen is a wacom pen, so it works.

This is a little weird, cause the preasure works fine in all the software without this trick, but it can be a temporal fix for many users.

Hope this is useful.

PD: lubos, i send you a message via twitter about my purcharse. Hope you can read it.

edap commented 3 years ago

Hello, are there any news regarding this bug? At the moment I can't use Armorpaint with my Xp-pen, i can use it only on a wacom tablet and it's a pity because I really like this software. I do not want to put any pressure @luboslenco , but only to know if it is something that you think it will be fixed or if it has a low priority, thing that I can totally understand.

valentegamedev commented 3 years ago

I had this same problem with my Huion Kamvas 13.

Installing DIGImend Drivers fixed it. Link to the drivers: https://github.com/DIGImend/digimend-kernel-drivers/releases

edap commented 3 years ago

No, it has nothing to do with the drivers because pen pressure works in Blender, for example. It is a problem in ArmorPaint. @luboslenco could you please suggest me which file in the codebase deal with the pen pressure? maybe it simply need to add a case in an if condition, I could try to figure out what it is? Thanks again for your efforts in maintaining this.

luboslenco commented 3 years ago

@edap here is the Linux pen code, thanks for help! https://github.com/Kode/Kinc/blob/master/Backends/System/Linux/Sources/kinc/backend/system.cpp#L305 https://github.com/Kode/Kinc/blob/master/Backends/System/Linux/Sources/kinc/backend/system.cpp#L399

It checks for the device named "stylus", maybe it's not enough?

edap commented 3 years ago

Hey, thanks for the quick answer. I will give a try tomorrow, I do not have my tablet here ATM. Can I simply clone the repo, compile it using the instruction on the README of the armorpaint repository and cout the devices[i].name line? or do I have to build this https://github.com/Kode/Kinc/ separately? I am not familiar with this building system.

luboslenco commented 3 years ago

Sounds great! You can clone and edit in armorpaint/armorcore/Kinc directly, then compile as usual.

valentegamedev commented 3 years ago

No, it has nothing to do with the drivers because pen pressure works in Blender, for example. It is a problem in ArmorPaint. @luboslenco could you please suggest me which file in the codebase deal with the pen pressure? maybe it simply need to add a case in an if condition, I could try to figure out what it is? Thanks again for your efforts in maintaining this.

As I said. I got the same problem the pen pressure was working everywhere else but ArmorPaint. After installing DIGImend Drivers got it working in ArmorPaint plus the tablet buttons.

It is probably a bug. But this is one workound that worked for me.

Cheers

devviktoria commented 1 year ago

I have an XP Pen Fun L pen tablet and I had the same issue. If I ran the xinput command it lists my tablet several times as: UGTABLET 10 inch PenTablet Mouse,UGTABLET 10 inch PenTablet Pen (0), UGTABLET 10 inch PenTablet Keyboard, UGTABLET 10 inch PenTablet. I managed to find the pen detection code here: https://github.com/Kode/Kinc/blob/main/Backends/System/Linux/Sources/kinc/backend/x11/system.c.h#L196 What I was able to find that Gimp uses GDK to identify the pen. GDK uses the following if statement comparing the lowercase device name: else if (strstr (tmp_name, "wacom") || strstr (tmp_name, "pen") || strstr (tmp_name, "stylus") || strstr (tmp_name, "eraser")) input_source = GDK_SOURCE_PEN; See here: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/x11/gdkdevicemanager-xi2.c#L487 So if I had modified the Kinc's code like so: if (strstr(devices[i].name, "stylus") || strstr(devices[i].name, "Pen") || strstr(devices[i].name, "wacom")) { my device was recognised and the pressure sensivity worked. (I am not an expert in c/c++ coding so I could not figure out how to add the lowercase name comparison to the code.)

luboslenco commented 1 year ago

Should be resolved now - added your fix at https://github.com/Kode/Kinc/pull/748, thanks a lot devviktoria! If there are still issues please let me know.

luboslenco commented 1 year ago

@UnoCastillo does pen pressure work in Gimp? Can you run the xinput command in terminal to see how your tablet is listed?

UnoCastillo commented 1 year ago

it works perfectly in all my other apps. look my xinput command returns

[image: imagen.png]

Uno Castillo

Compositor VFX y Cinematógrafo

RobotHead Soluciones audiovisuales

(+57) 315 7243822

Perfil LinkedIn https://www.linkedin.com/in/unocastillo/

El jue, 29 dic 2022 a las 13:31, Lubos Lenco @.***>) escribió:

@UnoCastillo https://github.com/UnoCastillo does pen pressure work in Gimp? Can you run the xinput command in terminal to see how your tablet is listed?

— Reply to this email directly, view it on GitHub https://github.com/armory3d/armorpaint/issues/707#issuecomment-1367511178, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUN6XUTV7FVRMB6SID2WLNDWPXKJDANCNFSM4UBEJYKQ . You are receiving this because you were mentioned.Message ID: @.***>

luboslenco commented 1 year ago

Can you fix the image link? Will take a look!

UnoCastillo commented 1 year ago

oh sorry

imagen

UnoCastillo commented 1 year ago

Did you see it?

El El jue, 29 de diciembre de 2022 a la(s) 13:39, Lubos Lenco < @.***> escribió:

Can you fix the image link? Will take a look!

— Reply to this email directly, view it on GitHub https://github.com/armory3d/armorpaint/issues/707#issuecomment-1367514631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUN6XUU2NDHHMM7FG7XK5CDWPXLEPANCNFSM4UBEJYKQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Uno Castillo

Compositor VFX y Cinematógrafo

RobotHead Soluciones audiovisuales

(+57) 315 7243822

Perfil LinkedIn https://www.linkedin.com/in/unocastillo/

luboslenco commented 1 year ago

I managed to test with xp pen g640. The pressure does not work in version 0.8, but it does work in latest 0.9dev version for me. I am not sure why it does not work on your system, sorry. :( If you got a paid binary version, please send me an email so I can send you a refund.

PedroCorreiaArtwork commented 4 months ago

I have an XP Pen Fun L pen tablet and I had the same issue. If I ran the xinput command it lists my tablet several times as: UGTABLET 10 inch PenTablet Mouse,UGTABLET 10 inch PenTablet Pen (0), UGTABLET 10 inch PenTablet Keyboard, UGTABLET 10 inch PenTablet. I managed to find the pen detection code here: https://github.com/Kode/Kinc/blob/main/Backends/System/Linux/Sources/kinc/backend/x11/system.c.h#L196 What I was able to find that Gimp uses GDK to identify the pen. GDK uses the following if statement comparing the lowercase device name: else if (strstr (tmp_name, "wacom") || strstr (tmp_name, "pen") || strstr (tmp_name, "stylus") || strstr (tmp_name, "eraser")) input_source = GDK_SOURCE_PEN; See here: https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/x11/gdkdevicemanager-xi2.c#L487 So if I had modified the Kinc's code like so: if (strstr(devices[i].name, "stylus") || strstr(devices[i].name, "Pen") || strstr(devices[i].name, "wacom")) { my device was recognised and the pressure sensivity worked. (I am not an expert in c/c++ coding so I could not figure out how to add the lowercase name comparison to the code.)

Anyone managed to fix by doing this?