Skip to content
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

Fix EditorFileDialog clears the file name on changing directory #81226

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

AThousandShips
Copy link
Member

@AThousandShips AThousandShips commented Sep 1, 2023

Regression from #51478, the change in that PR will clear the file when changing directory (which is undesirable, for example if you want to save the same name in a different directory), can't find any clear justification for the change in the PR, but I might have missed something, but in any case it breaks correct behavior relatively seriously, so what ever the reason for that change it has to be re-implemented with these effects in mind.

Might work correctly by moving the change to the cases below, but think this needs a dedicated investigation into what we actually want to accomplish here:

--- a/editor/gui/editor_file_dialog.cpp
+++ b/editor/gui/editor_file_dialog.cpp
@@ -264,17 +264,17 @@ void EditorFileDialog::update_dir() {
        }
        dir->set_text(dir_access->get_current_dir(false));

-       file->set_text("");
-
        // Disable "Open" button only when selecting file(s) mode.
        get_ok_button()->set_disabled(_is_open_should_be_disabled());
        switch (mode) {
                case FILE_MODE_OPEN_FILE:
                case FILE_MODE_OPEN_FILES:
+                       file->set_text("");
                        set_ok_button_text(TTR("Open"));
                        break;
                case FILE_MODE_OPEN_ANY:
                case FILE_MODE_OPEN_DIR:
+                       file->set_text("");
                        set_ok_button_text(TTR("Select Current Folder"));
                        break;
                case FILE_MODE_SAVE_FILE:

Fixes issues with assigning a name for files being saved
@AThousandShips
Copy link
Member Author

Pushed the alternative solution, which does the clearing when opening files, which makes sense

@starry-abyss
Copy link
Contributor

The project import part (the source of the problematic line) seems to work good.

@YuriSizov YuriSizov requested review from Calinou and KoBeWi September 5, 2023 14:40
@akien-mga akien-mga merged commit 72ceaa8 into godotengine:master Sep 8, 2023
@akien-mga
Copy link
Member

Thanks!

@AThousandShips
Copy link
Member Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The scene's default save name missing
3 participants