diff options
Diffstat (limited to 'editor/dependency_editor.cpp')
-rw-r--r-- | editor/dependency_editor.cpp | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 5aa4507211..ccc228ceae 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -529,6 +529,20 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed } } +void DependencyRemoveDialog::_show_files_to_delete_list() { + files_to_delete_list->clear(); + + for (const String &s : dirs_to_delete) { + String t = s.trim_prefix("res://"); + files_to_delete_list->add_item(t, Ref<Texture2D>(), false); + } + + for (const String &s : files_to_delete) { + String t = s.trim_prefix("res://"); + files_to_delete_list->add_item(t, Ref<Texture2D>(), false); + } +} + void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector<String> &p_files) { all_remove_files.clear(); dirs_to_delete.clear(); @@ -545,21 +559,24 @@ void DependencyRemoveDialog::show(const Vector<String> &p_folders, const Vector< files_to_delete.push_back(p_files[i]); } + _show_files_to_delete_list(); + Vector<RemovedDependency> removed_deps; _find_all_removed_dependencies(EditorFileSystem::get_singleton()->get_filesystem(), removed_deps); _find_localization_remaps_of_removed_files(removed_deps); removed_deps.sort(); if (removed_deps.is_empty()) { - owners->hide(); + vb_owners->hide(); text->set_text(TTR("Remove the selected files from the project? (Cannot be undone.)\nDepending on your filesystem configuration, the files will either be moved to the system trash or deleted permanently.")); reset_size(); popup_centered(); } else { _build_removed_dependency_tree(removed_deps); - owners->show(); + vb_owners->show(); text->set_text(TTR("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (Cannot be undone.)\nDepending on your filesystem configuration, the files will either be moved to the system trash or deleted permanently.")); popup_centered(Size2(500, 350)); } + EditorFileSystem::get_singleton()->scan_changes(); } @@ -668,15 +685,38 @@ DependencyRemoveDialog::DependencyRemoveDialog() { set_ok_button_text(TTR("Remove")); VBoxContainer *vb = memnew(VBoxContainer); + vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_child(vb); text = memnew(Label); vb->add_child(text); + Label *files_to_delete_label = memnew(Label); + files_to_delete_label->set_theme_type_variation("HeaderSmall"); + files_to_delete_label->set_text(TTR("Files to be deleted:")); + vb->add_child(files_to_delete_label); + + files_to_delete_list = memnew(ItemList); + files_to_delete_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); + files_to_delete_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); + files_to_delete_list->set_custom_minimum_size(Size2(0, 94) * EDSCALE); + vb->add_child(files_to_delete_list); + + vb_owners = memnew(VBoxContainer); + vb_owners->set_h_size_flags(Control::SIZE_EXPAND_FILL); + vb_owners->set_v_size_flags(Control::SIZE_EXPAND_FILL); + vb->add_child(vb_owners); + + Label *owners_label = memnew(Label); + owners_label->set_theme_type_variation("HeaderSmall"); + owners_label->set_text(TTR("Dependencies of files to be deleted:")); + vb_owners->add_child(owners_label); + owners = memnew(Tree); owners->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); owners->set_hide_root(true); - vb->add_child(owners); + owners->set_custom_minimum_size(Size2(0, 94) * EDSCALE); + vb_owners->add_child(owners); owners->set_v_size_flags(Control::SIZE_EXPAND_FILL); } |