-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to detect if an input device supports pressure #426
Comments
Just in case someone else runs into this and need a (crude) workaround: It kinda works, but i am not really happy with it at all. |
Never mind the previous comment. The device_id for my pen my mouse are the same. Something like a proper device_id would also be awesome tho ;) |
Feel free to do this 🙂 |
I could probably write and test this for X11 and windows, but would need help with the other platforms that support pressure (i think web export for example doesn't ?). But the solution might be even easier. Another alternative which would allow my above posted workaround to work would be to expose a proper DeviceId. This might be easier (but i am really not experienced with that whole area tbh.) |
Ok, after some discussion on IRC it seems that on Macs pressure from devices not supporting pressure is set to 1 when the(a?) button is down and 0 otherwise. I suggest changing the windows and Linux backends so they behave like the Mac one. Additional exposing a device ID would be really nice regardless as this would allow user to configure each device (Pressure curve, Default tilt and so on). But this would be way less important for me personally |
Agreed..I prefer the Mac way of handling devices that don't support pressure. (pressure 1 when button down, 0 when button up). For example if you are controlling opacity with pressure, it's better to have 1 by default vs 0. |
Wouldn't it also be better if pressure was a property of InputEventMouse, instead of just InputEventMouseMotion? That way, InputEventMouseButton could also have access to pressure. I tried the pressure changes in Godot 3.2.2 beta 2 with a mouse on Windows, and while the pressure is now 1 when I am moving the mouse and holding the left mouse button, if I just click without moving the mouse, the pressure is 0. I'm not sure what the behavior is on a tablet. |
@OverloadedOrama Yes imo that would be better, but its probably better suited in another issue ? I'll keep this proposal open since there is still no working deviceID, but the change to the default pressure at least made it workable again. |
Describe the project you are working on:
NA
Describe the problem or limitation you are having in your project:
There doesn't seem to be a way to detect if the input device used supports
pressure
. In my cases at least pressure with a mouse is set to 0. This alone is not enough to decide if the device supports pressure though as graphic tablets also can produce a MouseMotionEvent with a pressure of 0 (at least with my Huion 420 using wacom driver on linux).This mostly happens when stopping to draw (pen up).
Describe how this feature / enhancement will help you overcome this problem or limitation:
With that information i would be able to support mouse and pens with the same codebase.
Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
NA
Describe implementation detail for your proposal (in code), if possible:
The best way i can think of would be to add a
is_pressure_supported
attribute to the MouseMotionEvent.An alternative would be to use -1 as default for unsupported devices, but might break existing scripts.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Not that i am aware of.
Is there a reason why this should be core and not an add-on in the asset library?:
Addons can't really patch existing event classes.
The text was updated successfully, but these errors were encountered: