From b3ae58d1175066b22314d1d9e1bcd067ee57d06c Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Sat, 15 Jun 2019 04:03:28 -0300 Subject: Minor enhancements to the dependency editor --- editor/dependency_editor.cpp | 40 ++++++++++++++++++++-------------------- editor/dependency_editor.h | 1 - 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index cc9e2c12e8..9a049f3ae3 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -35,9 +35,6 @@ #include "editor_node.h" #include "scene/gui/margin_container.h" -void DependencyEditor::_notification(int p_what) { -} - void DependencyEditor::_searched(const String &p_path) { Map dep_rename; @@ -63,7 +60,7 @@ void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) { for (List::Element *E = ext.front(); E; E = E->next()) { search->add_filter("*" + E->get()); } - search->popup_centered_ratio(); + search->popup_centered_ratio(0.65); // So it doesn't completely cover the dialog below it. } void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map > &candidates) { @@ -222,7 +219,7 @@ void DependencyEditor::edit(const String &p_path) { set_title(TTR("Dependencies For:") + " " + p_path.get_file()); _update_list(); - popup_centered_ratio(); + popup_centered_ratio(0.7); // So it doesn't completely cover the dialog below it. if (EditorNode::get_singleton()->is_scene_open(p_path)) { EditorNode::get_singleton()->show_warning(vformat(TTR("Scene '%s' is currently being edited.\nChanges will only take effect when reloaded."), p_path.get_file())); @@ -478,12 +475,13 @@ void DependencyRemoveDialog::show(const Vector &p_folders, const Vector< if (removed_deps.empty()) { owners->hide(); text->set_text(TTR("Remove selected files from the project? (no undo)")); - popup_centered_minsize(Size2(400, 100)); + set_size(Size2()); + popup_centered(); } else { _build_removed_dependency_tree(removed_deps); owners->show(); text->set_text(TTR("The files being removed are required by other resources in order for them to work.\nRemove them anyway? (no undo)")); - popup_centered_minsize(Size2(500, 350)); + popup_centered(Size2(500, 350)); } EditorFileSystem::get_singleton()->scan_changes(); } @@ -579,6 +577,8 @@ void DependencyRemoveDialog::_bind_methods() { DependencyRemoveDialog::DependencyRemoveDialog() { + get_ok()->set_text(TTR("Remove")); + VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); @@ -589,7 +589,6 @@ DependencyRemoveDialog::DependencyRemoveDialog() { owners->set_hide_root(true); vb->add_child(owners); owners->set_v_size_flags(SIZE_EXPAND_FILL); - get_ok()->set_text(TTR("Remove")); } ////////////// @@ -617,7 +616,7 @@ void DependencyErrorDialog::show(Mode p_mode, const String &p_for_file, const Ve ti->set_icon(0, icon); } - popup_centered_minsize(Size2(500, 220)); + popup_centered(); } void DependencyErrorDialog::ok_pressed() { @@ -646,7 +645,8 @@ DependencyErrorDialog::DependencyErrorDialog() { files->set_hide_root(true); vb->add_margin_child(TTR("Load failed due to missing dependencies:"), files, true); files->set_v_size_flags(SIZE_EXPAND_FILL); - files->set_custom_minimum_size(Size2(1, 200)); + + set_custom_minimum_size(Size2(500, 220)); get_ok()->set_text(TTR("Open Anyway")); get_cancel()->set_text(TTR("Close")); @@ -670,7 +670,7 @@ void OrphanResourcesDialog::ok_pressed() { return; delete_confirm->set_text(vformat(TTR("Permanently delete %d item(s)? (No undo!)"), paths.size())); - delete_confirm->popup_centered_minsize(); + delete_confirm->popup_centered_clamped(delete_confirm->get_minimum_size()); } bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMap &refs, TreeItem *p_parent) { @@ -794,6 +794,15 @@ void OrphanResourcesDialog::_bind_methods() { OrphanResourcesDialog::OrphanResourcesDialog() { + set_title(TTR("Orphan Resource Explorer")); + delete_confirm = memnew(ConfirmationDialog); + get_ok()->set_text(TTR("Delete")); + add_child(delete_confirm); + dep_edit = memnew(DependencyEditor); + add_child(dep_edit); + delete_confirm->connect("confirmed", this, "_delete_confirm"); + set_hide_on_ok(false); + VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); @@ -807,14 +816,5 @@ OrphanResourcesDialog::OrphanResourcesDialog() { files->set_column_title(1, TTR("Owns")); files->set_hide_root(true); vbc->add_margin_child(TTR("Resources Without Explicit Ownership:"), files, true); - set_title(TTR("Orphan Resource Explorer")); - delete_confirm = memnew(ConfirmationDialog); - delete_confirm->set_text(TTR("Delete selected files?")); - get_ok()->set_text(TTR("Delete")); - add_child(delete_confirm); - dep_edit = memnew(DependencyEditor); - add_child(dep_edit); files->connect("button_pressed", this, "_button_pressed"); - delete_confirm->connect("confirmed", this, "_delete_confirm"); - set_hide_on_ok(false); } diff --git a/editor/dependency_editor.h b/editor/dependency_editor.h index 23c3cc031c..22e28a4d26 100644 --- a/editor/dependency_editor.h +++ b/editor/dependency_editor.h @@ -63,7 +63,6 @@ class DependencyEditor : public AcceptDialog { protected: static void _bind_methods(); - void _notification(int p_what); public: void edit(const String &p_path); -- cgit v1.2.3