Merge pull request #29795 from YeldhamDev/dependency_editor_changes

Minor enhancements to the dependency editor
This commit is contained in:
Rémi Verschelde 2019-06-15 10:28:11 +02:00 committed by GitHub
commit 1c1e75a4aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 21 deletions

View file

@ -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<String, String> dep_rename;
@ -63,7 +60,7 @@ void DependencyEditor::_load_pressed(Object *p_item, int p_cell, int p_button) {
for (List<String>::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<String, Map<String, String> > &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<String> &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<String, int> &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);
}

View file

@ -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);