-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Shortcuts rework - fixed issues with input propagation and triggering of unwanted shortcuts. #42109
Shortcuts rework - fixed issues with input propagation and triggering of unwanted shortcuts. #42109
Conversation
519df49
to
ecd24f6
Compare
|
Will this also solve #22843? |
@BeayemX No, pressing escape to close the bottom panel was removed completely. That functionality would need to be reinstated for it work. |
16/09/2020
|
62d0f77
to
7a6832c
Compare
@@ -56,19 +56,6 @@ void EditorHelp::_init_colors() { | |||
class_desc->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE)); | |||
} | |||
|
|||
void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) { |
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.
7a6832c
to
3e8ba6d
Compare
if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) { | ||
grid_step_multiplier--; | ||
} | ||
viewport->update(); | ||
} |
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.
This looks like a lot of changes but all I did was add the is_valid()
check
3e8ba6d
to
26c40d3
Compare
b0583a6
to
3ddc175
Compare
0c26e98
to
f27c661
Compare
@akien-mga Please let me know if you want me to squash some or all of the commits. I feel they are unrelated enough to warrant separate commits but it is up to you. |
The current commit lineup looks good to me 👍 |
@akien-mga Can I bump this one please ;) |
f27c661
to
1f4f8f7
Compare
1f4f8f7
to
7941235
Compare
Thanks a ton, it's great to get all these issues finally solved :) |
Thank you it will solve a lot of headaches I had |
I didn't expose this as a property or add documentation in the original PR godotengine#42109.
Note that godotengine#42109 already reverted the change of MenuButton, and actually fixed godotengine#43695. As a result, this commit only reverts the change to LinkButton, in order to prevent unpredictable consequences.
The key file to look at is
base_button.cpp
. The rest is mainly just adding the usage of the new API, and changing of names. There are a couple of other commits with some input/shortcut related changes. You can view those commits on their own to see what was changed.What does this solve?
This solves a number of shortcut related issues which have been around the engine for quite some time. Issue listed below.
Fixes #36205, fixes #38922, fixes #37807, fixes #37054, fixes #17591, fixes #35834, fixes #31779
(Supersedes) closes #37068 and closes #39039
Most notably this allows greater control over what context shortcuts are allowed to be triggered.
What changes are there and how does it solve the issue?
Control
's have a new method -set_shortcut_context(ObjectID p_ctx)
. This allows you to set the 'context' of where the shortcut is allowed to work. See the below image. The MenuButton's have theScriptTextEditor
as their context. This means that you have the option to ensure that their shortcuts will only trigger if theScriptTextEditor
or any of it's children have GUI focus in the viewport.This context is used wherever you want to check for shortcuts. Most commonly, this will be inside
unhandled_key_input
. Here is an example for the ScriptTextEditor...script_text_editor.cpp (constructor)
menu_button.cpp
If the focus of the viewport is not a child of the context, then no input is handled. Nice!
I am pretty sure I have caught every case of Buttons and MenuButtons being used as shortcuts and have added
set_shortcut_context
where it is needed, but it is possible I missed a few.Through my work I also found a number of redundant pieces of code, which included some
_unhandled_key_input
calls which were never reached since their functionality was actually handled in a parent.In Action:
#17591
#37054
Also Works in script...
In this clip I spam the button shortcut I set up. As you can see, it only works when the shortcut context has the viewport focus.