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 an action_name property/method to identify the exact action #11499

Open
Billaferd opened this issue Jan 5, 2025 · 1 comment
Open

Add an action_name property/method to identify the exact action #11499

Billaferd opened this issue Jan 5, 2025 · 1 comment

Comments

@Billaferd
Copy link

Describe the project you are working on

An example of using Godot, C#, and Enterprise Design Patterns.

Describe the problem or limitation you are having in your project

When receiving an event from an input event we can check if it has been mapped to an action but the output of the as_text method is inconsistent. We need a reliable way of retrieving the name of the mapped action without resorting to doing matching on the input map strings. This will lead to more robust input handling and buffering.

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

The action is already being looked up to see if the event does map. For me to do that it would involve at least one more unnecessary lookup and interacting with the input map system. This would be far cheaper in resources if it was done in engine and a much more SOLID approach.

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

We would have a action_name method when is_action is true, null or blank otherwise.

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

It could be worked around, but it is unnecessary when it can be done relatively easily in engine.

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

It is an expected feature of the input event class.

@AThousandShips
Copy link
Member

There's no such mapping, how would this work with multiple actions mapped to the same input? How would it know? No such lookup is carried out when sending an input event

Having the event change after calling is_action would be very confusing, and if you are checking that why would you need this, just use that method instead directly?

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

2 participants