diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 256 |
1 files changed, 151 insertions, 105 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index dbe741a438..b4850e6ebb 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -97,10 +97,14 @@ #include "editor/editor_translation_parser.h" #include "editor/export_template_manager.h" #include "editor/filesystem_dock.h" +#include "editor/import/dynamicfont_import_settings.h" #include "editor/import/editor_import_collada.h" #include "editor/import/resource_importer_bitmask.h" +#include "editor/import/resource_importer_bmfont.h" #include "editor/import/resource_importer_csv_translation.h" +#include "editor/import/resource_importer_dynamicfont.h" #include "editor/import/resource_importer_image.h" +#include "editor/import/resource_importer_imagefont.h" #include "editor/import/resource_importer_layered_texture.h" #include "editor/import/resource_importer_obj.h" #include "editor/import/resource_importer_scene.h" @@ -388,20 +392,22 @@ void EditorNode::_version_control_menu_option(int p_idx) { } void EditorNode::_update_title() { - String appname = ProjectSettings::get_singleton()->get("application/config/name"); - String title = appname.is_empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname); - String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); + const String appname = ProjectSettings::get_singleton()->get("application/config/name"); + String title = (appname.is_empty() ? "Unnamed Project" : appname) + String(" - ") + VERSION_NAME; + const String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); if (!edited.is_empty()) { - title += " - " + String(edited.get_file()); + // Display the edited scene name before the program name so that it can be seen in the OS task bar. + title = vformat("%s - %s", edited.get_file(), title); } if (unsaved_cache) { - title += " (*)"; + // Display the "modified" mark before anything else so that it can always be seen in the OS task bar. + title = vformat("(*) %s", title); } DisplayServer::get_singleton()->window_set_title(title); } -void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) { +void EditorNode::unhandled_input(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); Ref<InputEventKey> k = p_event; @@ -518,6 +524,26 @@ void EditorNode::_update_from_settings() { RS::get_singleton()->light_projectors_set_filter(RS::LightProjectorFilter(int(GLOBAL_GET("rendering/textures/light_projectors/filter")))); } +void EditorNode::_select_default_main_screen_plugin() { + if (EDITOR_3D < main_editor_buttons.size() && main_editor_buttons[EDITOR_3D]->is_visible()) { + // If the 3D editor is enabled, use this as the default. + _editor_select(EDITOR_3D); + return; + } + + // Switch to the first main screen plugin that is enabled. Usually this is + // 2D, but may be subsequent ones if 2D is disabled in the feature profile. + for (int i = 0; i < main_editor_buttons.size(); i++) { + Button *editor_button = main_editor_buttons[i]; + if (editor_button->is_visible()) { + _editor_select(i); + return; + } + } + + _editor_select(-1); +} + void EditorNode::_notification(int p_what) { switch (p_what) { case NOTIFICATION_PROCESS: { @@ -589,29 +615,12 @@ void EditorNode::_notification(int p_what) { } break; case NOTIFICATION_READY: { - { - _initializing_addons = true; - Vector<String> addons; - if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) { - addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled"); - } - - for (int i = 0; i < addons.size(); i++) { - set_addon_plugin_enabled(addons[i], true); - } - _initializing_addons = false; - } - RenderingServer::get_singleton()->viewport_set_disable_2d(get_scene_root()->get_viewport_rid(), true); RenderingServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true); feature_profile_manager->notify_changed(); - if (!main_editor_buttons[EDITOR_3D]->is_visible()) { //may be hidden due to feature profile - _editor_select(EDITOR_2D); - } else { - _editor_select(EDITOR_3D); - } + _select_default_main_screen_plugin(); // Save the project after opening to mark it as last modified, except in headless mode. if (DisplayServer::get_singleton()->window_can_draw()) { @@ -964,6 +973,18 @@ void EditorNode::_sources_changed(bool p_exist) { load_scene(defer_load_scene); defer_load_scene = ""; } + + // Only enable addons once resources have been imported + _initializing_addons = true; + Vector<String> addons; + if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) { + addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled"); + } + + for (int i = 0; i < addons.size(); i++) { + set_addon_plugin_enabled(addons[i], true); + } + _initializing_addons = false; } } @@ -1850,7 +1871,7 @@ void EditorNode::_dialog_action(String p_file) { ml = Ref<MeshLibrary>(memnew(MeshLibrary)); } - MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true); + MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true, file_export_lib_apply_xforms->is_pressed()); Error err = ResourceSaver::save(p_file, ml); if (err) { @@ -2086,7 +2107,6 @@ void EditorNode::_edit_current() { Object *prev_inspected_object = get_inspector()->get_edited_object(); - bool capitalize = bool(EDITOR_GET("interface/inspector/capitalize_properties")); bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding")); bool is_resource = current_obj->is_class("Resource"); bool is_node = current_obj->is_class("Node"); @@ -2144,7 +2164,6 @@ void EditorNode::_edit_current() { if (current_obj->is_class("EditorDebuggerRemoteObject")) { editable_warning = TTR("This is a remote object, so changes to it won't be kept.\nPlease read the documentation relevant to debugging to better understand this workflow."); - capitalize = false; disable_folding = true; } else if (current_obj->is_class("MultiNodeEdit")) { Node *scene = get_edited_scene(); @@ -2181,10 +2200,6 @@ void EditorNode::_edit_current() { inspector_dock->set_warning(editable_warning); - if (get_inspector()->is_capitalize_paths_enabled() != capitalize) { - get_inspector()->set_enable_capitalize_paths(capitalize); - } - if (get_inspector()->is_using_folding() == disable_folding) { get_inspector()->set_use_folding(!disable_folding); } @@ -3100,9 +3115,10 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed tb->set_flat(true); tb->set_toggle_mode(true); tb->connect("pressed", callable_mp(singleton, &EditorNode::_editor_select), varray(singleton->main_editor_buttons.size())); + tb->set_name(p_editor->get_name()); tb->set_text(p_editor->get_name()); - Ref<Texture2D> icon = p_editor->get_icon(); + Ref<Texture2D> icon = p_editor->get_icon(); if (icon.is_valid()) { tb->set_icon(icon); } else if (singleton->gui_base->has_theme_icon(p_editor->get_name(), "EditorIcons")) { @@ -3112,7 +3128,6 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed tb->add_theme_font_override("font", singleton->gui_base->get_theme_font(SNAME("main_button_font"), SNAME("EditorFonts"))); tb->add_theme_font_size_override("font_size", singleton->gui_base->get_theme_font_size(SNAME("main_button_font_size"), SNAME("EditorFonts"))); - tb->set_name(p_editor->get_name()); singleton->main_editor_buttons.push_back(tb); singleton->main_editor_button_vb->add_child(tb); singleton->editor_table.push_back(p_editor); @@ -3263,10 +3278,6 @@ void EditorNode::_remove_edited_scene(bool p_change_tab) { new_index = 1; } - if (editor_data.get_scene_path(old_index) != String()) { - ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index)); - } - if (p_change_tab) { _scene_tab_changed(new_index); } @@ -4764,6 +4775,10 @@ bool EditorNode::ensure_main_scene(bool p_from_native) { return true; } +Error EditorNode::run_play_native(int p_idx, int p_platform) { + return run_native->run_native(p_idx, p_platform); +} + void EditorNode::run_play() { _menu_option_confirm(RUN_STOP, true); _run(false); @@ -4798,6 +4813,32 @@ String EditorNode::get_run_playing_scene() const { return run_filename; } +void EditorNode::_immediate_dialog_confirmed() { + immediate_dialog_confirmed = true; +} +bool EditorNode::immediate_confirmation_dialog(const String &p_text, const String &p_ok_text, const String &p_cancel_text) { + ConfirmationDialog *cd = memnew(ConfirmationDialog); + cd->set_text(p_text); + cd->get_ok_button()->set_text(p_ok_text); + cd->get_cancel_button()->set_text(p_cancel_text); + cd->connect("confirmed", callable_mp(singleton, &EditorNode::_immediate_dialog_confirmed)); + singleton->gui_base->add_child(cd); + + cd->popup_centered(); + + while (true) { + OS::get_singleton()->delay_usec(1); + DisplayServer::get_singleton()->process_events(); + Main::iteration(); + if (singleton->immediate_dialog_confirmed || !cd->is_visible()) { + break; + } + } + + memdelete(cd); + return singleton->immediate_dialog_confirmed; +} + int EditorNode::get_current_tab() { return scene_tabs->get_current_tab(); } @@ -5586,7 +5627,6 @@ void EditorNode::_bind_methods() { ClassDB::bind_method("_editor_select", &EditorNode::_editor_select); ClassDB::bind_method("_node_renamed", &EditorNode::_node_renamed); ClassDB::bind_method("edit_node", &EditorNode::edit_node); - ClassDB::bind_method("_unhandled_input", &EditorNode::_unhandled_input); ClassDB::bind_method(D_METHOD("push_item", "object", "property", "inspector_only"), &EditorNode::push_item, DEFVAL(""), DEFVAL(false)); @@ -5826,6 +5866,18 @@ EditorNode::EditorNode() { import_texture_atlas.instantiate(); ResourceFormatImporter::get_singleton()->add_importer(import_texture_atlas); + Ref<ResourceImporterDynamicFont> import_font_data_dynamic; + import_font_data_dynamic.instantiate(); + ResourceFormatImporter::get_singleton()->add_importer(import_font_data_dynamic); + + Ref<ResourceImporterBMFont> import_font_data_bmfont; + import_font_data_bmfont.instantiate(); + ResourceFormatImporter::get_singleton()->add_importer(import_font_data_bmfont); + + Ref<ResourceImporterImageFont> import_font_data_image; + import_font_data_image.instantiate(); + ResourceFormatImporter::get_singleton()->add_importer(import_font_data_image); + Ref<ResourceImporterCSVTranslation> import_csv_translation; import_csv_translation.instantiate(); ResourceFormatImporter::get_singleton()->add_importer(import_csv_translation); @@ -5915,7 +5967,7 @@ EditorNode::EditorNode() { EDITOR_DEF_RST("interface/editor/save_each_scene_on_quit", true); EDITOR_DEF("interface/editor/show_update_spinner", false); EDITOR_DEF("interface/editor/update_continuously", false); - EDITOR_DEF_RST("interface/scene_tabs/restore_scenes_on_load", false); + EDITOR_DEF_RST("interface/scene_tabs/restore_scenes_on_load", true); EDITOR_DEF_RST("interface/scene_tabs/show_thumbnail_on_hover", true); EDITOR_DEF_RST("interface/inspector/capitalize_properties", true); EDITOR_DEF_RST("interface/inspector/default_float_step", 0.001); @@ -6151,11 +6203,9 @@ EditorNode::EditorNode() { tabbar_container->add_child(scene_tabs); distraction_free = memnew(Button); distraction_free->set_flat(true); -#ifdef OSX_ENABLED - distraction_free->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D)); -#else - distraction_free->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11)); -#endif + ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11); + ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_D); + distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode")); distraction_free->set_tooltip(TTR("Toggle distraction-free mode.")); distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode)); distraction_free->set_icon(gui_base->get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons"))); @@ -6231,6 +6281,9 @@ EditorNode::EditorNode() { scene_import_settings = memnew(SceneImportSettings); gui_base->add_child(scene_import_settings); + fontdata_import_settings = memnew(DynamicFontImportSettings); + gui_base->add_child(fontdata_import_settings); + export_template_manager = memnew(ExportTemplateManager); gui_base->add_child(export_template_manager); @@ -6340,11 +6393,9 @@ EditorNode::EditorNode() { p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/reload_current_project", TTR("Reload Current Project")), RUN_RELOAD_CURRENT_PROJECT); -#ifdef OSX_ENABLED - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q), RUN_PROJECT_MANAGER, true); -#else - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_Q), RUN_PROJECT_MANAGER, true); -#endif + ED_SHORTCUT_AND_COMMAND("editor/quit_to_project_list", TTR("Quit to Project List"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_Q); + ED_SHORTCUT_OVERRIDE("editor/quit_to_project_list", "macos", KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q); + p->add_shortcut(ED_GET_SHORTCUT("editor/quit_to_project_list"), RUN_PROJECT_MANAGER, true); menu_hb->add_spacer(); @@ -6369,11 +6420,10 @@ EditorNode::EditorNode() { left_menu_hb->add_child(settings_menu); p = settings_menu->get_popup(); -#ifdef OSX_ENABLED - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings..."), KEY_MASK_CMD + KEY_COMMA), SETTINGS_PREFERENCES); -#else - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings...")), SETTINGS_PREFERENCES); -#endif + + ED_SHORTCUT_AND_COMMAND("editor/editor_settings", TTR("Editor Settings...")); + ED_SHORTCUT_OVERRIDE("editor/editor_settings", "macos", KEY_MASK_CMD + KEY_COMMA); + p->add_shortcut(ED_GET_SHORTCUT("editor/editor_settings"), SETTINGS_PREFERENCES); p->add_shortcut(ED_SHORTCUT("editor/command_palette", TTR("Command Palette..."), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_P), HELP_COMMAND_PALETTE); p->add_separator(); @@ -6383,17 +6433,17 @@ EditorNode::EditorNode() { editor_layouts->connect("id_pressed", callable_mp(this, &EditorNode::_layout_menu_option)); p->add_submenu_item(TTR("Editor Layout"), "Layouts"); p->add_separator(); -#ifdef OSX_ENABLED - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CMD | KEY_F12), EDITOR_SCREENSHOT); -#else - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12), EDITOR_SCREENSHOT); -#endif + + ED_SHORTCUT_AND_COMMAND("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12); + ED_SHORTCUT_OVERRIDE("editor/take_screenshot", "macos", KEY_MASK_CMD | KEY_F12); + p->add_shortcut(ED_GET_SHORTCUT("editor/take_screenshot"), EDITOR_SCREENSHOT); + p->set_item_tooltip(p->get_item_count() - 1, TTR("Screenshots are stored in the Editor Data/Settings Folder.")); -#ifdef OSX_ENABLED - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F), SETTINGS_TOGGLE_FULLSCREEN); -#else - p->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN); -#endif + + ED_SHORTCUT_AND_COMMAND("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11); + ED_SHORTCUT_OVERRIDE("editor/fullscreen_mode", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F); + p->add_shortcut(ED_GET_SHORTCUT("editor/fullscreen_mode"), SETTINGS_TOGGLE_FULLSCREEN); + #if defined(WINDOWS_ENABLED) && defined(WINDOWS_SUBSYSTEM_CONSOLE) // The console can only be toggled if the application was built for the console subsystem, // not the GUI subsystem. @@ -6402,7 +6452,7 @@ EditorNode::EditorNode() { p->add_separator(); if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) { - // Configuration and data folders are located in the same place (Windows/macOS) + // Configuration and data folders are located in the same place (Windows/macos) p->add_item(TTR("Open Editor Data/Settings Folder"), SETTINGS_EDITOR_DATA_FOLDER); } else { // Separate configuration and data folders (Linux) @@ -6424,11 +6474,10 @@ EditorNode::EditorNode() { p = help_menu->get_popup(); p->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option)); -#ifdef OSX_ENABLED - p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), KEY_MASK_ALT | KEY_SPACE), HELP_SEARCH); -#else - p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), KEY_F1), HELP_SEARCH); -#endif + + ED_SHORTCUT_AND_COMMAND("editor/editor_help", TTR("Search Help"), KEY_F1); + ED_SHORTCUT_OVERRIDE("editor/editor_help", "macos", KEY_MASK_ALT | KEY_SPACE); + p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("HelpSearch"), SNAME("EditorIcons")), ED_GET_SHORTCUT("editor/editor_help"), HELP_SEARCH); p->add_separator(); p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/online_docs", TTR("Online Documentation")), HELP_DOCS); p->add_icon_shortcut(gui_base->get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_SHORTCUT_AND_COMMAND("editor/q&a", TTR("Questions & Answers")), HELP_QA); @@ -6451,11 +6500,10 @@ EditorNode::EditorNode() { play_button->set_focus_mode(Control::FOCUS_NONE); play_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY)); play_button->set_tooltip(TTR("Play the project.")); -#ifdef OSX_ENABLED - play_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), KEY_MASK_CMD | KEY_B)); -#else - play_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), KEY_F5)); -#endif + + ED_SHORTCUT_AND_COMMAND("editor/play", TTR("Play"), KEY_F5); + ED_SHORTCUT_OVERRIDE("editor/play", "macos", KEY_MASK_CMD | KEY_B); + play_button->set_shortcut(ED_GET_SHORTCUT("editor/play")); pause_button = memnew(Button); pause_button->set_flat(true); @@ -6465,11 +6513,10 @@ EditorNode::EditorNode() { pause_button->set_tooltip(TTR("Pause the scene execution for debugging.")); pause_button->set_disabled(true); play_hb->add_child(pause_button); -#ifdef OSX_ENABLED - pause_button->set_shortcut(ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y)); -#else - pause_button->set_shortcut(ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_F7)); -#endif + + ED_SHORTCUT("editor/pause_scene", TTR("Pause Scene"), KEY_F7); + ED_SHORTCUT_OVERRIDE("editor/pause_scene", "macos", KEY_MASK_CMD | KEY_MASK_CTRL | KEY_Y); + pause_button->set_shortcut(ED_GET_SHORTCUT("editor/pause_scene")); stop_button = memnew(Button); stop_button->set_flat(true); @@ -6479,11 +6526,10 @@ EditorNode::EditorNode() { stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_STOP)); stop_button->set_tooltip(TTR("Stop the scene.")); stop_button->set_disabled(true); -#ifdef OSX_ENABLED - stop_button->set_shortcut(ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_MASK_CMD | KEY_PERIOD)); -#else - stop_button->set_shortcut(ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_F8)); -#endif + + ED_SHORTCUT("editor/stop", TTR("Stop"), KEY_F8); + ED_SHORTCUT_OVERRIDE("editor/stop", "macos", KEY_MASK_CMD | KEY_PERIOD); + stop_button->set_shortcut(ED_GET_SHORTCUT("editor/stop")); run_native = memnew(EditorRunNative); play_hb->add_child(run_native); @@ -6497,11 +6543,10 @@ EditorNode::EditorNode() { play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons"))); play_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_SCENE)); play_scene_button->set_tooltip(TTR("Play the edited scene.")); -#ifdef OSX_ENABLED - play_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), KEY_MASK_CMD | KEY_R)); -#else - play_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), KEY_F6)); -#endif + + ED_SHORTCUT_AND_COMMAND("editor/play_scene", TTR("Play Scene"), KEY_F6); + ED_SHORTCUT_OVERRIDE("editor/play_scene", "macos", KEY_MASK_CMD | KEY_R); + play_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/play_scene")); play_custom_scene_button = memnew(Button); play_custom_scene_button->set_flat(true); @@ -6511,11 +6556,10 @@ EditorNode::EditorNode() { play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons"))); play_custom_scene_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option), make_binds(RUN_PLAY_CUSTOM_SCENE)); play_custom_scene_button->set_tooltip(TTR("Play custom scene")); -#ifdef OSX_ENABLED - play_custom_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R)); -#else - play_custom_scene_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5)); -#endif + + ED_SHORTCUT_AND_COMMAND("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5); + ED_SHORTCUT_OVERRIDE("editor/play_custom_scene", "macos", KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_R); + play_custom_scene_button->set_shortcut(ED_GET_SHORTCUT("editor/play_custom_scene")); HBoxContainer *right_menu_hb = memnew(HBoxContainer); menu_hb->add_child(right_menu_hb); @@ -6767,6 +6811,10 @@ EditorNode::EditorNode() { file_export_lib_merge->set_text(TTR("Merge With Existing")); file_export_lib_merge->set_pressed(true); file_export_lib->get_vbox()->add_child(file_export_lib_merge); + file_export_lib_apply_xforms = memnew(CheckBox); + file_export_lib_apply_xforms->set_text(TTR("Apply MeshInstance Transforms")); + file_export_lib_apply_xforms->set_pressed(false); + file_export_lib->get_vbox()->add_child(file_export_lib_apply_xforms); gui_base->add_child(file_export_lib); file_script = memnew(EditorFileDialog); @@ -6792,7 +6840,6 @@ EditorNode::EditorNode() { preview_gen = memnew(AudioStreamPreviewGenerator); add_child(preview_gen); - //plugin stuff add_editor_plugin(memnew(DebuggerEditorPlugin(this, debug_menu))); add_editor_plugin(memnew(DebugAdapterServer())); @@ -7048,20 +7095,19 @@ EditorNode::EditorNode() { ResourceSaver::set_save_callback(_resource_saved); ResourceLoader::set_load_callback(_resource_loaded); -#ifdef OSX_ENABLED - ED_SHORTCUT_AND_COMMAND("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_ALT | KEY_1); - ED_SHORTCUT_AND_COMMAND("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_ALT | KEY_2); - ED_SHORTCUT_AND_COMMAND("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_ALT | KEY_3); - ED_SHORTCUT_AND_COMMAND("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_ALT | KEY_4); -#else // Use the Ctrl modifier so F2 can be used to rename nodes in the scene tree dock. ED_SHORTCUT_AND_COMMAND("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_CTRL | KEY_F1); ED_SHORTCUT_AND_COMMAND("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_CTRL | KEY_F2); ED_SHORTCUT_AND_COMMAND("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_CTRL | KEY_F3); ED_SHORTCUT_AND_COMMAND("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_CTRL | KEY_F4); -#endif - ED_SHORTCUT_AND_COMMAND("editor/editor_next", TTR("Next Editor Tab")); - ED_SHORTCUT_AND_COMMAND("editor/editor_prev", TTR("Previous Editor Tab")); + + ED_SHORTCUT_OVERRIDE("editor/editor_2d", "macos", KEY_MASK_ALT | KEY_1); + ED_SHORTCUT_OVERRIDE("editor/editor_3d", "macos", KEY_MASK_ALT | KEY_2); + ED_SHORTCUT_OVERRIDE("editor/editor_script", "macos", KEY_MASK_ALT | KEY_3); + ED_SHORTCUT_OVERRIDE("editor/editor_assetlib", "macos", KEY_MASK_ALT | KEY_4); + + ED_SHORTCUT_AND_COMMAND("editor/editor_next", TTR("Open the next Editor")); + ED_SHORTCUT_AND_COMMAND("editor/editor_prev", TTR("Open the previous Editor")); screenshot_timer = memnew(Timer); screenshot_timer->set_one_shot(true); |