Skip to content
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 graphics tablet input demo #1162

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Feb 6, 2025

This adds a demo for pen input in Godot, which will also come in handy to test tablet-related PRs like godotengine/godot#76120.

This uses code from godotengine/godot#75903 for drawing (thanks @nlupugla!).

This demo was developed on 4.3, so it can be cherry-picked.

Preview

graphics_tablet_input webp

TODO

  • Fix width curve according to pen pressure. Right now, it changes the entire line's width, but it should keep the history of the pressure over the line's length and apply it correctly. I have code in place for that but it not's working correctly for some reason. Please help on this if you can 🙂

@Calinou Calinou changed the title [WIP] Add a graphics tablet input demo Add a graphics tablet input demo Feb 6, 2025
@Calinou Calinou marked this pull request as draft February 6, 2025 11:26
@Calinou Calinou requested a review from bruvzg February 6, 2025 11:26
@Calinou Calinou force-pushed the add-graphics-tablet-input-demo branch from 9e56fa6 to e33ef5e Compare February 6, 2025 11:29
@bruvzg

This comment was marked as outdated.

@bruvzg
Copy link
Member

bruvzg commented Feb 6, 2025

Tested on macOS with Wacom tablet and Apple Pencil, some notes:

  • tilt registers but do nothing, it's probably should have at least some indication, at least display a tilt vector, or maybe change color.
  • extremely long lines start to lag, so it's probably worth splitting the line at some point.

@Calinou Calinou force-pushed the add-graphics-tablet-input-demo branch from e33ef5e to 615ccfe Compare February 8, 2025 19:58
@Calinou
Copy link
Member Author

Calinou commented Feb 8, 2025

I fixed the width curve to work as intended.

  • tilt registers but do nothing, it's probably should have at least some indication, at least display a tilt vector, or maybe change color.

I added a tilt vector visualization, but I can't test it as my tablet (Wacom Intuos M 2013) doesn't support tilt.

  • extremely long lines start to lag, so it's probably worth splitting the line at some point.

Done (it now splits every 1024 points).

@Calinou Calinou marked this pull request as ready for review February 8, 2025 20:00
@Calinou Calinou force-pushed the add-graphics-tablet-input-demo branch 2 times, most recently from 12d43ba to e6e31e0 Compare February 8, 2025 22:32
@bruvzg
Copy link
Member

bruvzg commented Feb 9, 2025

I added a tilt vector visualization, but I can't test it as my tablet (Wacom Intuos M 2013) doesn't support tilt.

Seems to be working fine.

PXL_20250209_105211520.mp4

@Calinou Calinou requested a review from aaronfranke February 10, 2025 15:12
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a graphics tablet so I haven't tested it, but from reading the code on GitHub, it looks great!

misc/graphics_tablet_input/graphics_tablet_input.gd Outdated Show resolved Hide resolved
misc/graphics_tablet_input/graphics_tablet_input.gd Outdated Show resolved Hide resolved
@Calinou Calinou force-pushed the add-graphics-tablet-input-demo branch from e6e31e0 to 8c9a1b0 Compare February 10, 2025 16:29
@Calinou Calinou merged commit fdb2f50 into godotengine:master Feb 10, 2025
1 check passed
@Calinou Calinou deleted the add-graphics-tablet-input-demo branch February 10, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants