Drag and drop, drag_end data missing

Godot Version

4.3

Question

Hi,
Drag and drop seems simple, but it seems to be missing the case where the drag is stopped outside a drop zone.
What I want is simple, when drag starts I want to change the modulate alpha of the node(not preview) to 0.6 and return it to 1 on drag end.
I would have liked to return the value to 1 during NOTIFICATION_DRAG_END, but the data is already disposed at this point. Doing it in _drop_data, only works on success.
I want to see what item in an inventory is getting dragged in case that duplicates exists.
I could go through all the items on NOTIFICATION_DRAG_END, but that seems excessive.
Did I miss something?

你可以使用变量保存预览控件。
判断预览控件是否存在。
也许即使没有成功拖动,_can_drop_data也能得到数据?

Currently the drag data gets cleared before NOTIFICATION_DRAG_END.
So this is currently not supported.

A quick workaround to deal with this situation consists of two steps:

  1. Listen on NOTIFICATION_DRAG_BEGIN and store the drag data (it is available at this time).
  2. on NOTIFICATION_DRAG_END, check the viewport, if gui_is_drag_successful() == false and act on the stored drag data from step 1 accordingly.

Since this might be good material for a bug report, may I ask you to open an issue here: Issues · godotengine/godot · GitHub