-
-
Notifications
You must be signed in to change notification settings - Fork 22.1k
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
Modified FileSystemDock so folders can be selected for reimport. #41242
Conversation
30ba631
to
7e862fe
Compare
7e862fe
to
ec33280
Compare
This will be very useful! Selecting files one by one is very tedious. My only comment is: why should be it limited to only re-importing files of same type? That does not seem necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Thanks! And congrats for your first merged contribution 🎉 |
@asheraryam A UI fix might require something more sophisticated. Also how is it currently done in code? I wanted to solve my original problem which was to import files all of the same import type in a folder which I think is like a 99% solution. I think most people would put all textures in a folder, sounds in another, etc. And if you organize by "game object" e.g. animals directory contains lion, tiger, bear I think you can filter by extension then select the parent animal folder and this will still work. Also this was very quick to implement. Updated: I just tested sorting by extension and it doesn't quite work because I forgot the import type could be different even with the same extension. For example a png could be a Bitmap or a Texture. You can probably get around this issue with a naming convention for your files like texture_bear.png bitmap_bear.png. Update2: Testing the naming convention idea and the code needs an update to properly filter the selected files. |
@akien-mga Is this worthy of cherry picking for 3.2? :) |
@geekrelief The idea is that the import settings are already in the .import files, we don't need to re-show the options for all the different file types, just a re-import option. I can see that this is also limiting, so perhaps we can have both: show the import options when files have the same type and only show the re-import button if they are of mixed types. Either way, I think this a good change and is already a great improvement. |
@asheraryam Maybe it's because I'm new to Godot, but I don't understand what you're suggesting. As before and now, you can't reimport a selection of mixed import types. Can you give a use case? Or explain with greater detail? I don't understand what you mean by "only show the re-import button if they are of mixed types". |
In conjunction with PR godotengine#41242, you can have directories of mixed import types, filter by part of a file name and select a directory to reimport all the matching files. Checking for the import type in the FileSystem was removed, since it's already handled with a dialog informing the user when reimporting mixed types. Maintainence of the file selection between changes in the search filter and clicking in the tree has been improved. An asset's "import" is reloaded multiple times in the ImportDock code. ImportDock caches the config files to speed up selection when the dock is visible (frees the cache when hidden). When selecting files or folders containing hundreds or thousands of assets, the editor stalls while the config files are parsed. This is obviously perceivable on an SSD drive. I've changed it so if the ImportDock only parses config files when visible. A thread is used for parsing the multiple import files to prevent the main thread from blocking, and the Label is updated to show the number of files being parsed as a progress indicator. ImportDock processing can safely be interrupted with: - a new selection in the FileSystem - losing visibility by switching to the Scene tab - or closing the editor. There's a strange crash that can occur if a direct reference from a String in a Vector<String> is passed to `ImportDock::set_edit_path`. The accessing `p_path` in the function can lead to random crashing when attempting to read its size. The workaround is to create a new variable that references the String before passing into the function. Also, added a modification to RemoveDependencyDialog to emit all the files that were deleted. FileSystemDock connects to this and passes it to ImportDock to clear the config_cache. This also includes a fix to tree.cpp where deselect_all fails to properly deselect all tree items. This is required for proper deselection in the FileSystemDock.
Now, you can select folders from the file system dock, and as long as the directory contains importable files all of the same type, the Import dock will allow them to be reimported.