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.cpp181
1 files changed, 107 insertions, 74 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index fb591b51df..5363d6a1e2 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -36,13 +36,17 @@
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "core/project_settings.h"
+#include "editor_feature_profile.h"
#include "editor_node.h"
+#include "editor_resource_preview.h"
+#include "editor_scale.h"
#include "editor_settings.h"
+#include "import_dock.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
-Ref<Texture> FileSystemDock::_get_tree_item_icon(EditorFileSystemDirectory *p_dir, int p_idx) {
- Ref<Texture> file_icon;
+Ref<Texture2D> FileSystemDock::_get_tree_item_icon(EditorFileSystemDirectory *p_dir, int p_idx) {
+ Ref<Texture2D> file_icon;
if (!p_dir->get_file_import_is_valid(p_idx)) {
file_icon = get_icon("ImportFail", "EditorIcons");
} else {
@@ -52,7 +56,7 @@ Ref<Texture> FileSystemDock::_get_tree_item_icon(EditorFileSystemDirectory *p_di
return file_icon;
}
-bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths, bool p_select_in_favorites) {
+bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths, bool p_select_in_favorites, bool p_unfold_path) {
bool parent_should_expand = false;
// Create a tree item for the subdirectory.
@@ -71,17 +75,22 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
subdirectory_item->select(0);
}
- subdirectory_item->set_collapsed(uncollapsed_paths.find(lpath) < 0);
+ if (p_unfold_path && path.begins_with(lpath) && path != lpath) {
+ subdirectory_item->set_collapsed(false);
+ } else {
+ subdirectory_item->set_collapsed(uncollapsed_paths.find(lpath) < 0);
+ }
if (searched_string.length() > 0 && dname.to_lower().find(searched_string) >= 0) {
parent_should_expand = true;
}
// Create items for all subdirectories.
for (int i = 0; i < p_dir->get_subdir_count(); i++)
- parent_should_expand = (_create_tree(subdirectory_item, p_dir->get_subdir(i), uncollapsed_paths, p_select_in_favorites) || parent_should_expand);
+ parent_should_expand = (_create_tree(subdirectory_item, p_dir->get_subdir(i), uncollapsed_paths, p_select_in_favorites, p_unfold_path) || parent_should_expand);
// Create all items for the files in the subdirectory.
if (display_mode == DISPLAY_MODE_TREE_ONLY) {
+ String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene");
for (int i = 0; i < p_dir->get_file_count(); i++) {
String file_type = p_dir->get_file_type(i);
@@ -111,7 +120,6 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
file_item->select(0);
file_item->set_as_cursor(0);
}
- String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene");
if (main_scene == file_metadata) {
file_item->set_custom_color(0, get_color("accent_color", "Editor"));
}
@@ -120,6 +128,11 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
udata.push_back(file_item);
EditorResourcePreview::get_singleton()->queue_resource_preview(file_metadata, this, "_tree_thumbnail_done", udata);
}
+ } else if (display_mode == DISPLAY_MODE_SPLIT) {
+ if (lpath.get_base_dir() == path.get_base_dir()) {
+ subdirectory_item->select(0);
+ subdirectory_item->set_as_cursor(0);
+ }
}
if (searched_string.length() > 0) {
@@ -127,6 +140,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
subdirectory_item->set_collapsed(false);
} else if (dname != "res://") {
subdirectory_item->get_parent()->remove_child(subdirectory_item);
+ memdelete(subdirectory_item);
}
}
@@ -164,7 +178,7 @@ Vector<String> FileSystemDock::_compute_uncollapsed_paths() {
return uncollapsed_paths;
}
-void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, bool p_uncollapse_root, bool p_select_in_favorites) {
+void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, bool p_uncollapse_root, bool p_select_in_favorites, bool p_unfold_path) {
// Recreate the tree.
tree->clear();
tree_update_id++;
@@ -184,11 +198,11 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
if (!fave.begins_with("res://"))
continue;
- Ref<Texture> folder_icon = get_icon("Folder", "EditorIcons");
+ Ref<Texture2D> folder_icon = get_icon("Folder", "EditorIcons");
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
String text;
- Ref<Texture> icon;
+ Ref<Texture2D> icon;
Color color;
if (fave == "res://") {
text = "/";
@@ -237,7 +251,7 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
}
// Create the remaining of the tree.
- _create_tree(root, EditorFileSystem::get_singleton()->get_filesystem(), uncollapsed_paths, p_select_in_favorites);
+ _create_tree(root, EditorFileSystem::get_singleton()->get_filesystem(), uncollapsed_paths, p_select_in_favorites, p_unfold_path);
tree->ensure_cursor_is_visible();
updating_tree = false;
}
@@ -286,19 +300,19 @@ void FileSystemDock::_notification(int p_what) {
if (initialized)
return;
initialized = true;
- EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed");
+ EditorFeatureProfileManager::get_singleton()->connect_compat("current_feature_profile_changed", this, "_feature_profile_changed");
- EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed");
- EditorResourcePreview::get_singleton()->connect("preview_invalidated", this, "_preview_invalidated");
+ EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_fs_changed");
+ EditorResourcePreview::get_singleton()->connect_compat("preview_invalidated", this, "_preview_invalidated");
String ei = "EditorIcons";
button_reload->set_icon(get_icon("Reload", ei));
button_toggle_display_mode->set_icon(get_icon("Panels2", ei));
- button_file_list_display_mode->connect("pressed", this, "_toggle_file_display");
+ button_file_list_display_mode->connect_compat("pressed", this, "_toggle_file_display");
- files->connect("item_activated", this, "_file_list_activate_file");
- button_hist_next->connect("pressed", this, "_fw_history");
- button_hist_prev->connect("pressed", this, "_bw_history");
+ files->connect_compat("item_activated", this, "_file_list_activate_file");
+ button_hist_next->connect_compat("pressed", this, "_fw_history");
+ button_hist_prev->connect_compat("pressed", this, "_bw_history");
tree_search_box->set_right_icon(get_icon("Search", ei));
tree_search_box->set_clear_button_enabled(true);
file_list_search_box->set_right_icon(get_icon("Search", ei));
@@ -306,10 +320,10 @@ void FileSystemDock::_notification(int p_what) {
button_hist_next->set_icon(get_icon("Forward", ei));
button_hist_prev->set_icon(get_icon("Back", ei));
- file_list_popup->connect("id_pressed", this, "_file_list_rmb_option");
- tree_popup->connect("id_pressed", this, "_tree_rmb_option");
+ file_list_popup->connect_compat("id_pressed", this, "_file_list_rmb_option");
+ tree_popup->connect_compat("id_pressed", this, "_tree_rmb_option");
- current_path->connect("text_entered", this, "_navigate_to_path");
+ current_path->connect_compat("text_entered", this, "_navigate_to_path");
always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders"));
@@ -459,7 +473,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
_set_current_path_text(path);
_push_to_history();
- _update_tree(_compute_uncollapsed_paths(), false, p_select_in_favorites);
+ _update_tree(_compute_uncollapsed_paths(), false, p_select_in_favorites, true);
if (display_mode == DISPLAY_MODE_SPLIT) {
_update_file_list(false);
files->get_v_scroll()->set_value(0);
@@ -482,7 +496,7 @@ void FileSystemDock::navigate_to_path(const String &p_path) {
_navigate_to_path(p_path);
}
-void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata) {
+void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata) {
if ((file_list_vb->is_visible_in_tree() || path == p_path.get_base_dir()) && p_preview.is_valid()) {
Array uarr = p_udata;
int idx = uarr[0];
@@ -498,7 +512,7 @@ void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<T
}
}
-void FileSystemDock::_tree_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata) {
+void FileSystemDock::_tree_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata) {
if (p_small_preview.is_valid()) {
Array uarr = p_udata;
if (tree_update_id == (int)uarr[0]) {
@@ -599,9 +613,9 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
String ei = "EditorIcons";
int thumbnail_size = EditorSettings::get_singleton()->get("docks/filesystem/thumbnail_size");
thumbnail_size *= EDSCALE;
- Ref<Texture> folder_thumbnail;
- Ref<Texture> file_thumbnail;
- Ref<Texture> file_thumbnail_broken;
+ Ref<Texture2D> folder_thumbnail;
+ Ref<Texture2D> file_thumbnail;
+ Ref<Texture2D> file_thumbnail_broken;
bool use_thumbnails = (file_list_display_mode == FILE_LIST_DISPLAY_THUMBNAILS);
@@ -631,7 +645,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
files->set_fixed_icon_size(Size2());
}
- Ref<Texture> folder_icon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
+ Ref<Texture2D> folder_icon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
const Color folder_color = get_color("folder_icon_modulate", "FileDialog");
// Build the FileInfo list.
@@ -642,7 +656,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
for (int i = 0; i < favorites.size(); i++) {
String favorite = favorites[i];
String text;
- Ref<Texture> icon;
+ Ref<Texture2D> icon;
if (favorite == "res://") {
text = "/";
icon = folder_icon;
@@ -737,6 +751,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
}
// Fills the ItemList control node from the FileInfos.
+ String main_scene = ProjectSettings::get_singleton()->get("application/run/main_scene");
String oi = "Object";
for (List<FileInfo>::Element *E = filelist.front(); E; E = E->next()) {
FileInfo *finfo = &(E->get());
@@ -744,8 +759,8 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
String fpath = finfo->path;
String ftype = finfo->type;
- Ref<Texture> type_icon;
- Ref<Texture> big_icon;
+ Ref<Texture2D> type_icon;
+ Ref<Texture2D> big_icon;
String tooltip = fpath;
@@ -773,6 +788,10 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
files->set_item_metadata(item_index, fpath);
}
+ if (fpath == main_scene) {
+ files->set_item_custom_fg_color(item_index, get_color("accent_color", "Editor"));
+ }
+
// Generate the preview.
if (!finfo->import_broken) {
Array udata;
@@ -1394,17 +1413,13 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
if (!can_move) {
// Ask to do something.
overwrite_dialog->popup_centered_minsize();
- overwrite_dialog->grab_focus();
return;
}
}
// Check groups.
for (int i = 0; i < to_move.size(); i++) {
-
- print_line("is group: " + to_move[i].path + ": " + itos(EditorFileSystem::get_singleton()->is_group_file(to_move[i].path)));
if (to_move[i].is_file && EditorFileSystem::get_singleton()->is_group_file(to_move[i].path)) {
- print_line("move to: " + p_to_path.plus_file(to_move[i].path.get_file()));
EditorFileSystem::get_singleton()->move_group_file(to_move[i].path, p_to_path.plus_file(to_move[i].path.get_file()));
}
}
@@ -1423,7 +1438,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
if (is_moved) {
int current_tab = editor->get_current_tab();
- _save_scenes_after_move(file_renames); //save scenes before updating
+ _save_scenes_after_move(file_renames); // Save scenes before updating.
_update_dependencies_after_move(file_renames);
_update_resource_paths_after_move(file_renames);
_update_project_settings_after_move(file_renames);
@@ -1571,6 +1586,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
ProjectSettings::get_singleton()->set("application/run/main_scene", p_selected[0]);
ProjectSettings::get_singleton()->save();
_update_tree(_compute_uncollapsed_paths());
+ _update_file_list(true);
}
} break;
@@ -1742,8 +1758,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
if (!fpath.ends_with("/")) {
fpath = fpath.get_base_dir();
}
- make_script_dialog_text->config("Node", fpath.plus_file("new_script.gd"), false);
- make_script_dialog_text->popup_centered(Size2(300, 300) * EDSCALE);
+ make_script_dialog->config("Node", fpath.plus_file("new_script.gd"), false, false);
+ make_script_dialog->popup_centered();
} break;
case FILE_COPY_PATH: {
@@ -1759,13 +1775,21 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
}
-void FileSystemDock::_resource_created() const {
+void FileSystemDock::_resource_created() {
Object *c = new_resource_dialog->instance_selected();
ERR_FAIL_COND(!c);
Resource *r = Object::cast_to<Resource>(c);
ERR_FAIL_COND(!r);
+ PackedScene *scene = Object::cast_to<PackedScene>(r);
+ if (scene) {
+ Node *node = memnew(Node);
+ node->set_name("Node");
+ scene->pack(node);
+ memdelete(node);
+ }
+
REF res(r);
editor->push_item(c);
@@ -1780,7 +1804,7 @@ void FileSystemDock::_resource_created() const {
}
void FileSystemDock::_search_changed(const String &p_text, const Control *p_from) {
- if (searched_string.length() == 0 && p_text.length() > 0) {
+ if (searched_string.length() == 0) {
// Register the uncollapsed paths before they change.
uncollapsed_paths_before_search = _compute_uncollapsed_paths();
}
@@ -1792,13 +1816,14 @@ void FileSystemDock::_search_changed(const String &p_text, const Control *p_from
else // File_list_search_box.
tree_search_box->set_text(searched_string);
+ bool unfold_path = (p_text == String() && path != String());
switch (display_mode) {
case DISPLAY_MODE_TREE_ONLY: {
- _update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>());
+ _update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path);
} break;
case DISPLAY_MODE_SPLIT: {
_update_file_list(false);
- _update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>());
+ _update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>(), false, false, unfold_path);
} break;
}
}
@@ -1927,7 +1952,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
return false;
// Attempting to move a folder into itself will fail later,
- // rather than bring up a message don't try to do it in the first place
+ // rather than bring up a message don't try to do it in the first place.
to_dir = to_dir.ends_with("/") ? to_dir : (to_dir + "/");
Vector<String> fnames = drag_data["files"];
for (int i = 0; i < fnames.size(); ++i) {
@@ -2029,11 +2054,15 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
Vector<String> fnames = drag_data["files"];
to_move.clear();
for (int i = 0; i < fnames.size(); i++) {
- to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/")));
+ if (fnames[i].get_base_dir() != to_dir) {
+ to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/")));
+ }
+ }
+ if (!to_move.empty()) {
+ _move_operation_confirm(to_dir);
}
- _move_operation_confirm(to_dir);
} else if (favorite) {
- // Add the files from favorites
+ // Add the files from favorites.
Vector<String> fnames = drag_data["files"];
Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < fnames.size(); i++) {
@@ -2082,6 +2111,10 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori
// We drop on a folder.
target = fpath;
return;
+ } else {
+ // We drop on the folder that the target file is in.
+ target = fpath.get_base_dir();
+ return;
}
} else {
if (ti->get_parent() != tree->get_root()->get_children()) {
@@ -2473,7 +2506,7 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &FileSystemDock::_feature_profile_changed);
ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file")));
- ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
+ ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::PACKED_STRING_ARRAY, "files")));
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
@@ -2519,7 +2552,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
button_reload = memnew(Button);
button_reload->set_flat(true);
- button_reload->connect("pressed", this, "_rescan");
+ button_reload->connect_compat("pressed", this, "_rescan");
button_reload->set_focus_mode(FOCUS_NONE);
button_reload->set_tooltip(TTR("Re-Scan Filesystem"));
button_reload->hide();
@@ -2528,7 +2561,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
button_toggle_display_mode = memnew(Button);
button_toggle_display_mode->set_flat(true);
button_toggle_display_mode->set_toggle_mode(true);
- button_toggle_display_mode->connect("toggled", this, "_toggle_split_mode");
+ button_toggle_display_mode->connect_compat("toggled", this, "_toggle_split_mode");
button_toggle_display_mode->set_focus_mode(FOCUS_NONE);
button_toggle_display_mode->set_tooltip(TTR("Toggle Split Mode"));
toolbar_hbc->add_child(button_toggle_display_mode);
@@ -2540,7 +2573,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
tree_search_box = memnew(LineEdit);
tree_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
tree_search_box->set_placeholder(TTR("Search files"));
- tree_search_box->connect("text_changed", this, "_search_changed", varray(tree_search_box));
+ tree_search_box->connect_compat("text_changed", this, "_search_changed", varray(tree_search_box));
toolbar2_hbc->add_child(tree_search_box);
file_list_popup = memnew(PopupMenu);
@@ -2564,12 +2597,12 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
tree->set_custom_minimum_size(Size2(0, 15 * EDSCALE));
split_box->add_child(tree);
- tree->connect("item_activated", this, "_tree_activate_file");
- tree->connect("multi_selected", this, "_tree_multi_selected");
- tree->connect("item_rmb_selected", this, "_tree_rmb_select");
- tree->connect("empty_rmb", this, "_tree_rmb_empty");
- tree->connect("nothing_selected", this, "_tree_empty_selected");
- tree->connect("gui_input", this, "_tree_gui_input");
+ tree->connect_compat("item_activated", this, "_tree_activate_file");
+ tree->connect_compat("multi_selected", this, "_tree_multi_selected");
+ tree->connect_compat("item_rmb_selected", this, "_tree_rmb_select");
+ tree->connect_compat("empty_rmb", this, "_tree_rmb_empty");
+ tree->connect_compat("nothing_selected", this, "_tree_empty_selected");
+ tree->connect_compat("gui_input", this, "_tree_gui_input");
file_list_vb = memnew(VBoxContainer);
file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -2581,7 +2614,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
file_list_search_box = memnew(LineEdit);
file_list_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
file_list_search_box->set_placeholder(TTR("Search files"));
- file_list_search_box->connect("text_changed", this, "_search_changed", varray(file_list_search_box));
+ file_list_search_box->connect_compat("text_changed", this, "_search_changed", varray(file_list_search_box));
path_hb->add_child(file_list_search_box);
button_file_list_display_mode = memnew(ToolButton);
@@ -2591,10 +2624,10 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
files->set_v_size_flags(SIZE_EXPAND_FILL);
files->set_select_mode(ItemList::SELECT_MULTI);
files->set_drag_forwarding(this);
- files->connect("item_rmb_selected", this, "_file_list_rmb_select");
- files->connect("gui_input", this, "_file_list_gui_input");
- files->connect("multi_selected", this, "_file_multi_selected");
- files->connect("rmb_clicked", this, "_file_list_rmb_pressed");
+ files->connect_compat("item_rmb_selected", this, "_file_list_rmb_select");
+ files->connect_compat("gui_input", this, "_file_list_gui_input");
+ files->connect_compat("multi_selected", this, "_file_multi_selected");
+ files->connect_compat("rmb_clicked", this, "_file_list_rmb_pressed");
files->set_custom_minimum_size(Size2(0, 15 * EDSCALE));
files->set_allow_rmb_select(true);
file_list_vb->add_child(files);
@@ -2618,14 +2651,14 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
add_child(owners_editor);
remove_dialog = memnew(DependencyRemoveDialog);
- remove_dialog->connect("file_removed", this, "_file_deleted");
- remove_dialog->connect("folder_removed", this, "_folder_deleted");
+ remove_dialog->connect_compat("file_removed", this, "_file_deleted");
+ remove_dialog->connect_compat("folder_removed", this, "_folder_deleted");
add_child(remove_dialog);
move_dialog = memnew(EditorDirDialog);
move_dialog->get_ok()->set_text(TTR("Move"));
add_child(move_dialog);
- move_dialog->connect("dir_selected", this, "_move_operation_confirm");
+ move_dialog->connect_compat("dir_selected", this, "_move_operation_confirm");
rename_dialog = memnew(ConfirmationDialog);
VBoxContainer *rename_dialog_vb = memnew(VBoxContainer);
@@ -2636,13 +2669,13 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
rename_dialog->get_ok()->set_text(TTR("Rename"));
add_child(rename_dialog);
rename_dialog->register_text_enter(rename_dialog_text);
- rename_dialog->connect("confirmed", this, "_rename_operation_confirm");
+ rename_dialog->connect_compat("confirmed", this, "_rename_operation_confirm");
overwrite_dialog = memnew(ConfirmationDialog);
overwrite_dialog->set_text(TTR("There is already file or folder with the same name in this location."));
overwrite_dialog->get_ok()->set_text(TTR("Overwrite"));
add_child(overwrite_dialog);
- overwrite_dialog->connect("confirmed", this, "_move_with_overwrite");
+ overwrite_dialog->connect_compat("confirmed", this, "_move_with_overwrite");
duplicate_dialog = memnew(ConfirmationDialog);
VBoxContainer *duplicate_dialog_vb = memnew(VBoxContainer);
@@ -2653,7 +2686,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
duplicate_dialog->get_ok()->set_text(TTR("Duplicate"));
add_child(duplicate_dialog);
duplicate_dialog->register_text_enter(duplicate_dialog_text);
- duplicate_dialog->connect("confirmed", this, "_duplicate_operation_confirm");
+ duplicate_dialog->connect_compat("confirmed", this, "_duplicate_operation_confirm");
make_dir_dialog = memnew(ConfirmationDialog);
make_dir_dialog->set_title(TTR("Create Folder"));
@@ -2664,7 +2697,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
make_folder_dialog_vb->add_margin_child(TTR("Name:"), make_dir_dialog_text);
add_child(make_dir_dialog);
make_dir_dialog->register_text_enter(make_dir_dialog_text);
- make_dir_dialog->connect("confirmed", this, "_make_dir_confirm");
+ make_dir_dialog->connect_compat("confirmed", this, "_make_dir_confirm");
make_scene_dialog = memnew(ConfirmationDialog);
make_scene_dialog->set_title(TTR("Create Scene"));
@@ -2675,16 +2708,16 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
make_scene_dialog_vb->add_margin_child(TTR("Name:"), make_scene_dialog_text);
add_child(make_scene_dialog);
make_scene_dialog->register_text_enter(make_scene_dialog_text);
- make_scene_dialog->connect("confirmed", this, "_make_scene_confirm");
+ make_scene_dialog->connect_compat("confirmed", this, "_make_scene_confirm");
- make_script_dialog_text = memnew(ScriptCreateDialog);
- make_script_dialog_text->set_title(TTR("Create Script"));
- add_child(make_script_dialog_text);
+ make_script_dialog = memnew(ScriptCreateDialog);
+ make_script_dialog->set_title(TTR("Create Script"));
+ add_child(make_script_dialog);
new_resource_dialog = memnew(CreateDialog);
add_child(new_resource_dialog);
new_resource_dialog->set_base_type("Resource");
- new_resource_dialog->connect("create", this, "_resource_created");
+ new_resource_dialog->connect_compat("create", this, "_resource_created");
searched_string = String();
uncollapsed_paths_before_search = Vector<String>();