diff options
author | kobewi <kobewi4e@gmail.com> | 2024-08-02 14:02:19 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2024-08-05 14:27:37 +0200 |
commit | 30da21f073a0fde1c6ea700cc367f3e33d4e35cc (patch) | |
tree | e7f2f118b01e502405d7c1643b0af8101b77bb00 /editor | |
parent | 3978628c6cc1227250fc6ed45c8d854d24c30c30 (diff) | |
download | redot-engine-30da21f073a0fde1c6ea700cc367f3e33d4e35cc.tar.gz |
Fix project name cleared when browsing path
Diffstat (limited to 'editor')
-rw-r--r-- | editor/project_manager/project_dialog.cpp | 13 | ||||
-rw-r--r-- | editor/project_manager/project_dialog.h | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/editor/project_manager/project_dialog.cpp b/editor/project_manager/project_dialog.cpp index 52d86a1a95..ee2253b294 100644 --- a/editor/project_manager/project_dialog.cpp +++ b/editor/project_manager/project_dialog.cpp @@ -370,6 +370,8 @@ void ProjectDialog::_browse_project_path() { } else { fdialog_project->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR); } + + hide(); fdialog_project->popup_file_dialog(); } @@ -389,7 +391,7 @@ void ProjectDialog::_browse_install_path() { } void ProjectDialog::_project_path_selected(const String &p_path) { - show_dialog(); + show_dialog(false); if (create_dir->is_pressed() && (mode == MODE_NEW || mode == MODE_INSTALL)) { // Replace parent directory, but keep target dir name. @@ -691,7 +693,7 @@ void ProjectDialog::ask_for_path_and_show() { _browse_project_path(); } -void ProjectDialog::show_dialog() { +void ProjectDialog::show_dialog(bool p_reset_name) { if (mode == MODE_RENAME) { // Name and path are set in `ProjectManager::_rename_project`. project_path->set_editable(false); @@ -711,8 +713,10 @@ void ProjectDialog::show_dialog() { callable_mp((Control *)project_name, &Control::grab_focus).call_deferred(); callable_mp(project_name, &LineEdit::select_all).call_deferred(); } else { - String proj = TTR("New Game Project"); - project_name->set_text(proj); + if (p_reset_name) { + String proj = TTR("New Game Project"); + project_name->set_text(proj); + } project_path->set_editable(true); String fav_dir = EDITOR_GET("filesystem/directories/default_project_path"); @@ -793,6 +797,7 @@ void ProjectDialog::_notification(int p_what) { fdialog_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM); fdialog_project->connect("dir_selected", callable_mp(this, &ProjectDialog::_project_path_selected)); fdialog_project->connect("file_selected", callable_mp(this, &ProjectDialog::_project_path_selected)); + fdialog_project->connect("canceled", callable_mp(this, &ProjectDialog::show_dialog).bind(false), CONNECT_DEFERRED); callable_mp((Node *)this, &Node::add_sibling).call_deferred(fdialog_project, false); } break; } diff --git a/editor/project_manager/project_dialog.h b/editor/project_manager/project_dialog.h index 8517189e5a..0efe1991ab 100644 --- a/editor/project_manager/project_dialog.h +++ b/editor/project_manager/project_dialog.h @@ -139,7 +139,7 @@ public: void set_zip_title(const String &p_title); void ask_for_path_and_show(); - void show_dialog(); + void show_dialog(bool p_reset_name = true); ProjectDialog(); }; |