summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2017-08-07 23:57:14 +0200
committerGitHub <noreply@github.com>2017-08-07 23:57:14 +0200
commit1f638b206ed567b07409067d57a29de042453884 (patch)
tree69caa5a6fdca9339ffccee9a34976e0d67c30f10
parentc6120e77a8c1c7e946569453973629499673d414 (diff)
parentbc034c1d4dbb6a5c4ceb09bb8708adfa14fe51f2 (diff)
Merge pull request #10152 from Hinsbart/run_import
ProjectManager: Show error dialog if unable to run project.
-rw-r--r--editor/project_manager.cpp27
-rw-r--r--editor/project_manager.h1
2 files changed, 18 insertions, 10 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index d5a56f644f..b77544befa 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -491,17 +491,8 @@ void ProjectManager::_update_project_buttons() {
item->update();
}
- bool has_runnable_scene = false;
- for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) {
- const String &selected_main = E->get();
- if (selected_main == "") continue;
- has_runnable_scene = true;
- break;
- }
-
erase_btn->set_disabled(selected_list.size() < 1);
open_btn->set_disabled(selected_list.size() < 1);
- run_btn->set_disabled(!has_runnable_scene);
}
void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
@@ -969,10 +960,22 @@ void ProjectManager::_run_project_confirm() {
for (Map<String, String>::Element *E = selected_list.front(); E; E = E->next()) {
const String &selected_main = E->get();
- if (selected_main == "") continue;
+ if (selected_main == "") {
+ run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in \"Project Settings\" under the \"Application\" category."));
+ run_error_diag->popup_centered();
+ return;
+ }
+
const String &selected = E->key();
String path = EditorSettings::get_singleton()->get("projects/" + selected);
+
+ if (!DirAccess::exists(path + "/.import")) {
+ run_error_diag->set_text(TTR("Can't run project: Assets need to be imported.\nPlease edit the project to trigger the initial import."));
+ run_error_diag->popup_centered();
+ return;
+ }
+
print_line("OPENING: " + path + " (" + selected + ")");
List<String> args;
@@ -1390,6 +1393,10 @@ ProjectManager::ProjectManager() {
last_clicked = "";
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
+
+ run_error_diag = memnew(AcceptDialog);
+ gui_base->add_child(run_error_diag);
+ run_error_diag->set_title(TTR("Can't run project"));
}
ProjectManager::~ProjectManager() {
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 27886132c5..181d3cc5d9 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -57,6 +57,7 @@ class ProjectManager : public Control {
ConfirmationDialog *multi_open_ask;
ConfirmationDialog *multi_run_ask;
ConfirmationDialog *multi_scan_ask;
+ AcceptDialog *run_error_diag;
NewProjectDialog *npdialog;
ScrollContainer *scroll;
VBoxContainer *scroll_childs;