From 9a8ba93963024c514fe4b3ba9850457e7ba28ae2 Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 7 Aug 2024 13:22:55 +0200 Subject: [PATCH] Initialize project name when importing project --- editor/project_manager/project_dialog.cpp | 8 ++++++-- editor/project_manager/project_dialog.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/project_manager/project_dialog.cpp b/editor/project_manager/project_dialog.cpp index 1ea038ede32..b4aa00ee0a8 100644 --- a/editor/project_manager/project_dialog.cpp +++ b/editor/project_manager/project_dialog.cpp @@ -429,6 +429,10 @@ void ProjectDialog::_install_path_selected(const String &p_path) { get_ok_button()->grab_focus(); } +void ProjectDialog::_reset_name() { + project_name->set_text(TTR("New Game Project")); +} + void ProjectDialog::_renderer_selected() { ERR_FAIL_NULL(renderer_button_group->get_pressed_button()); @@ -694,6 +698,7 @@ void ProjectDialog::set_project_path(const String &p_path) { } void ProjectDialog::ask_for_path_and_show() { + _reset_name(); _browse_project_path(); } @@ -718,8 +723,7 @@ void ProjectDialog::show_dialog(bool p_reset_name) { callable_mp(project_name, &LineEdit::select_all).call_deferred(); } else { if (p_reset_name) { - String proj = TTR("New Game Project"); - project_name->set_text(proj); + _reset_name(); } project_path->set_editable(true); diff --git a/editor/project_manager/project_dialog.h b/editor/project_manager/project_dialog.h index 0efe1991ab8..b985492f847 100644 --- a/editor/project_manager/project_dialog.h +++ b/editor/project_manager/project_dialog.h @@ -122,6 +122,7 @@ private: void _project_path_selected(const String &p_path); void _install_path_selected(const String &p_path); + void _reset_name(); void _renderer_selected(); void _nonempty_confirmation_ok_pressed();