-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
New Input Action Editor and previously hard-coded shortcuts can now be customised. #42600
New Input Action Editor and previously hard-coded shortcuts can now be customised. #42600
Conversation
Marking as draft until all CI passes and more testing is done... but I think it's pretty much there. |
ab38214
to
d9473b9
Compare
Regarding the interface:
|
@groud thanks,
|
…dded to_string() overrides for each which returns a 'debug-friendly' version which is not as presentable but provides more information and in a more structured fashion. Use as_text() for UI display scenarions and to_string() for debug cases
…trol (On Win/Linux) or Meta (on Mac) are not. Example use case: You are on Windows and you set a shortcut to be Control + E. This would serialize as Command=true and Control=true. If you then run this project on Mac, you would need to press Command AND Control to activate the shortcut - which is not what is intended. Now, you can set store_command to true, and it will only serialize to Command = true (no Control serialized). On Windows, this means Control. On Mac, it means only command.
…nputEventKey to conveniently create instances of references in one line.
…can now be edited.
EditorSettings will save and serialize to editor_settings.tres what the overrides are for each builtin action so they persist throughout sessions. Shortcuts are also created for each built in action as needed, however they are not serialised as they are auto-generated from the builtin action overrides.
0d19a3d
to
bba3369
Compare
What I suggested is to use the filter field as a label. As you only need to use the filter when you are not recording, the filter label should be used to show the entered keys combination when recording. The LineEdit should also be disabled (grayed out) when you are recording. So to sum up:
I think a global category at the top of the shortcut list should work. No need to hide them there, it wont bother users there, unlike in the project input mapping. |
#41998 is another case of hardcoded shortcuts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall nice work! Spotted some issues I've noted inline, will have to do some local testing.
One thing to note this will probably clash with #41100
Holy... that is a monster PR. Thanks for the feedback - I'll take a look and action it. |
I do plan to finish this at some point... I'm just a bit stuck on how to unify the "Shortcuts" and "Built-in Actions" for the editor... Got stuck on that, never thought of a good way of doing it, got distracted by other stuff, never finished this PR so as a result haven't been very active in contributing other new stuff. Any ideas welcomed 😃 |
@Paulb23 is that 2 separate scroll containers or one big one which contains both general and editor? |
One scroll container, though if it's easier two shouldn't be an issue. |
There's a misunderstanding here, built-in actions are not editor settings. They're part of the core runtime and used by various Controls for their internal logic (e.g. dialogs, buttons, tabs, etc.). So it doesn't make sense to allow configuring them in the Editor Settings dialog when they're project-related, and any change to their value would and should influence the behavior of Controls used in the game. Similarly, different games could use different bindings for the built-in actions, so configuring them editor-wide is not an option. |
@akien-mga I understand that. You can edit them in both project and editor settings. Project settings affects the actual game you are making, editor settings changes the editor. For example, if a user wanted to change the editor shortcut for copying, they would change the |
To me that looks a little crowded, though I'm not totally against it. Not quite sure which direction to take it from here. |
@Paulb23 I agree honestly... it is a little bit crowded. But I am not sure how else to do it. Would it be the worst thing to only have one visible at a time? Not in a completely separate tab like I originally had it, but instead just hiding/showing dependent on a button status... kind of like this, except with "Editor & Builtin" rather than "Game & Engine": I guess the confusing part is that they are all "Shortcuts" but some of them apply to specific editor areas, the "Builtin/Editor" ones apply to all controls like textedit/lineedit/graphedit, etc. So, should they be separated or not? |
Yeah the thought did cross my mind to remove the editor shortcuts altogether and move it all to the editor input map now it's available, this way we'd only have one system to maintain. Though that's probably a separate proposal. I would definitely keep them in the editor settings as it's not changed per project. Personally not a big fan of subtabbing as there's not that much difference between that, and having them as separate main tabs. Not sure if @groud has any thoughts/preference on the UI? |
editor/settings_config_dialog.cpp
Outdated
<<<<<<< HEAD | ||
======= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like bad merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops lol.
I haven't pushed the code from my latest changes btw (like the functionality shown in the shortcuts editor Gif)
Some feedback from IRC:
TL;DR:
|
@akien-mga Done, as you can see from the mentions above! :) I think for the UI stuff I will wait for the above PRs to to be merged so that there is less to review in the UI PR, since it relies on a lot of it. |
Closed as this has been split into smaller PRs. |
as_text()
to return a display-friendly and human readable string, to be used for UI display.to_string()
can be used to get a non-display friendly version which has more information for debugging. Before, some as_text() methods returned a nice readable string, and some displayed more debug-style information. Calinou comment (Can't assign mouse buttons or mouse wheel to editor shortcuts #38326 (comment))load_from_globals()
toload_from_project_settings()
. Closes 1 item from [TRACKER] Methods, properties and signals to consider for renaming in next planned compatibility breakage #16863command=true, control=true
, meaning that on Mac, you would need to press Command AND Control to execute the shortcut, which is not the intention. For this example, now you can choose whether to serialise Command or Control. Discussed at length with Reduz on IRC about this. Closes On Windows, it is impossible to set shortcuts for Mac which use Control/Command #42351::create_reference
on InputEventKey and JoypadButton which is a one-line way to do:The above code is used in many places with Buttons and Keys, so moving it to a utility one-liner saves A LOT of lines of code, at least a couple hundred.
Moved builtin input actions away from being defined twice in ProjectSettings and EditorSettings to only being defined once in InputMap. Project/Editor Settings instead just get the builtin actions and loop through them to add them to their settings list. Reduces code duplication.
The main part…
gui_input
with things likeif (k->is_pressed() && k->get_keycode() == KEY_C && k->get_command() == true){ /* copy */}
godot/scene/gui/text_edit.cpp
Lines 2876 to 2945 in 07112b9
Quite hard to follow in my opinion. This logic now looks like this, except the following logic can use any key combination, not just the left arrow key.
The keys used to perform these actions are defined in InputMap:
Closes #17927
Closes #29490
Closes #12164
Closes #42139
Closes #26854
Closes godotengine/godot-proposals#1532