diff --git a/editor/export/editor_export.cpp b/editor/export/editor_export.cpp index aeb49661691..4e3b249e70c 100644 --- a/editor/export/editor_export.cpp +++ b/editor/export/editor_export.cpp @@ -47,6 +47,7 @@ void EditorExport::_save() { config->set_value(section, "name", preset->get_name()); config->set_value(section, "platform", preset->get_platform()->get_name()); config->set_value(section, "runnable", preset->is_runnable()); + config->set_value(section, "advanced_options", preset->are_advanced_options_enabled()); config->set_value(section, "dedicated_server", preset->is_dedicated_server()); config->set_value(section, "custom_features", preset->get_custom_features()); @@ -227,6 +228,7 @@ void EditorExport::load_config() { } preset->set_name(config->get_value(section, "name")); + preset->set_advanced_options_enabled(config->get_value(section, "advanced_options", false)); preset->set_runnable(config->get_value(section, "runnable")); preset->set_dedicated_server(config->get_value(section, "dedicated_server", false)); diff --git a/editor/export/editor_export_preset.cpp b/editor/export/editor_export_preset.cpp index 8c3b6693e39..a2996043bac 100644 --- a/editor/export/editor_export_preset.cpp +++ b/editor/export/editor_export_preset.cpp @@ -228,6 +228,19 @@ bool EditorExportPreset::is_runnable() const { return runnable; } +void EditorExportPreset::set_advanced_options_enabled(bool p_enabled) { + if (advanced_options_enabled == p_enabled) { + return; + } + advanced_options_enabled = p_enabled; + EditorExport::singleton->save_presets(); + notify_property_list_changed(); +} + +bool EditorExportPreset::are_advanced_options_enabled() const { + return advanced_options_enabled; +} + void EditorExportPreset::set_dedicated_server(bool p_enable) { dedicated_server = p_enable; EditorExport::singleton->save_presets(); diff --git a/editor/export/editor_export_preset.h b/editor/export/editor_export_preset.h index 03ff75b4677..c6a8808af12 100644 --- a/editor/export/editor_export_preset.h +++ b/editor/export/editor_export_preset.h @@ -71,6 +71,7 @@ private: HashSet selected_files; HashMap customized_files; bool runnable = false; + bool advanced_options_enabled = false; bool dedicated_server = false; friend class EditorExport; @@ -128,6 +129,9 @@ public: void set_runnable(bool p_enable); bool is_runnable() const; + void set_advanced_options_enabled(bool p_enabled); + bool are_advanced_options_enabled() const; + void set_dedicated_server(bool p_enable); bool is_dedicated_server() const; diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 4a066b3d3e2..dbdc44a18f4 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -240,6 +240,7 @@ void ProjectExportDialog::_edit_preset(int p_index) { name->set_text(""); name->set_editable(false); export_path->hide(); + advanced_options->set_disabled(true); runnable->set_disabled(true); parameters->edit(nullptr); presets->deselect_all(); @@ -274,6 +275,8 @@ void ProjectExportDialog::_edit_preset(int p_index) { export_path->setup(extension_vector, false, true); export_path->update_property(); + advanced_options->set_disabled(false); + advanced_options->set_pressed(current->are_advanced_options_enabled()); runnable->set_disabled(false); runnable->set_pressed(current->is_runnable()); if (parameters->get_edited_object() != current.ptr()) { @@ -449,6 +452,18 @@ void ProjectExportDialog::_update_parameters(const String &p_edited_property) { _update_current_preset(); } +void ProjectExportDialog::_advanced_options_pressed() { + if (updating) { + return; + } + + Ref current = get_current_preset(); + ERR_FAIL_COND(current.is_null()); + + current->set_advanced_options_enabled(advanced_options->is_pressed()); + _update_presets(); +} + void ProjectExportDialog::_runnable_pressed() { if (updating) { return; @@ -637,6 +652,7 @@ void ProjectExportDialog::_duplicate_preset() { if (make_runnable) { preset->set_runnable(make_runnable); } + preset->set_advanced_options_enabled(current->are_advanced_options_enabled()); preset->set_dedicated_server(current->is_dedicated_server()); preset->set_export_filter(current->get_export_filter()); preset->set_include_filter(current->get_include_filter()); @@ -1236,11 +1252,22 @@ ProjectExportDialog::ProjectExportDialog() { name = memnew(LineEdit); settings_vb->add_margin_child(TTR("Name:"), name); name->connect("text_changed", callable_mp(this, &ProjectExportDialog::_name_changed)); + runnable = memnew(CheckButton); runnable->set_text(TTR("Runnable")); runnable->set_tooltip_text(TTR("If checked, the preset will be available for use in one-click deploy.\nOnly one preset per platform may be marked as runnable.")); runnable->connect("pressed", callable_mp(this, &ProjectExportDialog::_runnable_pressed)); - settings_vb->add_child(runnable); + + advanced_options = memnew(CheckButton); + advanced_options->set_text(TTR("Advanced Options")); + advanced_options->set_tooltip_text(TTR("If checked, the advanced options will be shown.")); + advanced_options->connect("pressed", callable_mp(this, &ProjectExportDialog::_advanced_options_pressed)); + + HBoxContainer *preset_configs_container = memnew(HBoxContainer); + preset_configs_container->add_spacer(true); + preset_configs_container->add_child(advanced_options); + preset_configs_container->add_child(runnable); + settings_vb->add_child(preset_configs_container); export_path = memnew(EditorPropertyPath); settings_vb->add_child(export_path); @@ -1413,6 +1440,7 @@ ProjectExportDialog::ProjectExportDialog() { // Disable by default. name->set_editable(false); export_path->hide(); + advanced_options->set_disabled(true); runnable->set_disabled(true); duplicate_preset->set_disabled(true); delete_preset->set_disabled(true); diff --git a/editor/export/project_export.h b/editor/export/project_export.h index 0fe7ecc2a8f..bcab05cebb9 100644 --- a/editor/export/project_export.h +++ b/editor/export/project_export.h @@ -81,6 +81,7 @@ class ProjectExportDialog : public ConfirmationDialog { EditorPropertyPath *export_path = nullptr; EditorInspector *parameters = nullptr; CheckButton *runnable = nullptr; + CheckButton *advanced_options = nullptr; Button *button_export = nullptr; bool updating = false; @@ -119,6 +120,7 @@ class ProjectExportDialog : public ConfirmationDialog { bool exporting = false; + void _advanced_options_pressed(); void _runnable_pressed(); void _update_parameters(const String &p_edited_property); void _name_changed(const String &p_string); diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 52cb366d9f5..612bf2d3ac4 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -1883,13 +1883,22 @@ void EditorExportPlatformAndroid::get_export_options(List *r_optio } bool EditorExportPlatformAndroid::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const { + if (p_preset == nullptr) { + return true; + } + + bool advanced_options_enabled = p_preset->are_advanced_options_enabled(); + if (p_option == "graphics/opengl_debug" || + p_option == "command_line/extra_args" || + p_option == "permissions/custom_permissions") { + return advanced_options_enabled; + } if (p_option == "gradle_build/gradle_build_directory" || p_option == "gradle_build/android_source_template") { - // @todo These are experimental options - keep them hidden for now. - //return (bool)p_preset->get("gradle_build/use_gradle_build"); - return false; - } else if (p_option == "custom_template/debug" || p_option == "custom_template/release") { + return advanced_options_enabled && bool(p_preset->get("gradle_build/use_gradle_build")); + } + if (p_option == "custom_template/debug" || p_option == "custom_template/release") { // The APK templates are ignored if Gradle build is enabled. - return !p_preset->get("gradle_build/use_gradle_build"); + return advanced_options_enabled && !bool(p_preset->get("gradle_build/use_gradle_build")); } return true; }