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 Input.parse_action() #29363

Closed
menip opened this issue Jun 1, 2019 · 6 comments
Closed

Add Input.parse_action() #29363

menip opened this issue Jun 1, 2019 · 6 comments

Comments

@menip
Copy link
Contributor

menip commented Jun 1, 2019

Input currently has parse_input_event(). In order to simulate an action, you currently have to do something like:

var action_event_list = InputMap.get_action_list("action")
var some_action_event = action_event_list[0]
Input.parse_input_event(some_action_event)

It would instead be convenient to be able to Input.parse_action("action").

@KoBeWi
Copy link
Member

KoBeWi commented Jun 1, 2019

You can also write the above code as a one-liner:
Input.parse_input_event(InputMap.get_action_list("action")[0])

@groud
Copy link
Member

groud commented Jun 1, 2019

This feature is not needed to me. You can already create custom action events easily with InputEventAction.
Example:

var event = InputEventAction.new()
event.action = "ui_accept"
event.pressed = true
Input.parse_input_event(event)

@menip
Copy link
Contributor Author

menip commented Jun 1, 2019

@KoBeWi I know, and that is how I have it in my game. I split it into multiple lines to be more readable.

@menip
Copy link
Contributor Author

menip commented Jun 1, 2019

@groud I did not know this. That is indeed a much more fluid.

I'll keep issue open for a week and see what other discussion we get.

@Xrayez
Copy link
Contributor

Xrayez commented Feb 22, 2020

Just to note, if you don't need to parse input events from actions alone, you can currently manipulate action states with:

Input.action_press(action)
Input.action_release(action)

They don't force to trigger _input() callbacks though, so this is only useful if you process your input with Input.is_action_pressed over event.is_action_pressed API and similar methods.

See also godotengine/godot-proposals#104 which could allow to have a complete control over the input (actions) state.

@KoBeWi
Copy link
Member

KoBeWi commented May 27, 2020

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.

The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.

If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

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

4 participants