godotengine / godot-proposals

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

Improve FileDialog display #4566

Open tx350z opened 2 years ago

tx350z commented 2 years ago

Describe the project you are working on

Distributed MMO game.

Describe the problem or limitation you are having in your project

FileDialog behaviors limit flexibility and could create end-user confusion.

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

  1. When mode is set to "Open Folder" the file system tree should not show files in any form. Currently it shows files as "disabled".
  2. Setting Access to "User Data" should show only the OS path and not include "user://" as most end-users won't understand what "user://" means. E.g., on Windows the default Path string is "user:.//C:/Users/username/AppData/Roaming/app_data/Project".
  3. Setting Access to "Resources" should show only the OS Path and not include "res://" for the same reason given in (2) above.
  4. The editor overwrites the Current Dir and Current Path values set through the inspector. These values should not be overwritten unless they are "incompatible" with the Access setting. Better yet, just flag them as incompatible.

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

No suggestion.

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

Item 1: No workaround Items 2, 3, 4: Workaround requires trapping the about_to_show event to overwrite LineEdit.text, current_dir, and current_path.

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

Item 1 is core code only.

Calinou commented 2 years ago
  1. When mode is set to "Open Folder" the file system tree should not show files in any form. Currently it shows files as "disabled".

Do native OS file managers do this? I remember the macOS Finder still showing files as disabled in this situation. I feel it's a helpful "breadcrumb" for the purpose of navigation.

  1. Setting Access to "User Data" should show only the OS path and not include "user://" as most end-users won't understand what "user://" means. E.g., on Windows the default Path string is "user:.//C:/Users/username/AppData/Roaming/app_data/Project".

Sounds good to me – I'd probably use ProjectSettings::globalize_path() internally to achieve this. Same for 3.

tx350z commented 2 years ago

Unsure what the OS file managers do. I'll have to test. I have Windows and Ubuntu (16.04 & 20.04) systems available. Displaying files might be OK if the default theme for "disabled" files is something other than black text on dark-gray background. Maybe add an option to control display of files when in Open Folder mode?

Calinou commented 2 years ago

I checked the GTK3 file dialog and it's indeed displaying files as grayed out in the "open folder" mode:

image

You can test this in Visual Studio Code using the File: Open Folder action in the command palette.

tx350z commented 2 years ago

This is what I see on Windows 11. FileDialog

Calinou commented 2 years ago

@tx350z The black text looks like a bug – either the color fails to be returned, or it's not defined in the default project theme (while it is in the editor theme).

The disabled text color should probably be set to a translucent variant of the main text color (with 50% opacity or so).

tx350z commented 2 years ago

It looks like the black text is defined in the default theme. FileDialogTheme

I've set the Theme Override for Files Disabled to #40c0c0c0 and it looks good enough for my needs. Thanks FileDialogThemeBetter

KoBeWi commented 2 years ago

2 and 3 is partially implemented by https://github.com/godotengine/godot/pull/59089 (the root part is hidden when you use subfolder)

YuriSizov commented 2 years ago

It looks like the black text is defined in the default theme.

Black is the default value for the color type. In that screenshots, overrides are disabled, so values are presented as default. That doesn't mean that the color in this case actually defaults to black, disabled overrides do not show the actual fallback value.

rainlizard commented 2 years ago

I'll toss this in here: the Refresh files button of the FileDialog should probably be automatically triggered whenever you alt-tab back into your game. (NOTIFICATION_WM_FOCUS_IN)

If you open a file dialog there's a good chance at the same time you may want to alt-tab and edit the files on your PC. I've found that to be the case with the program I'm working on. But even outside of games, with Godot's Export Project button: I press it, see that it's exporting over old files so I quickly browse on my PC to delete all the old files so that it's a clean export, then I alt-tab back in to Godot and the file dialog is still displaying the old files that I already deleted. I think it should refresh it.