How to create a drag n drop for editor plugin / editor script

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

I am currently working on tools needed for my project, And I need to create a drag n drop function for my tool. For example I want to able to drag a texture from FileSystem window to a let’s say texture rect. I manage to get mouse entered to work. But when I do

if Input.is_mouse_button_pressed(BUTTON_LEFT):
	instanced_creation_panel.get_node("VBoxContainer/Label").text = "pressed"

inside on_mouse_entered() Nothing works.

Another problem is that I don’t know how to get what is being dragged. I am assuming it has something to do with EditorInterface.get_selection()? I think I should check to see if left button is pressed , if it is then call 1get_editorinterface.get_selection()` . But since I can’t detect mouse button, I am at a loss here.

Edit : when I place is_mouse_button_pressed(BUTTON_LEFT) inside get_input(event)
then I will get reponse from mouse button, however it only works when I clicked inside the texture rect. It will not work when I press mouse butotn outside the texturerect and then move the cursor into texturerect