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

Allow InputEventJoypadMotion to have an Invalid Axis without error messages. #10754

Closed
JulianHeuser opened this issue Sep 15, 2024 · 1 comment · Fixed by godotengine/godot#97068
Milestone

Comments

@JulianHeuser
Copy link

Describe the project you are working on

A first-person game with optional SteamInput support.

Describe the problem or limitation you are having in your project

I'm implementing optional SteamInput support, so I need a way to unbind all joystick controls without removing them, since I rely on the index to be kept in place.

For InputEventJoypadButton, I can set the button_index to JOY_BUTTON_INVALID (-1), and this effectively unbinds the input event. I can do the same for InputEventJoypadMotion by setting axis to JOY_AXIS_INVALID (-1), but this produces the following error:

E 0:00:00:0604   ControlsManager.gd:243 @ _ready(): Condition "p_axis < JoyAxis::LEFT_X || p_axis > JoyAxis::MAX" is true.
  <C++ Source>   core/input/input_event.cpp:1019 @ set_axis()
  <Stack Trace>  ControlsManager.gd:243 @ _ready()

Describe the feature / enhancement and how it helps to overcome the problem or limitation

I suggest allowing a InputEventJoypadMotion's axis to be set to JOY_BUTTON_INVALID without triggering the error, as well as adding an error for if InputEventJoypadButton's button_index is below JOY_BUTTON_INVALID or above JOY_BUTTON_MAX, to make behavior between the two more consistent.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

N/A

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not as far as I'm aware, unless there's another way to unbind axes without changing any indices under the input action.

Is there a reason why this should be core and not an add-on in the asset library?

This involves error messages within the engine.

@Mickeon
Copy link

Mickeon commented Sep 16, 2024

The main issue of the proposal is a surprisingly trivial change: godotengine/godot#97068

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

Successfully merging a pull request may close this issue.

3 participants