Project Manager: Import projects using filesystem drag'n'drop.
Can drop an engine.cfg file over the window to import it ;)
This commit is contained in:
parent
7ea5bea00d
commit
9720e73e04
|
@ -364,6 +364,12 @@ public:
|
||||||
mode=p_mode;
|
mode=p_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void import_from_file(const String& p_file) {
|
||||||
|
mode=MODE_IMPORT;
|
||||||
|
_file_selected(p_file);
|
||||||
|
ok_pressed();
|
||||||
|
}
|
||||||
|
|
||||||
void show_dialog() {
|
void show_dialog() {
|
||||||
|
|
||||||
|
|
||||||
|
@ -1097,6 +1103,14 @@ void ProjectManager::_install_project(const String& p_zip_path,const String& p_t
|
||||||
npdialog->show_dialog();
|
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() {
|
void ProjectManager::_bind_methods() {
|
||||||
|
|
||||||
ObjectTypeDB::bind_method("_open_project",&ProjectManager::_open_project);
|
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("_unhandled_input",&ProjectManager::_unhandled_input);
|
||||||
ObjectTypeDB::bind_method("_favorite_pressed",&ProjectManager::_favorite_pressed);
|
ObjectTypeDB::bind_method("_favorite_pressed",&ProjectManager::_favorite_pressed);
|
||||||
ObjectTypeDB::bind_method("_install_project",&ProjectManager::_install_project);
|
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");
|
//get_ok()->set_text("Exit");
|
||||||
|
|
||||||
last_clicked = "";
|
last_clicked = "";
|
||||||
|
|
||||||
|
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ class ProjectManager : public Control {
|
||||||
void _panel_input(const InputEvent& p_ev,Node *p_hb);
|
void _panel_input(const InputEvent& p_ev,Node *p_hb);
|
||||||
void _unhandled_input(const InputEvent& p_ev);
|
void _unhandled_input(const InputEvent& p_ev);
|
||||||
void _favorite_pressed(Node *p_hb);
|
void _favorite_pressed(Node *p_hb);
|
||||||
|
void _files_dropped(StringArray p_files, int p_screen);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue