godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.23k stars 21.22k forks source link

File Dialog modal closes on hidden file toggle keyboard shortcut after item selected and deselected #30372

Open creikey opened 5 years ago

creikey commented 5 years ago

This issue also causes the editor to stay darkened once the modal is closed as per issue #30368 Godot version:

d897131ac555de84afe9ca6845abf87c26957895

OS/device including version:

Arch Linux

Issue description:

File Dialog modal closes on hidden file toggle keyboard shortcut after item selected and deselected. Expected behavior is a toggle that shows hidden files.

Steps to reproduce:

  1. Cause the file dialog to open, e.g press load on an empty texture property in a sprite
  2. Click on a file in the manager
  3. Click on the empty space in the directory, deselecting the file
  4. Press the CTRL + H shortcut to toggle visibility of hidden files The file dialog disappears and the editor stays darkened.

Minimal reproduction project:

godot-darkened-after-dialog-shortcut.zip

ghost commented 5 years ago

On my d897131 build (also running on Arch Linux) pressing Ctrl+H caused the editor to stop responding/rendering entirely. Toggling hidden files from the toolbar worked fine. Not sure what's happening with the shortcut.

creikey commented 5 years ago

@toasteater that's a separate issue: #30366 that I've already made a PR to fix

KoBeWi commented 4 years ago

The editor is no longer darkened, but the disappearance of dialog is still there in 8016521.

KoBeWi commented 4 years ago

I investigated and discovered that this is what causes it: https://github.com/godotengine/godot/blob/0d07a935e90eea0f652448784ea9cf6542593912/editor/editor_file_dialog.cpp#L140-L145 Particularly this line: EditorSettings::get_singleton()->set("filesystem/file_dialog/show_hidden_files", show);. Commenting it makes the dialog not disappear.

EDIT: Also, clicking the button doesn't toggle the settings.

KoBeWi commented 4 years ago

Ok so after even further investigation, this is the cause: https://github.com/godotengine/godot/blob/ed333248f59da26fc0a3a1b30baf461ed332f0d9/editor/editor_inspector.cpp#L2395-L2403

When editor settings change (in this case, the show hidden files setting), the inspector is rebuilt, which destroys all current controls (including the opened file dialog). No idea how to fix this :I