You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A CRPG, therefore a game with a ton of UI that the player interacts with mostly using the mouse.
Describe the problem or limitation you are having in your project
BaseButton has a disabled state where, on most case scenarios, the Button is expected to do nothing and not react to inputs directly made on it, such as pressing the button. However, positional mouse inputs are handled through mouse_entered and mouse_exited, inherited from Control, which does not account for this.
Therefore, for virtually every single Button, I need to check within mouse_entered whether the button is enabled or not for stuff such as playing UI audio queues or do whatever I want to do when the button is hovered, but not disabled. This is already a core feature of BaseButton through its UI Themes, due to the Button applying the Hover style when hovered, but not doing so if it is disabled.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add a hovered signal on BaseButton which emits() if the mouse hovers the Button and the Button is notdisabled. This would be a quality of life improvement that, in my opinion, feels common enough to have, avoiding the necessity of having to go through mouse_entered which disregards this extra layer of information.
As mentioned above, UI Themes for Buttons already do this: there is a Theme for Hovered which is only set IF the mouse is hovering and the button is not disabled, we just need a signal to do similar actions through scripts.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
This is how I would expect to get when I connected the hovered Button signal to an owner script through the editor: func _on_hovered() -> void: pass
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yeah, by using mouse_entered and checking if disabled is true or false within, but this requires for whichever script is reacting to the signal to have access to the Button in order to check its disabled var, when more often than not you just need to know if the Button was being hovered while enabled.
Is there a reason why this should be core and not an add-on in the asset library?
BaseButton has a bunch of core signals: button_down, button_up, pressed, toggled. All referring to basic interactions with the Button through the Mouse or Shortcuts. I feel hovered should also be available, given it falls under the same group: a core interaction the Mouse has with the UI, hovering it when enabled.
The text was updated successfully, but these errors were encountered:
The workaround is extremely simple, I feel, and it's not an use-case so common it warrants its own signal as a Quality of Life.
The signal may also be more specific than desired. For example, sometimes it's worth listening for focus, not just the cursor hovering.
Keep in mind that if you already have a script attached to these custom buttons, you don't need to connect the mouse_entered signal through the editor (if that is the annoyance). You may also do it on _init, or _ready in code.
Therefore, for virtually every single Button, I need to check within mouse_entered whether the button is enabled or not for stuff such as playing UI audio queues or do whatever I want to do when the button is hovered, but not disabled.
I feel that particular use case warrants a built-in solution given how common it is.
Last reply is very reasonable. Closing issue due to being, arguably, a duplicate and to avoid adding onto the already massive pile of existing open issues.
Describe the project you are working on
A CRPG, therefore a game with a ton of UI that the player interacts with mostly using the mouse.
Describe the problem or limitation you are having in your project
BaseButton has a
disabled
state where, on most case scenarios, the Button is expected to do nothing and not react to inputs directly made on it, such as pressing the button. However, positional mouse inputs are handled throughmouse_entered
andmouse_exited
, inherited from Control, which does not account for this.Therefore, for virtually every single Button, I need to check within
mouse_entered
whether the button is enabled or not for stuff such as playing UI audio queues or do whatever I want to do when the button is hovered, but not disabled. This is already a core feature of BaseButton through its UI Themes, due to the Button applying theHover
style when hovered, but not doing so if it is disabled.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add a
hovered
signal on BaseButton whichemits()
if the mouse hovers the Button and the Button is notdisabled
. This would be a quality of life improvement that, in my opinion, feels common enough to have, avoiding the necessity of having to go throughmouse_entered
which disregards this extra layer of information.As mentioned above, UI Themes for Buttons already do this: there is a Theme for Hovered which is only set IF the mouse is hovering and the button is not disabled, we just need a signal to do similar actions through scripts.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
This is how I would expect to get when I connected the
hovered
Button signal to an owner script through the editor:func _on_hovered() -> void: pass
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yeah, by using
mouse_entered
and checking ifdisabled
is true or false within, but this requires for whichever script is reacting to the signal to have access to the Button in order to check itsdisabled
var, when more often than not you just need to know if the Button was being hovered while enabled.Is there a reason why this should be core and not an add-on in the asset library?
BaseButton has a bunch of core signals:
button_down
,button_up
,pressed
,toggled
. All referring to basic interactions with the Button through the Mouse or Shortcuts. I feelhovered
should also be available, given it falls under the same group: a core interaction the Mouse has with the UI, hovering it when enabled.The text was updated successfully, but these errors were encountered: