summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-07-29 17:58:24 +0200
committerGitHub <noreply@github.com>2016-07-29 17:58:24 +0200
commite300df517de211afc4d31ca51e74ab6202b86b12 (patch)
tree6922dbb057bd87b378565abc0bb032bf58b4133e
parent7ea5bea00d6900d368906f37cff02fb0a72c1917 (diff)
parent9720e73e0480e454b580afc9499240bb08a823f3 (diff)
Merge pull request #5963 from Hinsbart/pm_drop
Project Manager: Import projects using filesystem drag'n'drop.
-rw-r--r--tools/editor/project_manager.cpp17
-rw-r--r--tools/editor/project_manager.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index 9ca69935da..28d9738fee 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -364,6 +364,12 @@ public:
mode=p_mode;
}
+ void import_from_file(const String& p_file) {
+ mode=MODE_IMPORT;
+ _file_selected(p_file);
+ ok_pressed();
+ }
+
void show_dialog() {
@@ -1097,6 +1103,14 @@ void ProjectManager::_install_project(const String& p_zip_path,const String& p_t
npdialog->show_dialog();
}
+void ProjectManager::_files_dropped(StringArray p_files, int p_screen) {
+ for (int i = 0; i < p_files.size(); i++) {
+ if (p_files[i].ends_with("engine.cfg")) {
+ npdialog->import_from_file(p_files[i]);
+ }
+ }
+}
+
void ProjectManager::_bind_methods() {
ObjectTypeDB::bind_method("_open_project",&ProjectManager::_open_project);
@@ -1116,6 +1130,7 @@ void ProjectManager::_bind_methods() {
ObjectTypeDB::bind_method("_unhandled_input",&ProjectManager::_unhandled_input);
ObjectTypeDB::bind_method("_favorite_pressed",&ProjectManager::_favorite_pressed);
ObjectTypeDB::bind_method("_install_project",&ProjectManager::_install_project);
+ ObjectTypeDB::bind_method("_files_dropped",&ProjectManager::_files_dropped);
}
@@ -1330,6 +1345,8 @@ ProjectManager::ProjectManager() {
//get_ok()->set_text("Exit");
last_clicked = "";
+
+ SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
}
diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h
index fac1fc7745..50bd7d94c8 100644
--- a/tools/editor/project_manager.h
+++ b/tools/editor/project_manager.h
@@ -95,6 +95,7 @@ class ProjectManager : public Control {
void _panel_input(const InputEvent& p_ev,Node *p_hb);
void _unhandled_input(const InputEvent& p_ev);
void _favorite_pressed(Node *p_hb);
+ void _files_dropped(StringArray p_files, int p_screen);
protected: