diff options
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r-- | editor/filesystem_dock.cpp | 234 |
1 files changed, 167 insertions, 67 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index aa19bdf342..ce98f699ae 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 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 */ @@ -76,6 +76,9 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory subdirectory_item->set_metadata(0, lpath); if (!p_select_in_favorites && (path == lpath || ((display_mode == DISPLAY_MODE_SPLIT) && path.get_base_dir() == lpath))) { subdirectory_item->select(0); + // Keep select an item when re-created a tree + // To prevent crashing when nothing is selected. + subdirectory_item->set_as_cursor(0); } if (p_unfold_path && path.begins_with(lpath) && path != lpath) { @@ -177,12 +180,12 @@ Vector<String> FileSystemDock::_compute_uncollapsed_paths() { Vector<String> uncollapsed_paths; TreeItem *root = tree->get_root(); if (root) { - TreeItem *favorites_item = root->get_children(); + TreeItem *favorites_item = root->get_first_child(); if (!favorites_item->is_collapsed()) { uncollapsed_paths.push_back(favorites_item->get_metadata(0)); } - TreeItem *resTree = root->get_children()->get_next(); + TreeItem *resTree = root->get_first_child()->get_next(); if (resTree) { Vector<TreeItem *> needs_check; needs_check.push_back(resTree); @@ -190,7 +193,7 @@ Vector<String> FileSystemDock::_compute_uncollapsed_paths() { while (needs_check.size()) { if (!needs_check[0]->is_collapsed()) { uncollapsed_paths.push_back(needs_check[0]->get_metadata(0)); - TreeItem *child = needs_check[0]->get_children(); + TreeItem *child = needs_check[0]->get_first_child(); while (child) { needs_check.push_back(child); child = child->get_next(); @@ -461,7 +464,7 @@ void FileSystemDock::_tree_multi_selected(Object *p_item, int p_column, bool p_s return; } - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); if (selected->get_parent() == favorites_item && !String(selected->get_metadata(0)).ends_with("/")) { // Go to the favorites if we click in the favorites and the path has changed. path = "Favorites"; @@ -531,7 +534,7 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa } String file_name = p_path.get_file(); - if (!file_name.empty()) { + if (!file_name.is_empty()) { for (int i = 0; i < files->get_item_count(); i++) { if (files->get_item_text(i) == file_name) { files->select(i, true); @@ -677,17 +680,17 @@ void FileSystemDock::_sort_file_info_list(List<FileSystemDock::FileInfo> &r_file break; case FILE_SORT_TYPE_REVERSE: r_file_list.sort_custom<FileInfoTypeComparator>(); - r_file_list.invert(); + r_file_list.reverse(); break; case FILE_SORT_MODIFIED_TIME: r_file_list.sort_custom<FileInfoModifiedTimeComparator>(); break; case FILE_SORT_MODIFIED_TIME_REVERSE: r_file_list.sort_custom<FileInfoModifiedTimeComparator>(); - r_file_list.invert(); + r_file_list.reverse(); break; case FILE_SORT_NAME_REVERSE: - r_file_list.invert(); + r_file_list.reverse(); break; default: // FILE_SORT_NAME break; @@ -857,7 +860,6 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { file_list.push_back(fi); } } - file_list.sort(); } // Sort the file list if needed. @@ -941,8 +943,41 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit fpath = fpath.substr(0, fpath.length() - 1); } } else if (fpath != "Favorites") { + if (FileAccess::exists(fpath + ".import")) { + Ref<ConfigFile> config; + config.instance(); + Error err = config->load(fpath + ".import"); + if (err == OK) { + if (config->has_section_key("remap", "importer")) { + String importer = config->get_value("remap", "importer"); + if (importer == "keep") { + EditorNode::get_singleton()->show_warning(TTR("Importing has been disabled for this file, so it can't be opened for editing.")); + return; + } + } + } + } + if (ResourceLoader::get_resource_type(fpath) == "PackedScene") { - editor->open_request(fpath); + bool is_imported = false; + + { + List<String> importer_exts; + ResourceImporterScene::get_singleton()->get_recognized_extensions(&importer_exts); + String extension = fpath.get_extension(); + for (List<String>::Element *E = importer_exts.front(); E; E = E->next()) { + if (extension.nocasecmp_to(E->get()) == 0) { + is_imported = true; + break; + } + } + } + + if (is_imported) { + ResourceImporterScene::get_singleton()->show_advanced_options(fpath); + } else { + editor->open_request(fpath); + } } else { editor->load_resource(fpath); } @@ -1407,10 +1442,32 @@ void FileSystemDock::_make_scene_confirm() { void FileSystemDock::_file_removed(String p_file) { emit_signal("file_removed", p_file); + + // Find the closest parent directory available, in case multiple items were deleted along the same path. + path = p_file.get_base_dir(); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + while (!da->dir_exists(path)) { + path = path.get_base_dir(); + } + + current_path->set_text(path); } void FileSystemDock::_folder_removed(String p_folder) { emit_signal("folder_removed", p_folder); + + // Find the closest parent directory available, in case multiple items were deleted along the same path. + path = p_folder.get_base_dir(); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + while (!da->dir_exists(path)) { + path = path.get_base_dir(); + } + + current_path->set_text(path); + EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(path); + if (efd) { + efd->force_update(); + } } void FileSystemDock::_rename_operation_confirm() { @@ -1465,6 +1522,9 @@ void FileSystemDock::_rename_operation_confirm() { print_verbose("FileSystem: saving moved scenes."); _save_scenes_after_move(file_renames); + + path = new_path; + current_path->set_text(path); } void FileSystemDock::_duplicate_operation_confirm() { @@ -1505,7 +1565,8 @@ void FileSystemDock::_move_with_overwrite() { _move_operation_confirm(to_move_path, true); } -bool FileSystemDock::_check_existing() { +Vector<String> FileSystemDock::_check_existing() { + Vector<String> conflicting_items; String &p_to_path = to_move_path; for (int i = 0; i < to_move.size(); i++) { String ol_pth = to_move[i].path.ends_with("/") ? to_move[i].path.substr(0, to_move[i].path.length() - 1) : to_move[i].path; @@ -1515,21 +1576,24 @@ bool FileSystemDock::_check_existing() { String old_path = (p_item.is_file || p_item.path.ends_with("/")) ? p_item.path : (p_item.path + "/"); String new_path = (p_item.is_file || p_new_path.ends_with("/")) ? p_new_path : (p_new_path + "/"); - if (p_item.is_file && FileAccess::exists(new_path)) { - return false; - } else if (!p_item.is_file && DirAccess::exists(new_path)) { - return false; + if ((p_item.is_file && FileAccess::exists(new_path)) || + (!p_item.is_file && DirAccess::exists(new_path))) { + conflicting_items.push_back(old_path); } } - return true; + return conflicting_items; } void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_overwrite) { if (!p_overwrite) { to_move_path = p_to_path; - bool can_move = _check_existing(); - if (!can_move) { + Vector<String> conflicting_items = _check_existing(); + if (!conflicting_items.is_empty()) { // Ask to do something. + overwrite_dialog->set_text(vformat( + TTR("The following files or folders conflict with items in the target location '%s':\n\n%s\n\nDo you wish to overwrite them?"), + to_move_path, + String("\n").join(conflicting_items))); overwrite_dialog->popup_centered(); return; } @@ -1569,6 +1633,9 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove print_verbose("FileSystem: saving moved scenes."); _save_scenes_after_move(file_renames); + + path = p_to_path; + current_path->set_text(path); } } @@ -1576,7 +1643,7 @@ Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion) { // Build a list of selected items with the active one at the first position. Vector<String> selected_strings; - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); TreeItem *active_selected = tree->get_selected(); if (active_selected && active_selected != favorites_item) { selected_strings.push_back(active_selected->get_metadata(0)); @@ -1632,7 +1699,7 @@ void FileSystemDock::_tree_rmb_option(int p_option) { while (needs_check.size()) { needs_check[0]->set_collapsed(is_collapsed); - TreeItem *child = needs_check[0]->get_children(); + TreeItem *child = needs_check[0]->get_first_child(); while (child) { needs_check.push_back(child); child = child->get_next(); @@ -1717,7 +1784,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected paths.push_back(fpath); } } - if (!paths.empty()) { + if (!paths.is_empty()) { emit_signal("instance", paths); } } break; @@ -1749,7 +1816,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected case FILE_DEPENDENCIES: { // Checkout the file dependencies. - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { String fpath = p_selected[0]; deps_editor->edit(fpath); } @@ -1757,7 +1824,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected case FILE_OWNERS: { // Checkout the file owners. - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { String fpath = p_selected[0]; owners_editor->show(fpath); } @@ -1780,7 +1847,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected case FILE_RENAME: { // Rename the active file. - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { to_rename.path = p_selected[0]; if (to_rename.path != "res://") { to_rename.is_file = !to_rename.path.ends_with("/"); @@ -1881,7 +1948,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected } break; case FILE_COPY_PATH: { - if (!p_selected.empty()) { + if (!p_selected.is_empty()) { String fpath = p_selected[0]; DisplayServer::get_singleton()->clipboard_set(fpath); } @@ -1894,7 +1961,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected } void FileSystemDock::_resource_created() { - Object *c = new_resource_dialog->instance_selected(); + Variant c = new_resource_dialog->instance_selected(); ERR_FAIL_COND(!c); Resource *r = Object::cast_to<Resource>(c); @@ -1908,17 +1975,28 @@ void FileSystemDock::_resource_created() { memdelete(node); } - REF res(r); - editor->push_item(c); - - RES current_res = RES(r); + editor->push_item(r); String fpath = path; if (!fpath.ends_with("/")) { fpath = fpath.get_base_dir(); } - editor->save_resource_as(current_res, fpath); + editor->save_resource_as(RES(r), fpath); +} + +void FileSystemDock::_focus_current_search_box() { + LineEdit *current_search_box = nullptr; + if (display_mode == DISPLAY_MODE_TREE_ONLY) { + current_search_box = tree_search_box; + } else if (display_mode == DISPLAY_MODE_SPLIT) { + current_search_box = file_list_search_box; + } + + if (current_search_box) { + current_search_box->grab_focus(); + current_search_box->select_all(); + } } void FileSystemDock::_search_changed(const String &p_text, const Control *p_from) { @@ -1983,13 +2061,13 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) // Check if the first selected is in favorite. TreeItem *selected = tree->get_next_selected(tree->get_root()); while (selected) { - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); if (selected == favorites_item) { // The "Favorites" item is not draggable. return Variant(); } - bool is_favorite = selected->get_parent() != nullptr && tree->get_root()->get_children() == selected->get_parent(); + bool is_favorite = selected->get_parent() != nullptr && tree->get_root()->get_first_child() == selected->get_parent(); all_favorites &= is_favorite; all_not_favorites &= !is_favorite; selected = tree->get_next_selected(selected); @@ -2009,7 +2087,7 @@ Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) all_not_favorites = true; } - if (paths.empty()) { + if (paths.is_empty()) { return Variant(); } @@ -2035,7 +2113,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da } int drop_section = tree->get_drop_section_at_position(p_point); - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); TreeItem *resources_item = favorites_item->get_next(); @@ -2057,7 +2135,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da String to_dir; bool favorite; _get_drag_target_folder(to_dir, favorite, p_point, p_from); - return !to_dir.empty(); + return !to_dir.is_empty(); } if (drag_data.has("type") && (String(drag_data["type"]) == "files" || String(drag_data["type"]) == "files_and_dirs")) { @@ -2070,7 +2148,7 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da return true; } - if (to_dir.empty()) { + if (to_dir.is_empty()) { return false; } @@ -2111,7 +2189,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, int drop_position; Vector<String> files = drag_data["files"]; - TreeItem *favorites_item = tree->get_root()->get_children(); + TreeItem *favorites_item = tree->get_root()->get_first_child(); TreeItem *resources_item = favorites_item->get_next(); if (ti == favorites_item) { @@ -2165,7 +2243,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, String to_dir; bool favorite; _get_drag_target_folder(to_dir, favorite, p_point, p_from); - if (res.is_valid() && !to_dir.empty()) { + if (res.is_valid() && !to_dir.is_empty()) { EditorNode::get_singleton()->push_item(res.ptr()); EditorNode::get_singleton()->save_resource_as(res, to_dir); } @@ -2176,7 +2254,7 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, String to_dir; bool favorite; _get_drag_target_folder(to_dir, favorite, p_point, p_from); - if (!to_dir.empty()) { + if (!to_dir.is_empty()) { Vector<String> fnames = drag_data["files"]; to_move.clear(); for (int i = 0; i < fnames.size(); i++) { @@ -2184,8 +2262,8 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/"))); } } - if (!to_move.empty()) { - if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { + if (!to_move.is_empty()) { + if (Input::get_singleton()->is_key_pressed(KEY_CTRL)) { for (int i = 0; i < to_move.size(); i++) { String new_path; String new_path_base; @@ -2249,10 +2327,10 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori int section = tree->get_drop_section_at_position(p_point); if (ti) { // Check the favorites first. - if (ti == tree->get_root()->get_children() && section >= 0) { + if (ti == tree->get_root()->get_first_child() && section >= 0) { target_favorites = true; return; - } else if (ti->get_parent() == tree->get_root()->get_children()) { + } else if (ti->get_parent() == tree->get_root()->get_first_child()) { target_favorites = true; return; } else { @@ -2268,7 +2346,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori return; } } else { - if (ti->get_parent() != tree->get_root()->get_children()) { + if (ti->get_parent() != tree->get_root()->get_first_child()) { // Not in the favorite section. if (fpath != "res://") { // We drop between two files @@ -2287,7 +2365,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths, bool p_display_path_dependent_options) { // Add options for files and folders. - ERR_FAIL_COND_MSG(p_paths.empty(), "Path cannot be empty."); + ERR_FAIL_COND_MSG(p_paths.is_empty(), "Path cannot be empty."); Vector<String> filenames; Vector<String> foldernames; @@ -2410,7 +2488,7 @@ void FileSystemDock::_tree_rmb_select(const Vector2 &p_pos) { } // Popup. - if (!paths.empty()) { + if (!paths.is_empty()) { tree_popup->set_size(Size2(1, 1)); _file_and_folders_fill_popup(tree_popup, paths); tree_popup->set_position(tree->get_screen_position() + p_pos); @@ -2443,14 +2521,14 @@ void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) { continue; } if (files->get_item_text(p_item) == "..") { - files->unselect(i); + files->deselect(i); continue; } paths.push_back(files->get_item_metadata(i)); } // Popup. - if (!paths.empty()) { + if (!paths.is_empty()) { file_list_popup->clear(); file_list_popup->set_size(Size2(1, 1)); _file_and_folders_fill_popup(file_list_popup, paths, searched_string.length() == 0); @@ -2511,6 +2589,8 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) { _tree_rmb_option(FILE_REMOVE); } else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) { _tree_rmb_option(FILE_RENAME); + } else if (ED_IS_SHORTCUT("editor/open_search", p_event)) { + _focus_current_search_box(); } else { return; } @@ -2530,6 +2610,8 @@ void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) { _file_list_rmb_option(FILE_REMOVE); } else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) { _file_list_rmb_option(FILE_RENAME); + } else if (ED_IS_SHORTCUT("editor/open_search", p_event)) { + _focus_current_search_box(); } else { return; } @@ -2560,8 +2642,9 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &f } void FileSystemDock::_update_import_dock() { - if (!import_dock_needs_update) + if (!import_dock_needs_update) { return; + } // List selected. Vector<String> selected; @@ -2572,8 +2655,9 @@ void FileSystemDock::_update_import_dock() { } else { // Use the file list. for (int i = 0; i < files->get_item_count(); i++) { - if (!files->is_selected(i)) + if (!files->is_selected(i)) { continue; + } selected.push_back(files->get_item_metadata(i)); } @@ -2598,7 +2682,10 @@ void FileSystemDock::_update_import_dock() { break; } - String type = cf->get_value("remap", "type"); + String type; + if (cf->has_section_key("remap", "type")) { + type = cf->get_value("remap", "type"); + } if (import_type == "") { import_type = type; } else if (import_type != type) { @@ -2647,12 +2734,12 @@ MenuButton *FileSystemDock::_create_file_menu_button() { PopupMenu *p = button->get_popup(); p->connect("id_pressed", callable_mp(this, &FileSystemDock::_file_sort_popup)); - p->add_radio_check_item("Sort by Name (Ascending)", FILE_SORT_NAME); - p->add_radio_check_item("Sort by Name (Descending)", FILE_SORT_NAME_REVERSE); - p->add_radio_check_item("Sort by Type (Ascending)", FILE_SORT_TYPE); - p->add_radio_check_item("Sort by Type (Descending)", FILE_SORT_TYPE_REVERSE); - p->add_radio_check_item("Sort by Last Modified", FILE_SORT_MODIFIED_TIME); - p->add_radio_check_item("Sort by First Modified", FILE_SORT_MODIFIED_TIME_REVERSE); + p->add_radio_check_item(TTR("Sort by Name (Ascending)"), FILE_SORT_NAME); + p->add_radio_check_item(TTR("Sort by Name (Descending)"), FILE_SORT_NAME_REVERSE); + p->add_radio_check_item(TTR("Sort by Type (Ascending)"), FILE_SORT_TYPE); + p->add_radio_check_item(TTR("Sort by Type (Descending)"), FILE_SORT_TYPE_REVERSE); + p->add_radio_check_item(TTR("Sort by Last Modified"), FILE_SORT_MODIFIED_TIME); + p->add_radio_check_item(TTR("Sort by First Modified"), FILE_SORT_MODIFIED_TIME_REVERSE); p->set_item_checked(file_sort, true); return button; } @@ -2690,7 +2777,22 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { // `KEY_MASK_CMD | KEY_C` conflicts with other editor shortcuts. ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C); ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D); + +#if defined(WINDOWS_ENABLED) + // TRANSLATORS: This string is only used on Windows, as it refers to the system trash + // as "Recycle Bin" instead of "Trash". Make sure to use the translation of "Recycle Bin" + // recommended by Microsoft for the target language. + ED_SHORTCUT("filesystem_dock/delete", TTR("Move to Recycle Bin"), KEY_DELETE); +#elif defined(OSX_ENABLED) + // TRANSLATORS: This string is only used on macOS, as it refers to the system trash + // as "Bin" instead of "Trash". Make sure to use the translation of "Bin" + // recommended by Apple for the target language. + ED_SHORTCUT("filesystem_dock/delete", TTR("Move to Bin"), KEY_DELETE); +#else + // TRANSLATORS: This string is only used on platforms other than Windows and macOS. ED_SHORTCUT("filesystem_dock/delete", TTR("Move to Trash"), KEY_DELETE); +#endif + ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), KEY_F2); VBoxContainer *top_vbc = memnew(VBoxContainer); @@ -2721,7 +2823,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { toolbar_hbc->add_child(current_path); button_reload = memnew(Button); - button_reload->set_flat(true); button_reload->connect("pressed", callable_mp(this, &FileSystemDock::_rescan)); button_reload->set_focus_mode(FOCUS_NONE); button_reload->set_tooltip(TTR("Re-Scan Filesystem")); @@ -2729,11 +2830,11 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { toolbar_hbc->add_child(button_reload); 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", callable_mp(this, &FileSystemDock::_toggle_split_mode)); button_toggle_display_mode->set_focus_mode(FOCUS_NONE); button_toggle_display_mode->set_tooltip(TTR("Toggle Split Mode")); + button_toggle_display_mode->set_flat(true); toolbar_hbc->add_child(button_toggle_display_mode); toolbar2_hbc = memnew(HBoxContainer); @@ -2833,7 +2934,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { add_child(remove_dialog); move_dialog = memnew(EditorDirDialog); - move_dialog->get_ok()->set_text(TTR("Move")); + move_dialog->get_ok_button()->set_text(TTR("Move")); add_child(move_dialog); move_dialog->connect("dir_selected", callable_mp(this, &FileSystemDock::_move_operation_confirm), make_binds(false)); @@ -2843,14 +2944,13 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { rename_dialog_text = memnew(LineEdit); rename_dialog_vb->add_margin_child(TTR("Name:"), rename_dialog_text); - rename_dialog->get_ok()->set_text(TTR("Rename")); + rename_dialog->get_ok_button()->set_text(TTR("Rename")); add_child(rename_dialog); rename_dialog->register_text_enter(rename_dialog_text); rename_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_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")); + overwrite_dialog->get_ok_button()->set_text(TTR("Overwrite")); add_child(overwrite_dialog); overwrite_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_move_with_overwrite)); @@ -2860,7 +2960,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) { duplicate_dialog_text = memnew(LineEdit); duplicate_dialog_vb->add_margin_child(TTR("Name:"), duplicate_dialog_text); - duplicate_dialog->get_ok()->set_text(TTR("Duplicate")); + duplicate_dialog->get_ok_button()->set_text(TTR("Duplicate")); add_child(duplicate_dialog); duplicate_dialog->register_text_enter(duplicate_dialog_text); duplicate_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_duplicate_operation_confirm)); |