diff options
-rw-r--r-- | doc/classes/Array.xml | 10 | ||||
-rw-r--r-- | editor/editor_node.cpp | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 53 | ||||
-rw-r--r-- | editor/project_manager.h | 5 | ||||
-rw-r--r-- | scene/main/window.cpp | 13 |
5 files changed, 52 insertions, 33 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 94181db95f..c149cdc0e4 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -131,9 +131,10 @@ The callable's method should take one [Variant] parameter (the current array element) and return a boolean value. [codeblock] func _ready(): - print([6, 10, 6].all(greater_than_5)) # Prints True (3 elements evaluate to `true`). - print([4, 10, 4].all(greater_than_5)) # Prints False (1 elements evaluate to `true`). - print([4, 4, 4].all(greater_than_5)) # Prints False (0 elements evaluate to `true`). + print([6, 10, 6].all(greater_than_5)) # Prints True (3/3 elements evaluate to `true`). + print([4, 10, 4].all(greater_than_5)) # Prints False (1/3 elements evaluate to `true`). + print([4, 4, 4].all(greater_than_5)) # Prints False (0/3 elements evaluate to `true`). + print([].all(greater_than_5)) # Prints True (0/0 elements evaluate to `true`). print([6, 10, 6].all(func(number): return number > 5)) # Prints True. Same as the first line above, but using lambda function. @@ -142,6 +143,7 @@ [/codeblock] See also [method any], [method filter], [method map] and [method reduce]. [b]Note:[/b] Unlike relying on the size of an array returned by [method filter], this method will return as early as possible to improve performance (especially with large arrays). + [b]Note:[/b] For an empty array, this method [url=https://en.wikipedia.org/wiki/Vacuous_truth]always[/url] returns [code]true[/code]. </description> </method> <method name="any" qualifiers="const"> @@ -155,6 +157,7 @@ print([6, 10, 6].any(greater_than_5)) # Prints True (3 elements evaluate to `true`). print([4, 10, 4].any(greater_than_5)) # Prints True (1 elements evaluate to `true`). print([4, 4, 4].any(greater_than_5)) # Prints False (0 elements evaluate to `true`). + print([].any(greater_than_5)) # Prints False (0 elements evaluate to `true`). print([6, 10, 6].any(func(number): return number > 5)) # Prints True. Same as the first line above, but using lambda function. @@ -163,6 +166,7 @@ [/codeblock] See also [method all], [method filter], [method map] and [method reduce]. [b]Note:[/b] Unlike relying on the size of an array returned by [method filter], this method will return as early as possible to improve performance (especially with large arrays). + [b]Note:[/b] For an empty array, this method always returns [code]false[/code]. </description> </method> <method name="append"> diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d5e29f6973..67d0b83bd6 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1792,6 +1792,10 @@ void EditorNode::save_scene_list(Vector<String> p_scene_filenames) { void EditorNode::restart_editor() { exiting = true; + if (editor_run.get_status() != EditorRun::STATUS_STOP) { + editor_run.stop(); + } + String to_reopen; if (get_tree()->get_edited_scene_root()) { to_reopen = get_tree()->get_edited_scene_root()->get_scene_file_path(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 7fcabb1e80..2e7b6f7476 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1877,6 +1877,15 @@ void ProjectManager::_notification(int p_what) { search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); search_box->set_clear_button_enabled(true); + create_btn->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); + import_btn->set_icon(get_theme_icon(SNAME("Load"), SNAME("EditorIcons"))); + scan_btn->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); + open_btn->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); + run_btn->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); + rename_btn->set_icon(get_theme_icon(SNAME("Rename"), SNAME("EditorIcons"))); + erase_btn->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); + erase_missing_btn->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + Engine::get_singleton()->set_editor_hint(false); } break; @@ -2644,40 +2653,48 @@ ProjectManager::ProjectManager() { tree_vb->set_custom_minimum_size(Size2(120, 120)); local_projects_hb->add_child(tree_vb); - Button *create = memnew(Button); - create->set_text(TTR("New Project")); - create->set_shortcut(ED_SHORTCUT("project_manager/new_project", TTR("New Project"), KeyModifierMask::CMD | Key::N)); - create->connect("pressed", callable_mp(this, &ProjectManager::_new_project)); - tree_vb->add_child(create); - - Button *import = memnew(Button); - import->set_text(TTR("Import")); - import->set_shortcut(ED_SHORTCUT("project_manager/import_project", TTR("Import Project"), KeyModifierMask::CMD | Key::I)); - import->connect("pressed", callable_mp(this, &ProjectManager::_import_project)); - tree_vb->add_child(import); - - Button *scan = memnew(Button); - scan->set_text(TTR("Scan")); - scan->set_shortcut(ED_SHORTCUT("project_manager/scan_projects", TTR("Scan Projects"), KeyModifierMask::CMD | Key::S)); - scan->connect("pressed", callable_mp(this, &ProjectManager::_scan_projects)); - tree_vb->add_child(scan); + const int btn_h_separation = int(6 * EDSCALE); + + create_btn = memnew(Button); + create_btn->set_text(TTR("New Project")); + create_btn->add_theme_constant_override("h_separation", btn_h_separation); + create_btn->set_shortcut(ED_SHORTCUT("project_manager/new_project", TTR("New Project"), KeyModifierMask::CMD | Key::N)); + create_btn->connect("pressed", callable_mp(this, &ProjectManager::_new_project)); + tree_vb->add_child(create_btn); + + import_btn = memnew(Button); + import_btn->set_text(TTR("Import")); + import_btn->add_theme_constant_override("h_separation", btn_h_separation); + import_btn->set_shortcut(ED_SHORTCUT("project_manager/import_project", TTR("Import Project"), KeyModifierMask::CMD | Key::I)); + import_btn->connect("pressed", callable_mp(this, &ProjectManager::_import_project)); + tree_vb->add_child(import_btn); + + scan_btn = memnew(Button); + scan_btn->set_text(TTR("Scan")); + scan_btn->add_theme_constant_override("h_separation", btn_h_separation); + scan_btn->set_shortcut(ED_SHORTCUT("project_manager/scan_projects", TTR("Scan Projects"), KeyModifierMask::CMD | Key::S)); + scan_btn->connect("pressed", callable_mp(this, &ProjectManager::_scan_projects)); + tree_vb->add_child(scan_btn); tree_vb->add_child(memnew(HSeparator)); open_btn = memnew(Button); open_btn->set_text(TTR("Edit")); + open_btn->add_theme_constant_override("h_separation", btn_h_separation); open_btn->set_shortcut(ED_SHORTCUT("project_manager/edit_project", TTR("Edit Project"), KeyModifierMask::CMD | Key::E)); open_btn->connect("pressed", callable_mp(this, &ProjectManager::_open_selected_projects_ask)); tree_vb->add_child(open_btn); run_btn = memnew(Button); run_btn->set_text(TTR("Run")); + run_btn->add_theme_constant_override("h_separation", btn_h_separation); run_btn->set_shortcut(ED_SHORTCUT("project_manager/run_project", TTR("Run Project"), KeyModifierMask::CMD | Key::R)); run_btn->connect("pressed", callable_mp(this, &ProjectManager::_run_project)); tree_vb->add_child(run_btn); rename_btn = memnew(Button); rename_btn->set_text(TTR("Rename")); + rename_btn->add_theme_constant_override("h_separation", btn_h_separation); // The F2 shortcut isn't overridden with Enter on macOS as Enter is already used to edit a project. rename_btn->set_shortcut(ED_SHORTCUT("project_manager/rename_project", TTR("Rename Project"), Key::F2)); rename_btn->connect("pressed", callable_mp(this, &ProjectManager::_rename_project)); @@ -2685,12 +2702,14 @@ ProjectManager::ProjectManager() { erase_btn = memnew(Button); erase_btn->set_text(TTR("Remove")); + erase_btn->add_theme_constant_override("h_separation", btn_h_separation); erase_btn->set_shortcut(ED_SHORTCUT("project_manager/remove_project", TTR("Remove Project"), Key::KEY_DELETE)); erase_btn->connect("pressed", callable_mp(this, &ProjectManager::_erase_project)); tree_vb->add_child(erase_btn); erase_missing_btn = memnew(Button); erase_missing_btn->set_text(TTR("Remove Missing")); + erase_missing_btn->add_theme_constant_override("h_separation", btn_h_separation); erase_missing_btn->connect("pressed", callable_mp(this, &ProjectManager::_erase_missing_projects)); tree_vb->add_child(erase_missing_btn); diff --git a/editor/project_manager.h b/editor/project_manager.h index 2ffe293f3b..28383e4142 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -63,8 +63,11 @@ class ProjectManager : public Control { Label *loading_label = nullptr; OptionButton *filter_option = nullptr; - Button *run_btn = nullptr; + Button *create_btn = nullptr; + Button *import_btn = nullptr; + Button *scan_btn = nullptr; Button *open_btn = nullptr; + Button *run_btn = nullptr; Button *rename_btn = nullptr; Button *erase_btn = nullptr; Button *erase_missing_btn = nullptr; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 1d697a2176..11c2a495ad 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -111,31 +111,19 @@ Size2i Window::get_real_size() const { void Window::set_max_size(const Size2i &p_max_size) { max_size = p_max_size; - if (window_id != DisplayServer::INVALID_WINDOW_ID) { - DisplayServer::get_singleton()->window_set_max_size(max_size, window_id); - } _update_window_size(); } Size2i Window::get_max_size() const { - if (window_id != DisplayServer::INVALID_WINDOW_ID) { - max_size = DisplayServer::get_singleton()->window_get_max_size(window_id); - } return max_size; } void Window::set_min_size(const Size2i &p_min_size) { min_size = p_min_size; - if (!wrap_controls && window_id != DisplayServer::INVALID_WINDOW_ID) { - DisplayServer::get_singleton()->window_set_min_size(min_size, window_id); - } _update_window_size(); } Size2i Window::get_min_size() const { - if (window_id != DisplayServer::INVALID_WINDOW_ID) { - min_size = DisplayServer::get_singleton()->window_get_min_size(window_id); - } return min_size; } @@ -621,6 +609,7 @@ void Window::_update_window_size() { } else if (window_id != DisplayServer::INVALID_WINDOW_ID) { DisplayServer::get_singleton()->window_set_size(size, window_id); DisplayServer::get_singleton()->window_set_min_size(size_limit, window_id); + DisplayServer::get_singleton()->window_set_max_size(max_size, window_id); } //update the viewport |