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 joypad input map conversion to project converter #77615

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

jpcerrone
Copy link
Contributor

@jpcerrone jpcerrone commented May 29, 2023

Fixes godotengine#77314

Changes

  • Converts all of the Godot 3 joypad button index mappings to their Godot 4 equivalent mappings. "button_index":10 -> "button_index":4
  • On Godot 4, the entries for the L2 and R2 buttons have been moved to the axis mappings, so entries for button index mappings for those buttons get converted to axis mappings.
    InputEventJoypadButton, "button_index":6,"pressure":0.0,"pressed":false -> InputEventJoypadMotion, "axis":4,"axis_value":1.0
  • Converts the Godot 3 axis mappings for L2 and R2 to the Godot 4 axis mappings . (These are the only 2 axis mappings that have changed).
    "axis":7 -> "axis":5

Testing

Tested by running the converter and the validator with a Godot 3 project that contains a project file with the following entries:

  • Button mapping that should be converted to its Godot 4 value.
  • Button mapping that shouldn't be converted (Same mapping in 3&4)
  • Axis that should be converted. (L2 and R2).
  • Axis that shouldn't be converted.
  • Button index that's greater than the ammount of mappings (23).

All of these conversion get performed as expected.
Also 3 validation tests have been added in the code for the most general conversion cases.

Fixes godotengine#77314 (Input Map's joypad button numbers are not converted).
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Didn't test, but looks good overall.

@akien-mga akien-mga modified the milestones: 4.x, 4.1 Jun 13, 2023
@akien-mga akien-mga merged commit abb6744 into godotengine:master Jun 13, 2023
@akien-mga
Copy link
Member

Thanks!

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.

Input Map's joypad button numbers are not converted to new numbers in 3->4 conversion
3 participants