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

adding input action manually device 0 vs -1 #85396

Open
pseidemann opened this issue Nov 26, 2023 · 7 comments
Open

adding input action manually device 0 vs -1 #85396

pseidemann opened this issue Nov 26, 2023 · 7 comments

Comments

@pseidemann
Copy link

Godot version

v4.1.3.stable.official [f06b6836a]

System information

macOS 14.1.1 (23B81)

Issue description

when adding an input action and e.g. pressing W on the keyboard and then adding that key, results in a different device in the project settings than choosing that key manually from the tree

Steps to reproduce

  • press W on the event config screen
  • add W manually on the event config screen

Minimal reproduction project

N/A

@AThousandShips
Copy link
Member

AThousandShips commented Nov 26, 2023

This is likely because device = -1 means any device AFAIK

You can change this part with the option button that says "Any Device", to select a specific device number

There is probably an option when recording to not assign the specific device as well, unsure though will look through the editor tomorrow

@pseidemann
Copy link
Author

pseidemann commented Nov 27, 2023

hi @AThousandShips,

I get -1 when I press a key on my keyboard and 0 when I add the key manually. I would expect this to be the other way around. but there is no option to change this either way. it's not visible to the user what is happening, unless I look into the source of project.godot.

the option you mentioned is not visible to me. I'm using v4.1.3.stable.official [f06b6836a].

there are more inconsistencies with other values. unicode gets set for pressing but not in the manual case. I could also produce at some point that keycode and key_label are set for one of the cases but not the other, though I'm not sure anymore how I did it

@AThousandShips
Copy link
Member

You are right, the action part is specifically for the non-keyboard devices, I'm not sure exactly about this case and setup or what is appropriate here

@Calinou
Copy link
Member

Calinou commented Nov 27, 2023

The default device in the Input Map editor dialog was changed to All Devices in 4.0, as it makes it easier to have input actions that work out of the box on every system regardless of configuration (e.g. due to issues like #59250, or when using an analog keyboard).

However, the default in the Input singleton wasn't changed to keep compatibility with existing projects. We could have chosen to break this compatibility in 4.0, but it's too late now 🙂

Edit: I misread what you meant as both actions are in the editor dialog, nevermind.

@pseidemann
Copy link
Author

pseidemann commented Nov 27, 2023

You are right, the action part is specifically for the non-keyboard devices, I'm not sure exactly about this case and setup or what is appropriate here

to chime in, I would expect that the result be exactly the same, no matter if I capture a key by pressing it or choosing it from the key list.

additionally I would expect that I can choose the device (if this is even relevant, otherwise the device should always be the same).

also, it might be a bug that unicode is not set when choosing manually, idk.

@AThousandShips
Copy link
Member

This is likely due to the same reason listed above, the selection from the list hasn't been updated to reflect the device change but listening does as it uses the system itself

@pseidemann
Copy link
Author

gotcha, so we got a bug then I assume 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants