godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Create 'Hidden/private folders' from FileSystem and search results via naming conventions #9321

Open RouBroeck opened 3 months ago

RouBroeck commented 3 months ago

Describe the project you are working on

Different plugins to make my life easier and general game development

Describe the problem or limitation you are having in your project

For my projects I like to create small plugins to adapt the editor to my needs. As a result, there are many files in my project that are only relevant for plugins, such as PackedScenes that are used as editor dock. However, as far as I know, there is no way to indicate private files. This leads to the problem that for example the QuickOpenDialog is littered with PackedScenes and Scripts that shouldn't be used or opened directly.

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

My suggestion is to introduce a filter, inspired on the coding convention of private variables, in which resources and folders starting with a _ are hidden/ignored by the FileSystemDialogues.

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

When the user names a file or folder with an _ the file or foldercontents are hidden from Quick-selection and searching. For Example files named or located at res://addons/my_addon/_my_dock.tscn res://addons/my_addon/_internal/ res://game/entities/player/_player.gd would be hidden/ignored by any file selection and search dialog.

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

It would be difficult to find a workaround with a script, since this suggestion represents an intervention in the file system filtering

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

This is about improving the project structure and how files and folders are handled by the search function

KoBeWi commented 3 months ago

You can hide files and folders by using . at the beginning, but it makes them completely invisible for the engine. Personally, I use _ to make something appear first in the list (or currently last, due to bug), so having it hidden would be inconvenient.

RouBroeck commented 3 months ago

Using . would not solve the problem, since a plugin can not access these files. The usecase of a _ to make a file more important, is a valid reason against my solution. What if I change my proposal so that a private file does not have to start with _ but rather content of directories named internal or editor (similar to UnityEngine) should be hidden form the addon-users file search?

RouBroeck commented 3 months ago

I found another issue that is closely related to my proposal. #7392 has the same core problem; only the solution is viewed from the perspective of the plugin users and not from the perspective of the plugin developers, as here. There is no way to hide internal files from the user.