+1 vote

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 1geteditorinterface.getselection()` . 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

in Engine by (175 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.