Having trouble with button event and drag & drop

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

I have trouble to understand the mouse pass filter,
basically I have an inventory with 10 slots, each slots have a texture_rect and a button, the texture_rect is used for the drag and drop function (wich works really fine)

But I’ve added a button to be able to select one of the 10 slots on mouse click, again it’s working fine but now my texture_rect don’t receive the event as it is swallowed by the Button and when I swap the 2 it does the opposite the button doesn’t work anymore but the drag and drop do, I’ve been looking around for solutions but can’t find any here’s my scene tree :

image

and here’s a small project zip to reproduce the case :

The “mouse pass filter” works in the following way:
Take this scene tree:

  • Control0
    • Control1
      • Control1A
      • Control1B
    • Control2

and set all nodes to “mouse filter pass”.

If you click with the mouse on Control1A, then the following nodes receive the mouse button input event in the following order under the assumption, that none of them set the input event as handled:

  1. Control1A
  2. Control1
  3. Control0

mouse filter pass does:

  • propagate the event to parent node

mouse filter pass doesn’t:

  • propagate the event to sibling nodes.
1 Like

Thank you so much… I’ve been struggling for few hours on this one…

here’s the solution, make the button a child of the ItemIcon so it passes the event… :

image

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.