godotengine / godotengine/godot-docs

GraphNode mouse-filter options

Open
#2,314 0 comments 0 reactions 0 assignees View on GitHub
area:class reference enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

GraphNode seems to need the mouse-filter set to pass to work. If you try to set the mouse_filter (on GraphNode's _ready function or via the inspector), the mouse-filter gets reset. A workaround is to set the filter in the GraphNode's _gui_input event. But if you set the mouse-filter to STOP, you cannot drag and drop the GraphNode.
So it should be clear that you should not edit the mouse-filter and it should be clear why you shouldn't. Maybe with an example, how you can just filter some events. In my case, i just needed to filter the right-mouse-click events out, so i wrote this code in GraphNode:

```
func _on_GraphNode_gui_input(event):
if event is InputEventMouseButton and event.button_index == BUTTON_RIGHT and event.pressed:
self.mouse_filter = Control.MOUSE_FILTER_STOP
else:
self.mouse_filter = Control.MOUSE_FILTER_PASS
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.