godot
godot copied to clipboard
PopupMenu breaks future mouse interactions
Godot version
4.0.dev (7e79aead99)
System information
Arch Linux, GLES3, AMD RX 7900 XTX
Issue description
After calling popup()
on a PopupMenu
inside a GraphEdit
, some future mouse interactivity breaks. By this I mean you can no longer click the editor's scroll bars, or any buttons (neither pre-existing nor custom). I have not yet figured out a way to fix it other than closing the graph editor and re-opening it again (which is not possible in this included MVP, but might be useful troubleshooting knowledge).
This issues is not present if the display/window/subwindows/embed_subwindows
option is enabled. I'm not sure whether being inside a graph matters.
Steps to reproduce
- Run game.
- Click built-in
GraphEdit
buttons to verify that they work as expected (toggle grid, etc.). - Try dragging the
GraphEdit
scrollbars to verify that they work as expected. - Click my custom "some button" I added to verify that it prints "button pressed".
- Right click anywhere, which calls
PopupMenu#popup
, and then close the popup however you wish (clicking outside, escape, etc.). - Repeat steps 1-3 and see that they no longer work as expected.
Minimal reproduction project
Can you please test, if accepting the event in your MRP solves your problem?
func _input(event: InputEvent) -> void:
if not event is InputEventMouseButton: return
var e := event as InputEventMouseButton
match e.button_index:
MOUSE_BUTTON_RIGHT:
if e.is_pressed():
menu.position = position + get_global_mouse_position()
menu.popup()
accept_event() # This line is new.
Yes! That does solve it. So is this a user error thing, is what happens intentional? Thank you very much for the quick reply.
I have the same issue but instead in an editor plugin. The proposed solution does not work for me in this case. Once the menu pops nothing at all in the editor can be clicked until the right-mouse button has been pressed; this includes all other panels and even the code editor.