Ported: Disable menus and functionality that are not relevant on the Android Editor port - m4gr3d

1f23bac645
This commit is contained in:
Relintai 2022-09-17 17:36:35 +02:00
parent 6b9e851e5c
commit f30076a9f5
7 changed files with 47 additions and 14 deletions

View File

@ -1705,21 +1705,25 @@ bool EditorExportPlatformPC::has_valid_project_configuration(const Ref<EditorExp
} }
bool EditorExportPlatform::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { bool EditorExportPlatform::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
String templates_error; bool valid = true;
bool valid_export_configuration = has_valid_export_configuration(p_preset, templates_error, r_missing_templates);
String project_configuration_error; #ifndef ANDROID_ENABLED
bool valid_project_configuration = has_valid_project_configuration(p_preset, project_configuration_error); String templates_error;
valid = valid && has_valid_export_configuration(p_preset, templates_error, r_missing_templates);
if (!templates_error.empty()) { if (!templates_error.empty()) {
r_error += templates_error; 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()) { if (!project_configuration_error.empty()) {
r_error += project_configuration_error; r_error += project_configuration_error;
} }
return valid_export_configuration && valid_project_configuration; return valid;
} }
List<String> EditorExportPlatformPC::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const { List<String> EditorExportPlatformPC::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {

View File

@ -6228,8 +6228,10 @@ EditorNode::EditorNode() {
p->add_separator(); p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/export", TTR("Export...")), FILE_EXPORT_PROJECT); 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("Install Android Build Template..."), FILE_INSTALL_ANDROID_SOURCE);
p->add_item(TTR("Open User Data Folder"), RUN_USER_DATA_FOLDER); p->add_item(TTR("Open User Data Folder"), RUN_USER_DATA_FOLDER);
#endif
plugin_config_dialog = memnew(PluginConfigDialog); plugin_config_dialog = memnew(PluginConfigDialog);
plugin_config_dialog->connect("plugin_ready", this, "_on_plugin_ready"); plugin_config_dialog->connect("plugin_ready", this, "_on_plugin_ready");
@ -6341,13 +6343,16 @@ EditorNode::EditorNode() {
p->add_shortcut(ED_SHORTCUT("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12), EDITOR_SCREENSHOT); p->add_shortcut(ED_SHORTCUT("editor/take_screenshot", TTR("Take Screenshot"), KEY_MASK_CTRL | KEY_F12), EDITOR_SCREENSHOT);
#endif #endif
p->set_item_tooltip(p->get_item_count() - 1, TTR("Screenshots are stored in the Editor Data/Settings Folder.")); 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 #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); p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_CMD | KEY_MASK_CTRL | KEY_F), SETTINGS_TOGGLE_FULLSCREEN);
#else #else
p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN); p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN);
#endif
#endif #endif
p->add_separator(); p->add_separator();
#ifndef ANDROID_ENABLED
if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) { 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); p->add_item(TTR("Open Editor Data/Settings Folder"), SETTINGS_EDITOR_DATA_FOLDER);
@ -6357,8 +6362,11 @@ EditorNode::EditorNode() {
p->add_item(TTR("Open Editor Settings Folder"), SETTINGS_EDITOR_CONFIG_FOLDER); p->add_item(TTR("Open Editor Settings Folder"), SETTINGS_EDITOR_CONFIG_FOLDER);
} }
p->add_separator(); p->add_separator();
#endif
#ifndef ANDROID_ENABLED
p->add_item(TTR("Manage Export Templates..."), SETTINGS_MANAGE_EXPORT_TEMPLATES); p->add_item(TTR("Manage Export Templates..."), SETTINGS_MANAGE_EXPORT_TEMPLATES);
#endif
// Help Menu // Help Menu
help_menu = memnew(MenuButton); help_menu = memnew(MenuButton);

View File

@ -30,17 +30,17 @@
#include "project_export.h" #include "project_export.h"
#include "core/object/class_db.h"
#include "core/variant/dictionary.h"
#include "core/error/error_list.h"
#include "core/error/error_macros.h"
#include "core/containers/list.h"
#include "core/math/rect2.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
#include "core/containers/list.h"
#include "core/containers/set.h" #include "core/containers/set.h"
#include "core/containers/vector.h" #include "core/containers/vector.h"
#include "core/error/error_list.h"
#include "core/error/error_macros.h"
#include "core/math/rect2.h"
#include "core/object/class_db.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/variant/dictionary.h"
#include "editor/editor_export.h" #include "editor/editor_export.h"
#include "editor/editor_file_dialog.h" #include "editor/editor_file_dialog.h"
#include "editor/editor_file_system.h" #include "editor/editor_file_system.h"
@ -902,8 +902,10 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
} }
void ProjectExportDialog::_export_all_dialog() { void ProjectExportDialog::_export_all_dialog() {
#ifndef ANDROID_ENABLED
export_all_dialog->show(); export_all_dialog->show();
export_all_dialog->popup_centered_minsize(Size2(300, 80)); export_all_dialog->popup_centered_minsize(Size2(300, 80));
#endif
} }
void ProjectExportDialog::_export_all_dialog_action(const String &p_str) { void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
@ -1153,11 +1155,16 @@ ProjectExportDialog::ProjectExportDialog() {
get_cancel()->set_text(TTR("Close")); get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Export PCK/Zip")); 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"); export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
#endif
export_button->connect("pressed", this, "_export_project"); export_button->connect("pressed", this, "_export_project");
// Disable initially before we select a valid preset // Disable initially before we select a valid preset
export_button->set_disabled(true); export_button->set_disabled(true);
get_ok()->set_disabled(true);
export_all_dialog = memnew(ConfirmationDialog); export_all_dialog = memnew(ConfirmationDialog);
add_child(export_all_dialog); add_child(export_all_dialog);
@ -1167,8 +1174,14 @@ ProjectExportDialog::ProjectExportDialog() {
export_all_dialog->add_button(TTR("Debug"), true, "debug"); export_all_dialog->add_button(TTR("Debug"), true, "debug");
export_all_dialog->add_button(TTR("Release"), true, "release"); export_all_dialog->add_button(TTR("Release"), true, "release");
export_all_dialog->connect("custom_action", this, "_export_all_dialog_action"); 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"); 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->connect("pressed", this, "_export_all_dialog");
export_all_button->set_disabled(true); export_all_button->set_disabled(true);

View File

@ -35,6 +35,7 @@
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
void register_android_exporter() { void register_android_exporter() {
#ifndef ANDROID_ENABLED
String exe_ext; String exe_ext;
if (OS::get_singleton()->get_name() == "Windows") { if (OS::get_singleton()->get_name() == "Windows") {
exe_ext = "*.exe"; exe_ext = "*.exe";
@ -49,6 +50,7 @@ void register_android_exporter() {
EDITOR_DEF("export/android/force_system_user", false); EDITOR_DEF("export/android/force_system_user", false);
EDITOR_DEF("export/android/shutdown_adb_on_exit", true); EDITOR_DEF("export/android/shutdown_adb_on_exit", true);
#endif
Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>(memnew(EditorExportPlatformAndroid)); Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>(memnew(EditorExportPlatformAndroid));
EditorExport::get_singleton()->add_export_platform(exporter); EditorExport::get_singleton()->add_export_platform(exporter);

View File

@ -1024,6 +1024,7 @@ EditorExportPlatformJavaScript::~EditorExportPlatformJavaScript() {
} }
void register_javascript_exporter() { void register_javascript_exporter() {
#ifndef ANDROID_ENABLED
EDITOR_DEF("export/web/http_host", "localhost"); EDITOR_DEF("export/web/http_host", "localhost");
EDITOR_DEF("export/web/http_port", 8060); EDITOR_DEF("export/web/http_port", 8060);
EDITOR_DEF("export/web/use_ssl", false); EDITOR_DEF("export/web/use_ssl", false);
@ -1032,6 +1033,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::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_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")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/web/ssl_certificate", PROPERTY_HINT_GLOBAL_FILE, "*.crt,*.pem"));
#endif
Ref<EditorExportPlatformJavaScript> platform; Ref<EditorExportPlatformJavaScript> platform;
platform.instance(); platform.instance();

View File

@ -1569,8 +1569,10 @@ EditorExportPlatformOSX::~EditorExportPlatformOSX() {
} }
void register_osx_exporter() { void register_osx_exporter() {
#ifndef ANDROID_ENABLED
EDITOR_DEF("export/macos/force_builtin_codesign", false); 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)); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::BOOL, "export/macos/force_builtin_codesign", PROPERTY_HINT_NONE));
#endif
Ref<EditorExportPlatformOSX> platform; Ref<EditorExportPlatformOSX> platform;
platform.instance(); platform.instance();

View File

@ -527,6 +527,7 @@ Error EditorExportPlatformWindows::fixup_embedded_pck(const String &p_path, int6
} }
void register_windows_exporter() { void register_windows_exporter() {
#ifndef ANDROID_ENABLED
EDITOR_DEF("export/windows/rcedit", ""); EDITOR_DEF("export/windows/rcedit", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe")); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/rcedit", PROPERTY_HINT_GLOBAL_FILE, "*.exe"));
#ifdef WINDOWS_ENABLED #ifdef WINDOWS_ENABLED
@ -538,6 +539,7 @@ void register_windows_exporter() {
// On non-Windows we need WINE to run rcedit // On non-Windows we need WINE to run rcedit
EDITOR_DEF("export/windows/wine", ""); EDITOR_DEF("export/windows/wine", "");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/wine", PROPERTY_HINT_GLOBAL_FILE)); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/windows/wine", PROPERTY_HINT_GLOBAL_FILE));
#endif
#endif #endif
Ref<EditorExportPlatformWindows> platform; Ref<EditorExportPlatformWindows> platform;