0 votes


Current game node structure:


Main Scene:
MapView (Node2D)
. Camera2D
. Navigation2D
.. TileMap
. PopupLayer (CanvasLayer)
.. CenterContainer
... EscapeMenu_PP (PopupPanel, Layer=2, instanced as a scene)

. Panel
.. VboxContainer
... Save
BTN (Button)
... Load_BTN (Button)


So when I hit the ESC key, the EscapeMenu_PP shows. It's about 300 pixels wide and 500 pixels tall and shows up above the TileMap, and doesn't cover the entire TileMap (game screen). However mouse inputs still "go-through" (pass?) this panel node and interact with the Camera2D.gd script.

For instance, in the Camera2D.gd script, I check for things like:
func _input(event):
. if event is InputEventMouseButton:
.. # middle click detected and do action...
.. # scroll wheel detected and do action... (e.g. zooming)
. if event is InputEventMouseMotion:
.. # used to implement "dragging" map...

Each of the above input actions still happen when I'm clicking/interacting with the EscapeMenu_PP panel. For instance, with the mouse in the panel, if I scroll the mouse wheel the zoom functionality on the map still occurs

Here is the breakdown of mouse filters in the inspector (referenced from above node structure):


Main Scene:
MapView (Node2D)
... snip ...
. PopupLayer
.. CenterContainer (filter=Stop)
... EscapeMenu_PP (filter=Stop)

EscapeMenu_PP (filter=Stop)
. Panel (filter=Stop)


I reviewed this, but didn't quite make sense of it, or if it applies:

My main question is how to stop (mouse) input events of going through the popup panel?

in Engine by (176 points)

1 Answer

0 votes
Best answer

Took a while but figured it out by disabling the _input of the Camera2D.gd when first popping up the panel.


And then I simply enable it when the panel gets closed.

by (176 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.