mirror of https://github.com/godotengine/godot
Merge pull request #99453 from reach-satori/drag_to_filesystem_folder
Allow dragging to specific folders in filesystem dock
This commit is contained in:
commit
e0cdba40fd
|
|
@ -5844,7 +5844,11 @@ PopupMenu *EditorNode::get_export_as_menu() {
|
|||
}
|
||||
|
||||
void EditorNode::_dropped_files(const Vector<String> &p_files) {
|
||||
String to_path = ProjectSettings::get_singleton()->globalize_path(FileSystemDock::get_singleton()->get_current_directory());
|
||||
String to_path = FileSystemDock::get_singleton()->get_folder_path_at_mouse_position();
|
||||
if (to_path.is_empty()) {
|
||||
to_path = FileSystemDock::get_singleton()->get_current_directory();
|
||||
}
|
||||
to_path = ProjectSettings::get_singleton()->globalize_path(to_path);
|
||||
|
||||
_add_dropped_files_recursive(p_files, to_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -2799,6 +2799,15 @@ void FileSystemDock::remove_resource_tooltip_plugin(const Ref<EditorResourceTool
|
|||
tooltip_plugins.remove_at(index);
|
||||
}
|
||||
|
||||
String FileSystemDock::get_folder_path_at_mouse_position() const {
|
||||
TreeItem *item = tree->get_item_at_position(tree->get_local_mouse_position());
|
||||
if (!item) {
|
||||
return String();
|
||||
}
|
||||
String fpath = item->get_metadata(0);
|
||||
return fpath.get_base_dir();
|
||||
}
|
||||
|
||||
Control *FileSystemDock::create_tooltip_for_path(const String &p_path) const {
|
||||
if (p_path == "Favorites") {
|
||||
// No tooltip for the "Favorites" group.
|
||||
|
|
|
|||
|
|
@ -381,6 +381,7 @@ public:
|
|||
|
||||
String get_current_path() const;
|
||||
String get_current_directory() const;
|
||||
String get_folder_path_at_mouse_position() const;
|
||||
|
||||
void navigate_to_path(const String &p_path);
|
||||
void focus_on_path();
|
||||
|
|
|
|||
Loading…
Reference in New Issue