diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 4 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 30 | ||||
-rw-r--r-- | editor/editor_file_system.h | 1 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 8 | ||||
-rw-r--r-- | editor/find_in_files.cpp | 4 | ||||
-rw-r--r-- | editor/icons/icon_godot_docs.svg | 1 | ||||
-rw-r--r-- | editor/icons/icon_particle_attractor_2d.svg | 1 | ||||
-rw-r--r-- | editor/inspector_dock.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.cpp | 19 | ||||
-rw-r--r-- | editor/plugins/asset_library_editor_plugin.h | 1 | ||||
-rw-r--r-- | editor/plugins/mesh_instance_editor_plugin.cpp | 70 | ||||
-rw-r--r-- | editor/plugins/mesh_instance_editor_plugin.h | 4 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 36 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 38 |
15 files changed, 175 insertions, 48 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index e9719f8618..2edfcced60 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1727,7 +1727,7 @@ void AnimationTimelineEdit::update_values() { time_icon->set_tooltip(TTR("Animation length (frames)")); } else { length->set_value(animation->get_length()); - length->set_step(0.01); + length->set_step(0.001); length->set_tooltip(TTR("Animation length (seconds)")); time_icon->set_tooltip(TTR("Animation length (seconds)")); } @@ -1890,7 +1890,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { length = memnew(EditorSpinSlider); length->set_min(0.001); length->set_max(36000); - length->set_step(0.01); + length->set_step(0.001); length->set_allow_greater(true); length->set_custom_minimum_size(Vector2(70 * EDSCALE, 0)); length->set_hide_slider(true); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 04fe6e5ce6..107ecac3b0 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -675,9 +675,12 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess if (f == "") break; + if (da->current_is_hidden()) + continue; + if (da->current_is_dir()) { - if (f.begins_with(".")) //ignore hidden and . / .. + if (f.begins_with(".")) // Ignore special and . / .. continue; if (FileAccess::exists(cd.plus_file(f).plus_file("project.godot"))) // skip if another project inside this @@ -871,9 +874,12 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const if (f == "") break; + if (da->current_is_hidden()) + continue; + if (da->current_is_dir()) { - if (f.begins_with(".")) //ignore hidden and . / .. + if (f.begins_with(".")) // Ignore special and . / .. continue; int idx = p_dir->find_dir_index(f); @@ -1059,8 +1065,12 @@ void EditorFileSystem::get_changed_sources(List<String> *r_changed) { void EditorFileSystem::scan_changes() { - if (scanning || scanning_changes || thread) + if (first_scan || // Prevent a premature changes scan from inhibiting the first full scan + scanning || scanning_changes || thread) { + scan_changes_pending = true; + set_process(true); return; + } _update_extensions(); sources_changed.clear(); @@ -1105,15 +1115,17 @@ void EditorFileSystem::_notification(int p_what) { } break; case NOTIFICATION_EXIT_TREE: { - if (use_threads && thread) { + Thread *active_thread = thread ? thread : thread_sources; + if (use_threads && active_thread) { //abort thread if in progress abort_scan = true; while (scanning) { OS::get_singleton()->delay_usec(1000); } - Thread::wait_to_finish(thread); - memdelete(thread); + Thread::wait_to_finish(active_thread); + memdelete(active_thread); thread = NULL; + thread_sources = NULL; WARN_PRINT("Scan thread aborted..."); set_process(false); } @@ -1164,6 +1176,11 @@ void EditorFileSystem::_notification(int p_what) { _queue_update_script_classes(); first_scan = false; } + + if (!is_processing() && scan_changes_pending) { + scan_changes_pending = false; + scan_changes(); + } } } break; } @@ -2138,6 +2155,7 @@ EditorFileSystem::EditorFileSystem() { scan_total = 0; update_script_classes_queued = false; first_scan = true; + scan_changes_pending = false; revalidate_import_files = false; } diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index ce9936f983..381acc0fe2 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -145,6 +145,7 @@ class EditorFileSystem : public Node { bool scanning; bool importing; bool first_scan; + bool scan_changes_pending; float scan_total; String filesystem_settings_version_for_import; bool revalidate_import_files; diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 5041441ac3..684942dbad 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1782,6 +1782,14 @@ void FileSystemDock::_resource_created() const { Resource *r = Object::cast_to<Resource>(c); ERR_FAIL_COND(!r); + PackedScene *scene = Object::cast_to<PackedScene>(r); + if (scene) { + Node *node = memnew(Node); + node->set_name("Node"); + scene->pack(node); + memdelete(node); + } + REF res(r); editor->push_item(c); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 4ab90ad3e4..b24a5c38f2 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -235,9 +235,11 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) { if (file == "") break; - // Ignore special dirs and hidden dirs (such as .git and .import) + // Ignore special dirs (such as .git and .import) if (file == "." || file == ".." || file.begins_with(".")) continue; + if (dir->current_is_hidden()) + continue; if (dir->current_is_dir()) out_folders.append(file); diff --git a/editor/icons/icon_godot_docs.svg b/editor/icons/icon_godot_docs.svg deleted file mode 100644 index e38885aed9..0000000000 --- a/editor/icons/icon_godot_docs.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g stroke-width=".32031" transform="matrix(.017241 0 0 .017241 -.82759 -2.7)"><path d="m0 0s-.325 1.994-.515 1.976l-36.182-3.491c-2.879-.278-5.115-2.574-5.317-5.459l-.994-14.247-27.992-1.997-1.904 12.912c-.424 2.872-2.932 5.037-5.835 5.037h-38.188c-2.902 0-5.41-2.165-5.834-5.037l-1.905-12.912-27.992 1.997-.994 14.247c-.202 2.886-2.438 5.182-5.317 5.46l-36.2 3.49c-.187.018-.324-1.978-.511-1.978l-.049-7.83 30.658-4.944 1.004-14.374c.203-2.91 2.551-5.263 5.463-5.472l38.551-2.75c.146-.01.29-.016.434-.016 2.897 0 5.401 2.166 5.825 5.038l1.959 13.286h28.005l1.959-13.286c.423-2.871 2.93-5.037 5.831-5.037.142 0 .284.005.423.015l38.556 2.75c2.911.209 5.26 2.562 5.463 5.472l1.003 14.374 30.645 4.966z" fill="#fff" transform="matrix(4.1626 0 0 -4.1626 919.24 771.67)"/><path d="m0 0v-59.041c.108-.001.216-.005.323-.015l36.196-3.49c1.896-.183 3.382-1.709 3.514-3.609l1.116-15.978 31.574-2.253 2.175 14.747c.282 1.912 1.922 3.329 3.856 3.329h38.188c1.933 0 3.573-1.417 3.855-3.329l2.175-14.747 31.575 2.253 1.115 15.978c.133 1.9 1.618 3.425 3.514 3.609l36.182 3.49c.107.01.214.014.322.015v4.711l.015.005v54.325h.134c4.795 6.12 9.232 12.569 13.487 19.449-5.651 9.62-12.575 18.217-19.976 26.182-6.864-3.455-13.531-7.369-19.828-11.534-3.151 3.132-6.7 5.694-10.186 8.372-3.425 2.751-7.285 4.768-10.946 7.118 1.09 8.117 1.629 16.108 1.846 24.448-9.446 4.754-19.519 7.906-29.708 10.17-4.068-6.837-7.788-14.241-11.028-21.479-3.842.642-7.702.88-11.567.926v.006c-.027 0-.052-.006-.075-.006-.024 0-.049.006-.073.006v-.006c-3.872-.046-7.729-.284-11.572-.926-3.238 7.238-6.956 14.642-11.03 21.479-10.184-2.264-20.258-5.416-29.703-10.17.216-8.34.755-16.331 1.848-24.448-3.668-2.35-7.523-4.367-10.949-7.118-3.481-2.678-7.036-5.24-10.188-8.372-6.297 4.165-12.962 8.079-19.828 11.534-7.401-7.965-14.321-16.562-19.974-26.182 4.253-6.88 8.693-13.329 13.487-19.449z" fill="#478cbf" transform="matrix(4.1626 0 0 -4.1626 104.7 525.91)"/><path d="m0 0-1.121-16.063c-.135-1.936-1.675-3.477-3.611-3.616l-38.555-2.751c-.094-.007-.188-.01-.281-.01-1.916 0-3.569 1.406-3.852 3.33l-2.211 14.994h-31.459l-2.211-14.994c-.297-2.018-2.101-3.469-4.133-3.32l-38.555 2.751c-1.936.139-3.476 1.68-3.611 3.616l-1.121 16.063-32.547 3.138c.015-3.498.06-7.33.06-8.093 0-34.374 43.605-50.896 97.781-51.086h.133c54.176.19 97.766 16.712 97.766 51.086 0 .777.047 4.593.063 8.093z" fill="#478cbf" transform="matrix(4.1626 0 0 -4.1626 784.07 817.24)"/><path d="m0 0c0-12.052-9.765-21.815-21.813-21.815-12.042 0-21.81 9.763-21.81 21.815 0 12.044 9.768 21.802 21.81 21.802 12.048 0 21.813-9.758 21.813-21.802" fill="#fff" transform="matrix(4.1626 0 0 -4.1626 389.21 625.67)"/><path d="m0 0c0-7.994-6.479-14.473-14.479-14.473-7.996 0-14.479 6.479-14.479 14.473s6.483 14.479 14.479 14.479c8 0 14.479-6.485 14.479-14.479" fill="#414042" transform="matrix(4.1626 0 0 -4.1626 367.37 631.06)"/><path d="m0 0c-3.878 0-7.021 2.858-7.021 6.381v20.081c0 3.52 3.143 6.381 7.021 6.381s7.028-2.861 7.028-6.381v-20.081c0-3.523-3.15-6.381-7.028-6.381" fill="#fff" transform="matrix(4.1626 0 0 -4.1626 511.99 724.74)"/><path d="m0 0c0-12.052 9.765-21.815 21.815-21.815 12.041 0 21.808 9.763 21.808 21.815 0 12.044-9.767 21.802-21.808 21.802-12.05 0-21.815-9.758-21.815-21.802" fill="#fff" transform="matrix(4.1626 0 0 -4.1626 634.79 625.67)"/><path d="m0 0c0-7.994 6.477-14.473 14.471-14.473 8.002 0 14.479 6.479 14.479 14.473s-6.477 14.479-14.479 14.479c-7.994 0-14.471-6.485-14.471-14.479" fill="#414042" transform="matrix(4.1626 0 0 -4.1626 656.64 631.06)"/></g><path d="m4 5a3 3 0 0 0 -3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3h2a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0 -3-3 3 3 0 0 0 -2.8262 2h-2.3496a3 3 0 0 0 -2.8242-2zm0 1a2 2 0 0 1 2 2 2 2 0 0 1 -2 2 2 2 0 0 1 -2-2 2 2 0 0 1 2-2zm8 0a2 2 0 0 1 2 2 2 2 0 0 1 -2 2 2 2 0 0 1 -2-2 2 2 0 0 1 2-2z"/></svg>
\ No newline at end of file diff --git a/editor/icons/icon_particle_attractor_2d.svg b/editor/icons/icon_particle_attractor_2d.svg deleted file mode 100644 index 85f289dc4b..0000000000 --- a/editor/icons/icon_particle_attractor_2d.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1a3 7 0 0 0 -2.0801 1.9668 7 3 45 0 0 -2.8691.083984 7 3 45 0 0 -.080078 2.8633 7 3 0 0 0 -1.9707 2.0859 7 3 0 0 0 1.9668 2.0801 3 7 45 0 0 .083984 2.8691 3 7 45 0 0 2.8633.080078 3 7 0 0 0 2.0859 1.9707 3 7 0 0 0 2.0801-1.9668 7 3 45 0 0 2.8691-.083984 7 3 45 0 0 .080078-2.8633 7 3 0 0 0 1.9707-2.0859 7 3 0 0 0 -1.9668-2.0801 3 7 45 0 0 -.083984-2.8691 3 7 45 0 0 -2.8633-.080078 3 7 0 0 0 -2.0859-1.9707zm0 1a2 6 0 0 1 1.2598 1.3438 3 7 45 0 0 -1.2578.75977 7 3 45 0 0 -1.2637-.75781 2 6 0 0 1 1.2617-1.3457zm-3.6348 1.5293a6 2 45 0 1 1.2344.28906 3 7 0 0 0 -.35352 1.4238 7 3 0 0 0 -1.4297.35742 6 2 45 0 1 -.058594-1.8418 6 2 45 0 1 .60742-.22852zm7.0762.0039062a2 6 45 0 1 .80078.22461 2 6 45 0 1 -.060547 1.8418 7 3 0 0 0 -1.4238-.35352 3 7 0 0 0 -.35742-1.4297 2 6 45 0 1 1.041-.2832zm-4.998.70703a6 2 45 0 1 .74023.4707 3 7 45 0 0 -.41211.33984 7 3 0 0 0 -.52344.048828 2 6 0 0 1 .19531-.85938zm3.1152.0019531a2 6 0 0 1 .18945.85547 7 3 0 0 0 -.5293-.050781 7 3 45 0 0 -.4043-.33594 2 6 45 0 1 .74414-.46875zm-1.5586 1.7578a6 2 0 0 1 .82031.021484 6 2 45 0 1 .59375.56445 6 2 45 0 1 .56445.59375 2 6 0 0 1 .021484.82031 2 6 0 0 1 -.021484.82031 2 6 45 0 1 -.56445.59375 2 6 45 0 1 -.59375.56445 6 2 0 0 1 -.82031.021484 6 2 0 0 1 -.82031-.021484 6 2 45 0 1 -.59375-.56445 6 2 45 0 1 -.56445-.59375 2 6 0 0 1 -.021484-.82031 2 6 0 0 1 .021484-.82031 2 6 45 0 1 .56445-.59375 2 6 45 0 1 .59375-.56445 6 2 0 0 1 .82031-.021484zm2.9004.24805a6 2 0 0 1 .85938.19531 2 6 45 0 1 -.4707.74023 7 3 45 0 0 -.33984-.41211 3 7 0 0 0 -.048828-.52344zm-5.8027.0039062a3 7 0 0 0 -.050781.5293 3 7 45 0 0 -.33594.4043 6 2 45 0 1 -.46875-.74414 6 2 0 0 1 .85547-.18945zm7.5566.48633a6 2 0 0 1 1.3457 1.2617 6 2 0 0 1 -1.3438 1.2598 7 3 45 0 0 -.75977-1.2578 3 7 45 0 0 .75781-1.2637zm-9.3105.0019532a7 3 45 0 0 .75977 1.2578 3 7 45 0 0 -.75781 1.2637 6 2 0 0 1 -1.3457-1.2617 6 2 0 0 1 1.3438-1.2598zm4.6562.25977a1 1 0 0 0 -1 1 1 1 0 0 0 1 1 1 1 0 0 0 1-1 1 1 0 0 0 -1-1zm3.2891 1.8145a6 2 45 0 1 .46875.74414 6 2 0 0 1 -.85547.18945 3 7 0 0 0 .050781-.5293 3 7 45 0 0 .33594-.4043zm-6.5781.0019531a7 3 45 0 0 .33984.41211 3 7 0 0 0 .048828.52344 6 2 0 0 1 -.85938-.19531 2 6 45 0 1 .4707-.74023zm-.89258 1.584a7 3 0 0 0 1.4238.35352 3 7 0 0 0 .35742 1.4297 2 6 45 0 1 -1.8418.058594 2 6 45 0 1 .060547-1.8418zm8.3652 0a6 2 45 0 1 .058594 1.8418 6 2 45 0 1 -1.8418-.060547 3 7 0 0 0 .35352-1.4238 7 3 0 0 0 1.4297-.35742zm-2.4316.5a2 6 0 0 1 -.19531.85938 6 2 45 0 1 -.74023-.4707 3 7 45 0 0 .41211-.33984 7 3 0 0 0 .52344-.048828zm-3.5.001953a7 3 0 0 0 .5293.050781 7 3 45 0 0 .4043.33594 2 6 45 0 1 -.74414.46875 2 6 0 0 1 -.18945-.85547zm1.7461.99414a7 3 45 0 0 1.2637.75781 2 6 0 0 1 -1.2617 1.3457 2 6 0 0 1 -1.2598-1.3438 3 7 45 0 0 1.2578-.75977z" fill="#a5b7f3" fill-opacity=".98824"/></svg>
\ No newline at end of file diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index b65482cc6b..ecd1e341d1 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -337,6 +337,7 @@ void InspectorDock::_notification(int p_what) { history_menu->set_icon(get_icon("History", "EditorIcons")); object_menu->set_icon(get_icon("Tools", "EditorIcons")); warning->set_icon(get_icon("NodeWarning", "EditorIcons")); + warning->add_color_override("font_color", get_color("warning_color", "Editor")); } break; } } @@ -584,6 +585,7 @@ InspectorDock::InspectorDock(EditorNode *p_editor, EditorData &p_editor_data) { add_child(warning); warning->set_text(TTR("Changes may be lost!")); warning->set_icon(get_icon("NodeWarning", "EditorIcons")); + warning->add_color_override("font_color", get_color("warning_color", "Editor")); warning->set_clip_text(true); warning->hide(); warning->connect("pressed", this, "_warning_pressed"); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 2428bf82d4..d88a716122 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -31,6 +31,8 @@ #include "asset_library_editor_plugin.h" #include "core/io/json.h" +#include "core/os/input.h" +#include "core/os/keyboard.h" #include "core/version.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" @@ -620,6 +622,21 @@ void EditorAssetLibrary::_notification(int p_what) { } } +void EditorAssetLibrary::_unhandled_input(const Ref<InputEvent> &p_event) { + + const Ref<InputEventKey> key = p_event; + + if (key.is_valid() && key->is_pressed()) { + + if (key->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F) && is_visible_in_tree()) { + + filter->grab_focus(); + filter->select_all(); + accept_event(); + } + } +} + void EditorAssetLibrary::_install_asset() { ERR_FAIL_COND(!description); @@ -1320,6 +1337,7 @@ void EditorAssetLibrary::disable_community_support() { void EditorAssetLibrary::_bind_methods() { + ClassDB::bind_method("_unhandled_input", &EditorAssetLibrary::_unhandled_input); ClassDB::bind_method("_http_request_completed", &EditorAssetLibrary::_http_request_completed); ClassDB::bind_method("_select_asset", &EditorAssetLibrary::_select_asset); ClassDB::bind_method("_select_author", &EditorAssetLibrary::_select_author); @@ -1502,6 +1520,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { description = NULL; set_process(true); + set_process_unhandled_input(true); downloads_scroll = memnew(ScrollContainer); downloads_scroll->set_enable_h_scroll(true); diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index aa3c735810..8852125b8b 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -300,6 +300,7 @@ class EditorAssetLibrary : public PanelContainer { protected: static void _bind_methods(); void _notification(int p_what); + void _unhandled_input(const Ref<InputEvent> &p_event); public: void disable_community_support(); diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp index 25329906a9..6e5307cebe 100644 --- a/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_editor_plugin.cpp @@ -60,10 +60,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { } switch (p_option) { - case MENU_OPTION_CREATE_STATIC_TRIMESH_BODY: - case MENU_OPTION_CREATE_STATIC_CONVEX_BODY: { - - bool trimesh_shape = (p_option == MENU_OPTION_CREATE_STATIC_TRIMESH_BODY); + case MENU_OPTION_CREATE_STATIC_TRIMESH_BODY: { EditorSelection *editor_selection = EditorNode::get_singleton()->get_editor_selection(); UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); @@ -71,9 +68,12 @@ void MeshInstanceEditor::_menu_option(int p_option) { List<Node *> selection = editor_selection->get_selected_node_list(); if (selection.empty()) { - Ref<Shape> shape = trimesh_shape ? mesh->create_trimesh_shape() : mesh->create_convex_shape(); - if (shape.is_null()) + Ref<Shape> shape = mesh->create_trimesh_shape(); + if (shape.is_null()) { + err_dialog->set_text(TTR("Couldn't create a Trimesh collision shape.")); + err_dialog->popup_centered_minsize(); return; + } CollisionShape *cshape = memnew(CollisionShape); cshape->set_shape(shape); @@ -82,11 +82,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner(); - if (trimesh_shape) - ur->create_action(TTR("Create Static Trimesh Body")); - else - ur->create_action(TTR("Create Static Convex Body")); - + ur->create_action(TTR("Create Static Trimesh Body")); ur->add_do_method(node, "add_child", body); ur->add_do_method(body, "set_owner", owner); ur->add_do_method(cshape, "set_owner", owner); @@ -108,7 +104,7 @@ void MeshInstanceEditor::_menu_option(int p_option) { if (m.is_null()) continue; - Ref<Shape> shape = trimesh_shape ? m->create_trimesh_shape() : m->create_convex_shape(); + Ref<Shape> shape = m->create_trimesh_shape(); if (shape.is_null()) continue; @@ -158,10 +154,44 @@ void MeshInstanceEditor::_menu_option(int p_option) { ur->add_undo_method(node->get_parent(), "remove_child", cshape); ur->commit_action(); } break; - case MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE: { + case MENU_OPTION_CREATE_SINGLE_CONVEX_COLLISION_SHAPE: { if (node == get_tree()->get_edited_scene_root()) { - err_dialog->set_text(TTR("This doesn't work on scene root!")); + err_dialog->set_text(TTR("Can't create a single convex collision shape for the scene root.")); + err_dialog->popup_centered_minsize(); + return; + } + + Ref<Shape> shape = mesh->create_convex_shape(); + + if (shape.is_null()) { + err_dialog->set_text(TTR("Couldn't create a single convex collision shape.")); + err_dialog->popup_centered_minsize(); + return; + } + UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); + + ur->create_action(TTR("Create Single Convex Shape")); + + CollisionShape *cshape = memnew(CollisionShape); + cshape->set_shape(shape); + cshape->set_transform(node->get_transform()); + + Node *owner = node->get_owner(); + + ur->add_do_method(node->get_parent(), "add_child", cshape); + ur->add_do_method(node->get_parent(), "move_child", cshape, node->get_index() + 1); + ur->add_do_method(cshape, "set_owner", owner); + ur->add_do_reference(cshape); + ur->add_undo_method(node->get_parent(), "remove_child", cshape); + + ur->commit_action(); + + } break; + case MENU_OPTION_CREATE_MULTIPLE_CONVEX_COLLISION_SHAPES: { + + if (node == get_tree()->get_edited_scene_root()) { + err_dialog->set_text(TTR("Can't create multiple convex collision shapes for the scene root.")); err_dialog->popup_centered_minsize(); return; } @@ -169,13 +199,13 @@ void MeshInstanceEditor::_menu_option(int p_option) { Vector<Ref<Shape> > shapes = mesh->convex_decompose(); if (!shapes.size()) { - err_dialog->set_text(TTR("Failed creating shapes!")); + err_dialog->set_text(TTR("Couldn't create any collision shapes.")); err_dialog->popup_centered_minsize(); return; } UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("Create Convex Shape(s)")); + ur->create_action(TTR("Create Multiple Convex Shapes")); for (int i = 0; i < shapes.size(); i++) { @@ -421,13 +451,19 @@ MeshInstanceEditor::MeshInstanceEditor() { options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("MeshInstance", "EditorIcons")); options->get_popup()->add_item(TTR("Create Trimesh Static Body"), MENU_OPTION_CREATE_STATIC_TRIMESH_BODY); + options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a StaticBody and assigns a polygon-based collision shape to it automatically.\nThis is the most accurate (but slowest) option for collision detection.")); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Create Trimesh Collision Sibling"), MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE); - options->get_popup()->add_item(TTR("Create Convex Collision Sibling(s)"), MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE); + options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a polygon-based collision shape.\nThis is the most accurate (but slowest) option for collision detection.")); + options->get_popup()->add_item(TTR("Create Single Convex Collision Siblings"), MENU_OPTION_CREATE_SINGLE_CONVEX_COLLISION_SHAPE); + options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a single convex collision shape.\nThis is the fastest (but least accurate) option for collision detection.")); + options->get_popup()->add_item(TTR("Create Multiple Convex Collision Siblings"), MENU_OPTION_CREATE_MULTIPLE_CONVEX_COLLISION_SHAPES); + options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a polygon-based collision shape.\nThis is a performance middle-ground between the two above options.")); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Create Navigation Mesh"), MENU_OPTION_CREATE_NAVMESH); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("Create Outline Mesh..."), MENU_OPTION_CREATE_OUTLINE_MESH); + options->get_popup()->set_item_tooltip(options->get_popup()->get_item_count() - 1, TTR("Creates a static outline mesh. The outline mesh will have its normals flipped automatically.\nThis can be used instead of the SpatialMaterial Grow property when using that property isn't possible.")); options->get_popup()->add_separator(); options->get_popup()->add_item(TTR("View UV1"), MENU_OPTION_DEBUG_UV1); options->get_popup()->add_item(TTR("View UV2"), MENU_OPTION_DEBUG_UV2); diff --git a/editor/plugins/mesh_instance_editor_plugin.h b/editor/plugins/mesh_instance_editor_plugin.h index 5c95676fc4..5ca9aa3fec 100644 --- a/editor/plugins/mesh_instance_editor_plugin.h +++ b/editor/plugins/mesh_instance_editor_plugin.h @@ -43,9 +43,9 @@ class MeshInstanceEditor : public Control { enum Menu { MENU_OPTION_CREATE_STATIC_TRIMESH_BODY, - MENU_OPTION_CREATE_STATIC_CONVEX_BODY, MENU_OPTION_CREATE_TRIMESH_COLLISION_SHAPE, - MENU_OPTION_CREATE_CONVEX_COLLISION_SHAPE, + MENU_OPTION_CREATE_SINGLE_CONVEX_COLLISION_SHAPE, + MENU_OPTION_CREATE_MULTIPLE_CONVEX_COLLISION_SHAPES, MENU_OPTION_CREATE_NAVMESH, MENU_OPTION_CREATE_OUTLINE_MESH, MENU_OPTION_CREATE_UV2, diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index f889228f87..0c3e29028c 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -2026,13 +2026,13 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { toolbar->add_child(bucket_fill_button); picker_button = memnew(ToolButton); - picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_CONTROL)); + picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I)); picker_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_PICKING)); picker_button->set_toggle_mode(true); toolbar->add_child(picker_button); select_button = memnew(ToolButton); - select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_MASK_CMD + KEY_B)); + select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M)); select_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SELECTING)); select_button->set_toggle_mode(true); toolbar->add_child(select_button); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index ee434aaac2..9cc2a79399 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -885,7 +885,8 @@ public: rs_button->set_pressed(true); rvb->add_child(rs_button); l = memnew(Label); - l->set_text(TTR("Higher visual quality\nAll features available\nIncompatible with older hardware\nNot recommended for web games")); + l->set_text(TTR("- Higher visual quality\n- All features available\n- Incompatible with older hardware\n- Not recommended for web games")); + l->set_modulate(Color(1, 1, 1, 0.7)); rvb->add_child(l); rshb->add_child(memnew(VSeparator)); @@ -899,12 +900,17 @@ public: rs_button->set_meta("driver_name", "GLES2"); rvb->add_child(rs_button); l = memnew(Label); - l->set_text(TTR("Lower visual quality\nSome features not available\nWorks on most hardware\nRecommended for web games")); + l->set_text(TTR("- Lower visual quality\n- Some features not available\n- Works on most hardware\n- Recommended for web games")); + l->set_modulate(Color(1, 1, 1, 0.7)); rvb->add_child(l); l = memnew(Label); - l->set_text(TTR("Renderer can be changed later, but scenes may need to be adjusted.")); + l->set_text(TTR("The renderer can be changed later, but scenes may need to be adjusted.")); + // Add some extra spacing to separate it from the list above and the buttons below. + l->set_custom_minimum_size(Size2(0, 40) * EDSCALE); l->set_align(Label::ALIGN_CENTER); + l->set_valign(Label::VALIGN_CENTER); + l->set_modulate(Color(1, 1, 1, 0.7)); rasterizer_container->add_child(l); fdialog = memnew(FileDialog); @@ -1037,6 +1043,7 @@ public: void sort_projects(); int get_project_count() const; void select_project(int p_index); + void select_first_visible_project(); void erase_selected_projects(); Vector<Item> get_selected_projects() const; const Set<String> &get_selected_project_keys() const; @@ -1629,6 +1636,23 @@ void ProjectList::select_project(int p_index) { toggle_select(p_index); } +void ProjectList::select_first_visible_project() { + bool found = false; + + for (int i = 0; i < _projects.size(); i++) { + if (_projects[i].control->is_visible()) { + select_project(i); + found = true; + break; + } + } + + if (!found) { + // Deselect all projects if there are no visible projects in the list. + _selected_project_keys.clear(); + } +} + inline void sort(int &a, int &b) { if (a > b) { int temp = a; @@ -2347,6 +2371,12 @@ void ProjectManager::_on_order_option_changed() { void ProjectManager::_on_filter_option_changed() { _project_list->set_search_term(project_filter->get_search_term()); _project_list->sort_projects(); + + // Select the first visible project in the list. + // This makes it possible to open a project without ever touching the mouse, + // as the search field is automatically focused on startup. + _project_list->select_first_visible_project(); + _update_project_buttons(); } void ProjectManager::_bind_methods() { diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index b656fd647f..6635f5cb47 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -719,9 +719,18 @@ void ProjectSettingsEditor::_update_actions() { item->set_range(1, action["deadzone"]); item->set_custom_bg_color(1, get_color("prop_subsection", "Editor")); + const bool is_builtin_input = ProjectSettings::get_singleton()->get_input_presets().find(pi.name) != NULL; + const String tooltip = is_builtin_input ? TTR("Built-in actions can't be removed as they're used for UI navigation.") : TTR("Remove"); item->add_button(2, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event")); - if (!ProjectSettings::get_singleton()->get_input_presets().find(pi.name)) { - item->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove")); + item->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, tooltip); + + if (is_builtin_input) { + // Built-in action (like `ui_up`). Make the action not removable, + // but still display the button so the "Add" button is at the same + // horizontal position as for custom actions. + item->set_button_disabled(2, 1, true); + } else { + // Not a built-in action. Make the action name editable. item->set_editable(0, true); } @@ -747,10 +756,9 @@ void ProjectSettingsEditor::_update_actions() { if (jb.is_valid()) { String str = _get_device_string(jb->get_device()) + ", " + TTR("Button") + " " + itos(jb->get_button_index()); - if (jb->get_button_index() >= 0 && jb->get_button_index() < JOY_BUTTON_MAX) - str += String() + " (" + _button_names[jb->get_button_index()] + ")."; - else - str += "."; + if (jb->get_button_index() >= 0 && jb->get_button_index() < JOY_BUTTON_MAX) { + str += String() + " (" + _button_names[jb->get_button_index()] + ")"; + } action2->set_text(0, str); action2->set_icon(0, get_icon("JoyButton", "EditorIcons")); @@ -761,12 +769,12 @@ void ProjectSettingsEditor::_update_actions() { if (mb.is_valid()) { String str = _get_device_string(mb->get_device()) + ", "; switch (mb->get_button_index()) { - case BUTTON_LEFT: str += TTR("Left Button."); break; - case BUTTON_RIGHT: str += TTR("Right Button."); break; - case BUTTON_MIDDLE: str += TTR("Middle Button."); break; - case BUTTON_WHEEL_UP: str += TTR("Wheel Up."); break; - case BUTTON_WHEEL_DOWN: str += TTR("Wheel Down."); break; - default: str += TTR("Button") + " " + itos(mb->get_button_index()) + "."; + case BUTTON_LEFT: str += TTR("Left Button"); break; + case BUTTON_RIGHT: str += TTR("Right Button"); break; + case BUTTON_MIDDLE: str += TTR("Middle Button"); break; + case BUTTON_WHEEL_UP: str += TTR("Wheel Up"); break; + case BUTTON_WHEEL_DOWN: str += TTR("Wheel Down"); break; + default: str += vformat(TTR("%d Button"), mb->get_button_index()); } action2->set_text(0, str); @@ -780,7 +788,7 @@ void ProjectSettingsEditor::_update_actions() { int ax = jm->get_axis(); int n = 2 * ax + (jm->get_axis_value() < 0 ? 0 : 1); String desc = _axis_names[n]; - String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc + "."; + String str = _get_device_string(jm->get_device()) + ", " + TTR("Axis") + " " + itos(ax) + " " + (jm->get_axis_value() < 0 ? "-" : "+") + desc; action2->set_text(0, str); action2->set_icon(0, get_icon("JoyAxis", "EditorIcons")); } @@ -789,6 +797,10 @@ void ProjectSettingsEditor::_update_actions() { action2->add_button(2, get_icon("Edit", "EditorIcons"), 3, false, TTR("Edit")); action2->add_button(2, get_icon("Remove", "EditorIcons"), 2, false, TTR("Remove")); + // Fade out the individual event buttons slightly to make the + // Add/Remove buttons stand out more. + action2->set_button_color(2, 0, Color(1, 1, 1, 0.75)); + action2->set_button_color(2, 1, Color(1, 1, 1, 0.75)); } } |