+1 vote

After a while, avoiding using it, I'm getting fine with Godot's drag and drop feature.

I want to know if there is a way to change/hide/remove the default mouse icon that appears when target control rejects the dragging data.

I mean the "prohibited" icon:
https://imgur.com/a/7AY3NnC

It's weird because it cancels the drag preview and it's not well looking.

(Couldn't take a SS because the mouse disappears)

Thanks

in Engine by (322 points)

2 Answers

0 votes

Currently, almost imposible from GDScript.
Even if you hide the mouse before dragging, while dragging the mouse is always visible, and there is no easy way to know what happens in the dragging process, no options, no signals.

So I ended dealing with custom mouse cursors, they need to be 32x32 size.
I draw a 100% alpha square then added a 50% white pixel at column 3 row 3 from the pixel grid, so it's almost imperceptible. The code at main script:

var can_drop_cursor_img = load("res://assets/cursors/can_drop.png")
var forbidden_cursor_img = load("res://assets/cursors/forbidden.png")
Input.set_custom_mouse_cursor(can_drop_cursor_img,7)
Input.set_custom_mouse_cursor(forbidden_cursor_img,8)

7 is Input.CURSOR_CAN_DROP and 8 is Input.CURSOR_FORBIDDEN.
Note, I didn't use the same image file for both because of "technical issues" only one will work, so that's why I gave them different file names.

by (322 points)
edited by
0 votes

For anyone still trying to figure out how to avoid "stop" icon, I found a way by making the container in the back (ideally the whole screen) also accepting drop event, so the icon will not appear.

by (20 points)
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 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 webmaster@godotengine.org with your username.