-
-
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
Button shortcuts no longer "press" the Button. #71328
Button shortcuts no longer "press" the Button. #71328
Conversation
This basically reverts (or more like supersedes) #63335 |
29ce71c
to
1ed6094
Compare
Also fixes #40464 |
1ed6094
to
72ad688
Compare
@KoBeWi I restored shortcut feedback (works a little different now). |
Seems good to me.
I foresee potential requests to make the timer configurable... but we can see first if we can get away with a reasonable default. I guess we can also add a project setting for it eventually if there's demand. Which BTW raises the question of whether folks really want to configure this on a per-button basis, or if a global toggle for shortcut feedback and duration wouldn't be better. |
72ad688
to
1f1b4c3
Compare
@akien-mga made the timer configurable as a project setting |
scene/gui/base_button.cpp
Outdated
if (shortcut_feedback_timer == nullptr) { | ||
shortcut_feedback_timer = memnew(Timer); | ||
add_child(shortcut_feedback_timer); | ||
shortcut_feedback_timer->set_wait_time(GLOBAL_GET("gui/button/shortcut_feedback_highlight_time")); |
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.
I'm always a bit unhappy about re-fetching the value every time it's needed when it's unlikely to change during the process. But this code won't be called multiple time per frame so I guess it's OK.
I still think there would be value in a dirty flag/caching system for GLOBAL_GET
as attempted in #60926 :)
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.
It could be done the same as SNAME if needed, I guess. But of course, may be better for another PR.
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.
Or it could be cached in the constructor and updated when project settings change (with #62038).
I think the default value 0.5 is too long and doesn't look good. Something like 0.2 is better. The button is highlighted for similar time as the shortcut is normally pressed. |
1f1b4c3
to
68c3125
Compare
@KoBeWi changed! |
CC @Spartan322 as you had interest in disabling the shortcut feedback (which this still preserves but refactors). The last question for me is this one:
|
Maybe we can move to |
68c3125
to
740bcee
Compare
@KoBeWi done changes! |
@@ -267,6 +261,10 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const { | |||
return DRAW_DISABLED; | |||
} | |||
|
|||
if (in_shortcut_feedback) { |
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 could be replaced by
if (in_shortcut_feedback) { | |
if (shortcut_feedback_timer && !shortcut_feedback_timer->is_stopped()) { |
to avoid extra bool flag, but it's not important I guess.
* Button shortcuts were treated as generic input events on buttons. This means that to activate a button shortcut you had to press and release. * This logic is removed and now shortcuts always activate on press. * This makes the editor feel more responsive and solves problems related to this behavior. Fixes godotengine#45033 and possibly others.
740bcee
to
dd3a1b0
Compare
Thanks! |
Introduced by me by mistake on godotengine#71328. Fixes godotengine#71652.
Introduced by me by mistake on godotengine#71328. Fixes godotengine#71652.
Fixes #45033 and possibly others.
Fixes #40464.