web: Fix files_dropped implementation - #123543
Conversation
fd45c85 to
531ba35
Compare
| }; | ||
| if (!f['path']) { | ||
| f['path'] = f['name']; | ||
| MAX_DROP_SIZE: 200 * 1024 * 1024, |
There was a problem hiding this comment.
This could eventually be turned onto an EditorSetting in case someone wants to import a really big project (i would still agree the web editor is not home for such a project)
a823a1f to
4cf2db5
Compare
4cf2db5 to
5f34991
Compare
7e4beb8 to
a323aa2
Compare
I ended up refactoring that code without the AbortController since I realized that we were actually not chaining the promises correctly and thus not stopping after the first error anyway. This is because we were in fact processing all dirs/files "immediately" in any case, by queuing promises in a "pending" state. With my last changes we instead queue functions that return the desired promises, allowing to chain them correctly and stopping when the first error is encountered. By removing the faster_drop.mp4 |
files_dropped implementation
This comment was marked as resolved.
This comment was marked as resolved.
OS files and folders dropping inside the browser window has been supported for a long time, but the original implementation based on temporary "drop" folders was quite hacky and broken. This commit fixes two main issues: - Dropped folders are now copied in the temporary one respecting the original structure (instead of copying all files to the top level). - The emitted signal now only reports the files/folders that were actually dropped, not all files in the dropped folders (this is a consequence of the above). This brings it more in line with other platforms. The JS code has been refactored for better processing, and the temporary deletion is now delegated to the display server. The "persistentDrops" hack has also been dropped in favor of a localized solution in the project manager.
a323aa2 to
dba1eec
Compare
Rebased 👍 |
|
Thanks! |
OS files and folders dropping inside the browser window has been supported for a long time, but the original implementation based on temporary "drop" folders was quite hacky and broken.
This commit fixes two main issues:
This brings it more in line with other platforms.
The JS code has been refactored for better processing, and the temporary deletion is now delegated to the display server.
The "persistentDrops" hack has also been dropped in favor of a localized solution in the project manager.
This might "break compat" if you relied on the (purposely undocumented) "persistentDrops" config option, or the bug causing all files to be dropped in the root of the temporary folder.
drag_drop_editor.mp4
Note
We have an opportunity in the editor, to do some more filtering on what we copy by monkey-patching the controller (e.g. excluding
.godotand.gitfrom folders, and only import folders containing a project.godot file and its subfolder).I think we should do that after/on top of #123149 (I have a tentative implementation in a separate branch).