-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Filesystem dock folder handling #11428
Filesystem dock folder handling #11428
Conversation
fd93cfc
to
728688e
Compare
Reworked the DependencyRemovedDialog to support deleting folders. Files that were in a folder are listed under a tree item underneath the folder. There are now some icons for the items in the tree too which makes it look a little nicer: This commit also fixes a usability bug encountered during testing: Files which are being deleted may be listed as having broken dependencies if you select the file and one or more dependencies with multi-select before deleting. Finally, because DirAccess only lets you delete empty folders (at least on windows), folder deletion happens in two stages. Files from a list generated when the dialog was opened are removed, then the remaining empty directories are cleaned up. If the user adds a file to a directory while the dialog is open the folder will not be emptied by the first step, so the deleting the directory will fail. I figured this was preferable to doing a second enumeration, as it is possible the new file has become a dependency. |
Was thinking of adding it in myself but I'm glad somebody else is. This better be included in 3.0 as this is probably my biggest problem with 2.1 right now. Took and checked it out and it seems to work great. The only problem I have so far is that when you drag a folder it doesn't show what folder is being dragged. I might try adding it myself but I haven't contributed yet so the Godot code is unfamiliar to me right now. |
editor/filesystem_dock.cpp
Outdated
if (all_can_reimport && types.size() == 1) { //all can reimport and are of the same type | ||
|
||
/* | ||
/* |
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.
Don't keep dead code.
I have decided that since I have reworked a the rename/move logic I think i should take a second look at it to fix the following two issues:
Whilst i'm there i also think i can do a better job at deduplicating code between move and rename. |
Some feedback from PR monday:
|
Sounds like 1b4f7c7 could be squashed into 728688e, and f42764b would go into 1da4149 I guess? See http://docs.godotengine.org/en/latest/community/contributing/pr_workflow.html#mastering-the-pr-workflow-the-rebase for docs on interactive rebase. |
Thanks for the feedback and help so far. I am going to take a look at rebasing and shuffling around a few of these commits down tonight/tomorrow. I hope to have something that will be as follows:
I can squash down further after that more easily if required. |
Before I rebase it would be helpful if I could get some thoughts on the latest commit. I am not sure if it is ok to use the EditorFileSystem the way I am here. The latest commit looks at the EditorFileSystem after the moves/renames are applied but before a call to rescan is made. This is making the assumption that the EditorFileSystem will still have the old file paths & dependencies. Doing this simplifies the code quite a bit as I don't have to keep track of this myself (which is more compicated - especially because I don't know what files will succeed in moving/renaming until actually doing it). The code I have works, but not sure if this is a reasonable requirement to put on the EditorFileSystem. |
yeah, i guess calling to rescan later is fine
…On Sat, Sep 30, 2017 at 10:14 PM, MillionOstrich ***@***.***> wrote:
Before I rebase it would be helpful if I could get some thoughts on the
latest commit. I am not sure if it is ok to use the EditorFileSystem the
way I am here.
The latest commit looks at the EditorFileSystem after the moves/renames
are applied but before a call to rescan is made. This is making the
assumption that the EditorFileSystem will still have the old file paths &
dependencies. Doing this simplifies the code quite a bit as I don't have to
keep track of this myself (which is more compicated - especially because I
don't know what files will succeed in moving/renaming until actually doing
it). The code I have works, but not sure if this is a reasonable
requirement to put on the EditorFileSystem.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11428 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z22jR93m9pGQVn6d7NjBsRzxWu7Ozks5snudigaJpZM4PdM_m>
.
|
337c0f9
to
9f6f0c7
Compare
Rebased into the 4 commits & added a more detailed comment about the use of EditorFileSystem before rescan while I was there. |
9f6f0c7
to
32255e2
Compare
Rebased and updated this PR following merge of #11575. Note that as a result of the rebase and changes to how the removal code works there is a bug introduced in the first commit which is fixed in the third. The changes to the right click in the first commit will let you delete ".." which is checked for in the third commit. The justification for this was that a multiselection including ".." might just want skip this selected entry and try to delete the other stuff, but on reflection I think just not letting you pick some options if ".." is selected is better. Does anybody have a preference either way? |
To be honest is see no reason why '..' should be selected. Maybe that should be made impossible before ? |
Disallow selecting ".." in the file-system dock. Show In Explorer just uses this->path rather than trying to work it out from the item. Add support for copy to path to folders . Removed old commented out code.
Move/rename don't depend on the path variable anymore. Fixed dependencies not updating correctly when dragging folders in the folder tree. Dependencies will only update for files which sucessfully moved. Reduced code duplication between move & rename. Added rename & move options to folders tree.
DependencyRemoveDialog now takes two lists (files and folders) to delete. Sort the folders above files in DependencyRemoveDialog & use some more icons. Stop files which will be deleted from also being listed as having broken dependencies. Add right-click option for removing folder to filesystem folder tree.
2766e71
to
0939c0a
Compare
I have now made it impossible to have ".." selected (you can still right click it and double click it) and rebased this change into the first commit, fixing the issue raised in my previous comment. The point Xgor raised I think I will address in a new PR at a later date - along with a different issue I encountered with drag (dragging folders onto the favourites icon doesn't work - it probably should favourite the folder though). |
Issues #11336 and #9854 raise a point about not being able to do some common tasks from within the file system dock.
Folders now support the following on right click:
Fixes the following issues:
This PR has also had to rework the rename & move code to fix bugs with/better support folders, as a result I have also spent some time tidying up and removing duplicated code in these methods. I also have reworked the DependencyRemoveDialog to properly support removing folders.