Merge pull request #24159 from YeldhamDev/dialog_size_metadata

Move "Dialog Bounds" from the Editor Settings to project's metadata
This commit is contained in:
Rémi Verschelde 2018-12-05 16:19:18 +01:00 committed by GitHub
commit 21dea10116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 16 deletions

View File

@ -89,8 +89,9 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {
_save_and_update_favorite_list();
// Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/create_new_node_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/create_new_node_bounds"));
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2());
if (saved_size != Rect2()) {
popup(saved_size);
} else {
Size2 popup_size = Size2(900, 700) * editor_get_scale();
@ -415,7 +416,7 @@ void CreateDialog::_notification(int p_what) {
}
} break;
case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/create_new_node_bounds", get_rect());
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", get_rect());
} break;
}
}

View File

@ -132,7 +132,7 @@ void EditorHelpSearch::_notification(int p_what) {
results_tree->clear();
get_ok()->set_disabled(true);
EditorSettings::get_singleton()->set("interface/dialogs/search_help_bounds", get_rect());
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", get_rect());
} break;
case NOTIFICATION_PROCESS: {
@ -177,8 +177,9 @@ void EditorHelpSearch::popup_dialog() {
void EditorHelpSearch::popup_dialog(const String &p_term) {
// Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/search_help_bounds"))
popup(EditorSettings::get_singleton()->get("interface/dialogs/search_help_bounds"));
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "search_help", Rect2());
if (saved_size != Rect2())
popup(saved_size);
else
popup_centered_ratio(0.5F);

View File

@ -56,7 +56,7 @@ void ProjectExportDialog::_notification(int p_what) {
custom_feature_display->get_parent_control()->add_style_override("panel", get_stylebox("bg", "Tree"));
} break;
case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect());
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "export", get_rect());
} break;
case NOTIFICATION_THEME_CHANGED: {
duplicate_preset->set_icon(get_icon("Duplicate", "EditorIcons"));
@ -84,8 +84,9 @@ void ProjectExportDialog::popup_export() {
}
// Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/export_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds"));
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "export", Rect2());
if (saved_size != Rect2()) {
popup(saved_size);
} else {
Size2 popup_size = Size2(900, 700) * editor_get_scale();

View File

@ -115,10 +115,9 @@ void ProjectSettingsEditor::_notification(int p_what) {
} break;
case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", get_rect());
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
search_button->set_icon(get_icon("Search", "EditorIcons"));
search_box->set_right_icon(get_icon("Search", "EditorIcons"));
search_box->set_clear_button_enabled(true);
@ -788,8 +787,9 @@ void ProjectSettingsEditor::_update_actions() {
void ProjectSettingsEditor::popup_project_settings() {
// Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/project_settings_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/project_settings_bounds"));
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "project_settings", Rect2());
if (saved_size != Rect2()) {
popup(saved_size);
} else {
Size2 popup_size = Size2(900, 700) * editor_get_scale();

View File

@ -94,8 +94,9 @@ void EditorSettingsDialog::popup_edit_settings() {
set_process_unhandled_input(true);
// Restore valid window bounds or pop up at default size.
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/editor_settings_bounds")) {
popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds"));
Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "editor_settings", Rect2());
if (saved_size != Rect2()) {
popup(saved_size);
} else {
Size2 popup_size = Size2(900, 700) * editor_get_scale();
@ -132,7 +133,7 @@ void EditorSettingsDialog::_notification(int p_what) {
_update_icons();
} break;
case NOTIFICATION_POPUP_HIDE: {
EditorSettings::get_singleton()->set("interface/dialogs/editor_settings_bounds", get_rect());
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", get_rect());
set_process_unhandled_input(false);
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {