_gui_input(event) mouse filter is not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jujumumu

I have 2 control nodes one on top of the other both with _gui_input(event) both mouse filters are pass so the gui input should do something then still pass it on. I want both control nodes to detect mouse movement. Is this a bug or am i dumb? If I am dumb please post a answer.

Tried it out in a minimal scene and is seems to work. Did you scale both controls to the same size and skipped the accept_event() function?

flurick | 2019-09-11 19:47

Both controls are the same size and I did skip the accept event. I think it is a bug because I did it on a minimal seem and it does not seem to work? Not sure how you got it to work.

Simple test:

-Node 2d
–Control 1
–Control 2

Control 1 script:

extends Control
func _gui_input(event):

Control 2 script:

extends Control
func _gui_input(event):

Then both of the filters are set to pass

jujumumu | 2019-09-11 23:00

I see. My try was with a controls as a root node and a second control as its child passing events to its parent. Looks like there are a few issues open about mouse filter, someone mentioned that events according to the docs only propagate up. So one workaround could be to use _input():

func _input(event):
	if event is InputEventMouseMotion:
		if get_rect().has_point(event.position):
			printt(name, event) 

flurick | 2019-09-12 09:37