Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for drag-and-drop on Android interfaces #6168

Open
goatchurchprime opened this issue Jan 25, 2023 · 0 comments
Open

Add support for drag-and-drop on Android interfaces #6168

goatchurchprime opened this issue Jan 25, 2023 · 0 comments

Comments

@goatchurchprime
Copy link

Describe the project you are working on

A cave map drawing system that can be networked to a server to download assets in the form of photographs and lidar point scans.

Describe the problem or limitation you are having in your project

The filed_dropped signal in the SceneTree https://docs.godotengine.org/en/stable/classes/class_scenetree.html?highlight=files_dropped#signals lets someone on a PC drag-and-drop files from a file manager onto the godot app, which can then open them in order to use or upload them through the network in a convenient manner.

If the godot app is running on an Android phone then this won't be possible because you don't have multiple windows on the screen where it is possible to click on them in a file manager, drag across the godot window and release. And even if you could, the file paths delivered by the files_dropped signal wouldn't work because of the Android disk access system.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

There is a defined file-sharing-across-apps system in Android where you can select files in the file manager and click on the share button (usually next to the delete file button), and it shows a table of apps that you can share it to.

If the Godot Android app had the right settings so that it was included in this list, then sharing files to it could appear as a files_dropped signal.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The file-sharing Android feature is implemented using a FileProvider object described here: https://developer.android.com/training/secure-file-sharing I think the file manager generates an ACTION_SEND Intent and pops up a Chooser for all the other apps that can receive this Intent.

The implementation could be done either by wrapping the provided URI in the godot File object interface, or by copying across everything into a temporary file in the app's local store and providing a working path to that.

The latter would be simpler to implement, though it might result in duplicate data in the phone. For things like photos of someone's face to be included in a game, this wouldn't be a big problem.

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

There's no workaround.

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

It's an operating system problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants