summaryrefslogtreecommitdiff
path: root/editor/filesystem_dock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r--editor/filesystem_dock.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 4fdc3dc080..c700fdccad 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -2085,7 +2085,32 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
}
}
if (!to_move.empty()) {
- _move_operation_confirm(to_dir);
+ if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
+ for (int i = 0; i < to_move.size(); i++) {
+ String new_path;
+ String new_path_base;
+
+ if (to_move[i].is_file) {
+ new_path = to_dir.plus_file(to_move[i].path.get_file());
+ new_path_base = new_path.get_basename() + " (%d)." + new_path.get_extension();
+ } else {
+ PackedStringArray path_split = to_move[i].path.split("/");
+ new_path = to_dir.plus_file(path_split[path_split.size() - 2]);
+ new_path_base = new_path + " (%d)";
+ }
+
+ int exist_counter = 1;
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ while (da->file_exists(new_path) || da->dir_exists(new_path)) {
+ exist_counter++;
+ new_path = vformat(new_path_base, exist_counter);
+ }
+ _try_duplicate_item(to_move[i], new_path);
+ }
+ _rescan();
+ } else {
+ _move_operation_confirm(to_dir);
+ }
}
} else if (favorite) {
// Add the files from favorites.
@@ -2518,13 +2543,15 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
toolbar_hbc->add_theme_constant_override("separation", 0);
top_vbc->add_child(toolbar_hbc);
- button_hist_prev = memnew(ToolButton);
+ button_hist_prev = memnew(Button);
+ button_hist_prev->set_flat(true);
button_hist_prev->set_disabled(true);
button_hist_prev->set_focus_mode(FOCUS_NONE);
button_hist_prev->set_tooltip(TTR("Previous Folder/File"));
toolbar_hbc->add_child(button_hist_prev);
- button_hist_next = memnew(ToolButton);
+ button_hist_next = memnew(Button);
+ button_hist_next->set_flat(true);
button_hist_next->set_disabled(true);
button_hist_next->set_focus_mode(FOCUS_NONE);
button_hist_next->set_tooltip(TTR("Next Folder/File"));
@@ -2602,7 +2629,8 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
file_list_search_box->connect("text_changed", callable_mp(this, &FileSystemDock::_search_changed), varray(file_list_search_box));
path_hb->add_child(file_list_search_box);
- button_file_list_display_mode = memnew(ToolButton);
+ button_file_list_display_mode = memnew(Button);
+ button_file_list_display_mode->set_flat(true);
path_hb->add_child(button_file_list_display_mode);
files = memnew(ItemList);