Skip to content
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

Dockable container is blocking mouse input to area nodes in a child viewport #1

Closed
MaxKablaam opened this issue May 22, 2021 · 2 comments

Comments

@MaxKablaam
Copy link

I'm using this plugin for some of my UI layout, and some of my panels have 3D viewports in them. In the 3D scene, I have Area nodes that have mouse_entered and mouse_exited signals on them. When I nest these viewports in a DockableContainer, the areas do not trigger the signal, even when the DockableContainer mouse filter is set to "Ignore". My hunch is that this is because the dockable container uses some tab and split containers, and when the dockable containers mouse ignore setting is changed, it is not propagating to the sub-containers.

Steps to reproduce:

  1. Create a viewport container, with a viewport. In the viewport you need a 3D scene, with Areas and Colliders.
  2. Nest the viewport container in something like a margin container.
  3. Set margin container and viewport container mouse filters to "Ignore"
  4. Set the viewport "object picking" to on.
  5. Connect the mouse_entered and mouse_exited signals from the Area to a script in the Margin Container.
  6. Preview the scene, hovering the mouse over the collider will trigger whatever you put in the connected function...
  7. Create a new margin container with dockable container child, put this at the top of the scene tree. Nest the original margin container with viewport onto the dockable container node.
  8. Set the new margin container and dockable container mouse filter mode to "ignore"
  9. Preview the scene. The signals will no longer trigger when mouse hovers over the area.
@MaxKablaam
Copy link
Author

I was able to get this to work by adding this line to a script on the top level node:

func _input(event):
	$DockableContainer/MarginContainer/ViewportContainer/Viewport.unhandled_input(event)

Maybe I missed this documented somewhere, but it would be helpful for others.
Perhaps there could be a checkbox in the dockable container that can handle this, so that it is more user friendly.

@gilzoide
Copy link
Owner

Unfortunately, this is a known unintuitive behaviour of Viewports + ViewportContainers in Godot, in a quick search I found two open issues about it (godotengine/godot#17326, godotengine/godot#26181) =(

You can also move this workaround to your ViewportContainer and handle this in _gui_input like in this answer if you want, it may be a little better than making your top level node have this responsibility.

Perhaps there could be a checkbox in the dockable container that can handle this, so that it is more user friendly.

Apart from ViewportContainers, that are explicitly made to handle Viewports, it doesn't make sense trying to track Viewports as an edge case on general purpose Containers like DockableContainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants