From 1f23bac6454ec51fa1c9f70dead15b0a103cd8c3 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 13 Jul 2022 10:39:08 -0700 Subject: [PATCH] Disable menus and functionality that are not relevant on the Android Editor port --- editor/editor_export.cpp | 13 ++++++++----- editor/editor_node.cpp | 8 ++++++++ editor/project_export.cpp | 15 ++++++++++++++- platform/android/export/export.cpp | 2 ++ platform/javascript/export/export.cpp | 2 ++ platform/osx/export/export.cpp | 2 ++ platform/windows/export/export.cpp | 2 ++ 7 files changed, 38 insertions(+), 6 deletions(-) diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 8c7f30e78ef..726bbba407e 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1693,21 +1693,24 @@ bool EditorExportPlatformPC::has_valid_project_configuration(const Ref &p_preset, String &r_error, bool &r_missing_templates) const { + bool valid = true; +#ifndef ANDROID_ENABLED String templates_error; - bool valid_export_configuration = has_valid_export_configuration(p_preset, templates_error, r_missing_templates); - - String project_configuration_error; - bool valid_project_configuration = has_valid_project_configuration(p_preset, project_configuration_error); + valid = valid && has_valid_export_configuration(p_preset, templates_error, r_missing_templates); if (!templates_error.empty()) { r_error += templates_error; } +#endif + + String project_configuration_error; + valid = valid && has_valid_project_configuration(p_preset, project_configuration_error); if (!project_configuration_error.empty()) { r_error += project_configuration_error; } - return valid_export_configuration && valid_project_configuration; + return valid; } List EditorExportPlatformPC::get_binary_extensions(const Ref &p_preset) const { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b7b050364d5..00daa9037c8 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6429,8 +6429,10 @@ EditorNode::EditorNode() { p->add_separator(); p->add_shortcut(ED_SHORTCUT("editor/export", TTR("Export...")), FILE_EXPORT_PROJECT); +#ifndef ANDROID_ENABLED p->add_item(TTR("Install Android Build Template..."), FILE_INSTALL_ANDROID_SOURCE); p->add_item(TTR("Open User Data Folder"), RUN_USER_DATA_FOLDER); +#endif plugin_config_dialog = memnew(PluginConfigDialog); plugin_config_dialog->connect("plugin_ready", this, "_on_plugin_ready"); @@ -6542,13 +6544,16 @@ EditorNode::EditorNode() { p->add_shortcut(ED_SHORTCUT("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12), EDITOR_SCREENSHOT); #endif p->set_item_tooltip(p->get_item_count() - 1, TTR("Screenshots are stored in the Editor Data/Settings Folder.")); +#ifndef ANDROID_ENABLED #ifdef OSX_ENABLED p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F), SETTINGS_TOGGLE_FULLSCREEN); #else p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN); +#endif #endif p->add_separator(); +#ifndef ANDROID_ENABLED 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) p->add_item(TTR("Open Editor Data/Settings Folder"), SETTINGS_EDITOR_DATA_FOLDER); @@ -6558,9 +6563,12 @@ EditorNode::EditorNode() { p->add_item(TTR("Open Editor Settings Folder"), SETTINGS_EDITOR_CONFIG_FOLDER); } p->add_separator(); +#endif p->add_item(TTR("Manage Editor Features..."), SETTINGS_MANAGE_FEATURE_PROFILES); +#ifndef ANDROID_ENABLED p->add_item(TTR("Manage Export Templates..."), SETTINGS_MANAGE_EXPORT_TEMPLATES); +#endif // Help Menu help_menu = memnew(MenuButton); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 4aea080d330..9fd8dcd6abe 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -893,8 +893,10 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) { } void ProjectExportDialog::_export_all_dialog() { +#ifndef ANDROID_ENABLED export_all_dialog->show(); export_all_dialog->popup_centered_minsize(Size2(300, 80)); +#endif } void ProjectExportDialog::_export_all_dialog_action(const String &p_str) { @@ -1152,11 +1154,16 @@ ProjectExportDialog::ProjectExportDialog() { get_cancel()->set_text(TTR("Close")); get_ok()->set_text(TTR("Export PCK/Zip...")); + get_ok()->set_disabled(true); +#ifdef ANDROID_ENABLED + export_button = memnew(Button); + export_button->hide(); +#else export_button = add_button(TTR("Export Project..."), !OS::get_singleton()->get_swap_ok_cancel(), "export"); +#endif export_button->connect("pressed", this, "_export_project"); // Disable initially before we select a valid preset export_button->set_disabled(true); - get_ok()->set_disabled(true); export_all_dialog = memnew(ConfirmationDialog); add_child(export_all_dialog); @@ -1166,8 +1173,14 @@ ProjectExportDialog::ProjectExportDialog() { export_all_dialog->add_button(TTR("Debug"), true, "debug"); export_all_dialog->add_button(TTR("Release"), true, "release"); export_all_dialog->connect("custom_action", this, "_export_all_dialog_action"); +#ifdef ANDROID_ENABLED + export_all_dialog->hide(); + export_all_button = memnew(Button); + export_all_button->hide(); +#else export_all_button = add_button(TTR("Export All..."), !OS::get_singleton()->get_swap_ok_cancel(), "export"); +#endif export_all_button->connect("pressed", this, "_export_all_dialog"); export_all_button->set_disabled(true); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 9d01f5ce697..4f4a46391da 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -33,6 +33,7 @@ #include "export_plugin.h" void register_android_exporter() { +#ifndef ANDROID_ENABLED EDITOR_DEF("export/android/android_sdk_path", ""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/android/android_sdk_path", PROPERTY_HINT_GLOBAL_DIR)); EDITOR_DEF("export/android/debug_keystore", ""); @@ -42,6 +43,7 @@ void register_android_exporter() { EDITOR_DEF("export/android/force_system_user", false); EDITOR_DEF("export/android/shutdown_adb_on_exit", true); +#endif Ref exporter = Ref(memnew(EditorExportPlatformAndroid)); EditorExport::get_singleton()->add_export_platform(exporter); diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 8c2aae3a827..2c5222b3b7b 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -1020,6 +1020,7 @@ EditorExportPlatformJavaScript::~EditorExportPlatformJavaScript() { } void register_javascript_exporter() { +#ifndef ANDROID_ENABLED EDITOR_DEF("export/web/http_host", "localhost"); EDITOR_DEF("export/web/http_port", 8060); EDITOR_DEF("export/web/use_ssl", false); @@ -1028,6 +1029,7 @@ void register_javascript_exporter() { EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "export/web/http_port", PROPERTY_HINT_RANGE, "1,65535,1")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/web/ssl_key", PROPERTY_HINT_GLOBAL_FILE, "*.key")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/web/ssl_certificate", PROPERTY_HINT_GLOBAL_FILE, "*.crt,*.pem")); +#endif Ref platform; platform.instance(); diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 389118c1510..22893278574 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -1582,8 +1582,10 @@ EditorExportPlatformOSX::~EditorExportPlatformOSX() { } void register_osx_exporter() { +#ifndef ANDROID_ENABLED EDITOR_DEF("export/macos/force_builtin_codesign", false); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::BOOL, "export/macos/force_builtin_codesign", PROPERTY_HINT_NONE)); +#endif Ref platform; platform.instance(); diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index e68423a0390..11bc64b9dad 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -524,6 +524,7 @@ Error EditorExportPlatformWindows::fixup_embedded_pck(const String &p_path, int6 } void register_windows_exporter() { +#ifndef ANDROID_ENABLED EDITOR_DEF("export/windows/rcedit", ""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe")); #ifdef WINDOWS_ENABLED @@ -535,6 +536,7 @@ void register_windows_exporter() { // On non-Windows we need WINE to run rcedit EDITOR_DEF("export/windows/wine", ""); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/wine", PROPERTY_HINT_GLOBAL_FILE)); +#endif #endif Ref platform;