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?

asked Oct 23, 2019 in Engine by eod (145 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.

answered Oct 24, 2019 by eod (145 points)
selected Nov 27, 2019 by eod
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 How to use this Q&A? before posting your first questions.