godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 93 forks source link

Add a `files_dragged` signal to SceneTree #1765

Open me2beats opened 3 years ago

me2beats commented 3 years ago

Describe the project you are working on: Editor plugins (gdscript)

Describe the problem or limitation you are having in your project: Before dropping files from OS to game window, in many cases I would like to know that files are dragged to the game window (that is they may not be dropped, just dragged). That is what many modern apps like Discord or browsers like Chrome have. This provides better UX when drag&drop files from OS, otherwise I can't even change the cursor to the corresponding icon then dragging files

Describe the feature / enhancement and how it helps to overcome the problem or limitation: files_dragged signal would solve the problem

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

SceneTree  files_dragged(screen:int)

In many cases it would be enough just to have a signal that some files have been dragged into the game window. But in some cases it would also be great to know which files were dropped. So files_dragged signal could have an argument with a PoolStringArray of files, as well as files_dropped has

SceneTree  files_dragged(files: PoolStringArray, screen: int))

Although the proposed name for this signal might cause confusion, so maybe a more accurate / common name for the signal could be chosen.

If this enhancement will not be used often, can it be worked around with a few lines of script?: It seems it can't

Is there a reason why this should be core and not an add-on in the asset library?: SceneTree feature

Xrayez commented 3 years ago

otherwise I can't even change the cursor to the corresponding icon then dragging files

Does existing Control.set_drag_preview() help this in some way? I agree that if you want immediate dragging information, using Control nodes might not be enough. Haven't used SceneTree files dropping myself, though.