diff options
author | Poommetee Ketson <poommetee@protonmail.com> | 2017-11-19 16:22:40 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-19 16:22:40 +0700 |
commit | baaafc5829959e065d2243092baa0369ad4a7841 (patch) | |
tree | 01db9bec67eaad64be851e81291ef048f1c0d547 | |
parent | 40574c1fc0ca37f1407cc75d56f48cebd468d482 (diff) | |
parent | 34951904972add68b82fdbef84d62726923a0972 (diff) |
Merge pull request #12999 from Hinsbart/dnd_import
Editor: Drop files to copy them to project.
-rw-r--r-- | editor/editor_node.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 777aedefd2..27f967cce7 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4276,12 +4276,19 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String> &p_paths, Control * void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) { - /* - String cur_path = filesystem_dock->get_current_path(); - for(int i=0;i<EditorImportExport::get_singleton()->get_import_plugin_count();i++) { - EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path); + String to_path = ProjectSettings::get_singleton()->globalize_path(get_filesystem_dock()->get_current_path()); + DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + + for (int i = 0; i < p_files.size(); i++) { + + String from = p_files[i]; + if (!ResourceFormatImporter::get_singleton()->can_be_imported(from)) { + continue; + } + String to = to_path.plus_file(from.get_file()); + dir->copy(from, to); } - */ + EditorFileSystem::get_singleton()->scan_changes(); } void EditorNode::_file_access_close_error_notify(const String &p_str) { |