Skip to content

Commit 092d21a

Browse files
committed
Make fdialog_project up to become sibling of ProjectDialog instead of child
1 parent 383a6e4 commit 092d21a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

editor/project_manager/project_dialog.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ void ProjectDialog::_browse_install_path() {
389389
}
390390

391391
void ProjectDialog::_project_path_selected(const String &p_path) {
392+
show_dialog();
393+
392394
if (create_dir->is_pressed() && (mode == MODE_NEW || mode == MODE_INSTALL)) {
393395
// Replace parent directory, but keep target dir name.
394396
project_path->set_text(p_path.path_join(project_path->get_text().get_file()));
@@ -686,8 +688,6 @@ void ProjectDialog::set_project_path(const String &p_path) {
686688
}
687689

688690
void ProjectDialog::ask_for_path_and_show() {
689-
// Workaround: for the file selection dialog content to be rendered we need to show its parent dialog.
690-
show_dialog();
691691
_browse_project_path();
692692
}
693693

@@ -787,6 +787,14 @@ void ProjectDialog::_notification(int p_what) {
787787
project_browse->set_icon(get_editor_theme_icon(SNAME("FolderBrowse")));
788788
install_browse->set_icon(get_editor_theme_icon(SNAME("FolderBrowse")));
789789
} break;
790+
case NOTIFICATION_READY: {
791+
fdialog_project = memnew(EditorFileDialog);
792+
fdialog_project->set_previews_enabled(false); // Crucial, otherwise the engine crashes.
793+
fdialog_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
794+
fdialog_project->connect("dir_selected", callable_mp(this, &ProjectDialog::_project_path_selected));
795+
fdialog_project->connect("file_selected", callable_mp(this, &ProjectDialog::_project_path_selected));
796+
callable_mp((Node *)this, &Node::add_sibling).call_deferred(fdialog_project, false);
797+
} break;
790798
}
791799
}
792800

@@ -967,21 +975,14 @@ ProjectDialog::ProjectDialog() {
967975
Control *spacer = memnew(Control);
968976
spacer->set_h_size_flags(Control::SIZE_EXPAND_FILL);
969977
default_files_container->add_child(spacer);
970-
971-
fdialog_project = memnew(EditorFileDialog);
972-
fdialog_project->set_previews_enabled(false); //Crucial, otherwise the engine crashes.
973-
fdialog_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
974978
fdialog_install = memnew(EditorFileDialog);
975979
fdialog_install->set_previews_enabled(false); //Crucial, otherwise the engine crashes.
976980
fdialog_install->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
977-
add_child(fdialog_project);
978981
add_child(fdialog_install);
979982

980983
project_name->connect(SceneStringName(text_changed), callable_mp(this, &ProjectDialog::_project_name_changed).unbind(1));
981984
project_path->connect(SceneStringName(text_changed), callable_mp(this, &ProjectDialog::_project_path_changed).unbind(1));
982985
install_path->connect(SceneStringName(text_changed), callable_mp(this, &ProjectDialog::_install_path_changed).unbind(1));
983-
fdialog_project->connect("dir_selected", callable_mp(this, &ProjectDialog::_project_path_selected));
984-
fdialog_project->connect("file_selected", callable_mp(this, &ProjectDialog::_project_path_selected));
985986
fdialog_install->connect("dir_selected", callable_mp(this, &ProjectDialog::_install_path_selected));
986987
fdialog_install->connect("file_selected", callable_mp(this, &ProjectDialog::_install_path_selected));
987988

0 commit comments

Comments
 (0)