godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.11k stars 69 forks source link

Add a mouse mode that disables mouse input entirely #10170

Open vvvvvvitor opened 1 month ago

vvvvvvitor commented 1 month ago

Describe the project you are working on

UI for a 2D metroidvania game.

Describe the problem or limitation you are having in your project

I'd like to disable mouse input for the UI but the only way to do so is by setting the mouse filter to "Ignore" on every element that can be interacted with the mouse, which can take some time or is outright impossible in some cases without doing a hack.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A way to globally disable mouse input without setting the mouse_mode to captured or hidden would solve the issue.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

A new mouse_mode could work, something like:

Input.mouse_mode = Input.MOUSE_MODE_DISABLED

If this enhancement will not be used often, can it be worked around with a few lines of script?

As mentioned by @dalexeev, you can cover the viewport with a Control node to stop mouse events.

Is there a reason why this should be core and not an add-on in the asset library?

I don't think this can be done with an addon.

dalexeev commented 1 month ago

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

You can cover the entire screen with an empty control. This will stop all mouse events.

Calinou commented 1 month ago

I don't think we should make it easier to disable mouse input entirely, as it leads to bad accessibility. Menus ought to be accessible with a mouse whenever possible; don't force players to use a keyboard or gamepad to navigate them.

@dalexeev's workaround should already do the trick if you really need this.

vvvvvvitor commented 1 month ago

I don't think we should make it easier to disable mouse input entirely, as it leads to bad accessibility. Menus ought to be accessible with a mouse whenever possible; don't force players to use a keyboard or gamepad to navigate them.

I do agree with the accessibility argument, but some games just aren't designed with mouse controls in mind or don't work well with them and adding support for it can mean doing unnecessary work for something that isn't even needed.

There are also other cases where you may want to disable mouse input like in cutscenes.

@dalexeev's workaround should already do the trick if you really need this.

I didn't know about @dalexeev's solution, I'll update the proposal.

AThousandShips commented 1 month ago

People are free to design their games in what ever way they want, even if they violate standard good practices and accessibility principles, but if the main purpose of this proposed feature is to enable users to do so I don't think it's a good idea

If there are other reasons to add this feature that's another matter IMO, but I don't think we should add a feature specifically for that, i.e. just disabling mouse input instead of disabling all input

vvvvvvitor commented 1 month ago

People are free to design their games in what ever way they want, even if they violate standard good practices and accessibility principles, but if the main purpose of this proposed feature is to enable users to do so I don't think it's a good idea

If there are other reasons to add this feature that's another matter IMO, but I don't think we should add a feature specifically for that, i.e. just disabling mouse input instead of disabling all input

Maybe a better proposal would be to let users disable InputEvents? (Ie.: Input.disable(InputEventMouse) ) If so, I can close this one and make a new one.

AThousandShips commented 1 month ago

As long as the proposed use is a different one, but I don't how the way it's implemented changes anything if the same underlying reason is the same