diff options
Diffstat (limited to 'editor/editor_export.cpp')
-rw-r--r-- | editor/editor_export.cpp | 89 |
1 files changed, 32 insertions, 57 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index d3a4dbb6e7..fd4423646f 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,6 +30,7 @@ #include "editor_export.h" +#include "core/config/project_settings.h" #include "core/crypto/crypto_core.h" #include "core/io/config_file.h" #include "core/io/file_access_encrypted.h" @@ -37,10 +38,9 @@ #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/zip_io.h" +#include "core/object/script_language.h" #include "core/os/dir_access.h" #include "core/os/file_access.h" -#include "core/project_settings.h" -#include "core/script_language.h" #include "core/version.h" #include "editor/editor_file_system.h" #include "editor/plugins/script_editor_plugin.h" @@ -185,35 +185,6 @@ bool EditorExportPreset::has_export_file(const String &p_path) { return selected_files.has(p_path); } -void EditorExportPreset::add_patch(const String &p_path, int p_at_pos) { - if (p_at_pos < 0) { - patches.push_back(p_path); - } else { - patches.insert(p_at_pos, p_path); - } - EditorExport::singleton->save_presets(); -} - -void EditorExportPreset::remove_patch(int p_idx) { - patches.remove(p_idx); - EditorExport::singleton->save_presets(); -} - -void EditorExportPreset::set_patch(int p_index, const String &p_path) { - ERR_FAIL_INDEX(p_index, patches.size()); - patches.write[p_index] = p_path; - EditorExport::singleton->save_presets(); -} - -String EditorExportPreset::get_patch(int p_index) { - ERR_FAIL_INDEX_V(p_index, patches.size(), String()); - return patches[p_index]; -} - -Vector<String> EditorExportPreset::get_patches() const { - return patches; -} - void EditorExportPreset::set_custom_features(const String &p_custom_features) { custom_features = p_custom_features; EditorExport::singleton->save_presets(); @@ -427,7 +398,11 @@ Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_pat Ref<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const { Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme(); ERR_FAIL_COND_V(theme.is_null(), Ref<ImageTexture>()); - return theme->get_icon("Play", "EditorIcons"); + if (EditorNode::get_singleton()->get_main_control()->is_layout_rtl()) { + return theme->get_icon("PlayBackwards", "EditorIcons"); + } else { + return theme->get_icon("Play", "EditorIcons"); + } } String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { @@ -546,7 +521,7 @@ void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String & Vector<String> filters; for (int i = 0; i < split.size(); i++) { String f = split[i].strip_edges(); - if (f.empty()) { + if (f.is_empty()) { continue; } filters.push_back(f); @@ -766,6 +741,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & _edit_filter_list(paths, p_preset->get_include_filter(), false); _edit_filter_list(paths, p_preset->get_exclude_filter(), true); + // Ignore import files, since these are automatically added to the jar later with the resources + _edit_filter_list(paths, String("*.import"), true); + // Get encryption filters. bool enc_pck = p_preset->get_enc_pck(); Vector<String> enc_in_filters; @@ -776,7 +754,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Vector<String> enc_in_split = p_preset->get_enc_in_filter().split(","); for (int i = 0; i < enc_in_split.size(); i++) { String f = enc_in_split[i].strip_edges(); - if (f.empty()) { + if (f.is_empty()) { continue; } enc_in_filters.push_back(f); @@ -785,7 +763,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Vector<String> enc_ex_split = p_preset->get_enc_ex_filter().split(","); for (int i = 0; i < enc_ex_split.size(); i++) { String f = enc_ex_split[i].strip_edges(); - if (f.empty()) { + if (f.is_empty()) { continue; } enc_ex_filters.push_back(f); @@ -998,6 +976,15 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & p_func(p_udata, splash, array, idx, total, enc_in_filters, enc_ex_filters, key); } + // Store text server data if exists. + if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) { + String ts_data = "res://" + TS->get_support_data_filename(); + if (FileAccess::exists(ts_data)) { + Vector<uint8_t> array = FileAccess::get_file_as_array(ts_data); + p_func(p_udata, ts_data, array, idx, total, enc_in_filters, enc_ex_filters, key); + } + } + String config_file = "project.binary"; String engine_cfb = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp" + config_file); ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list); @@ -1341,7 +1328,6 @@ void EditorExport::_save() { config->set_value(section, "include_filter", preset->get_include_filter()); config->set_value(section, "exclude_filter", preset->get_exclude_filter()); config->set_value(section, "export_path", preset->get_export_path()); - config->set_value(section, "patch_list", preset->get_patches()); config->set_value(section, "encryption_include_filters", preset->get_enc_in_filter()); config->set_value(section, "encryption_exclude_filters", preset->get_enc_ex_filter()); config->set_value(section, "encrypt_pck", preset->get_enc_pck()); @@ -1529,12 +1515,6 @@ void EditorExport::load_config() { preset->set_exclude_filter(config->get_value(section, "exclude_filter")); preset->set_export_path(config->get_value(section, "export_path", "")); - Vector<String> patch_list = config->get_value(section, "patch_list"); - - for (int i = 0; i < patch_list.size(); i++) { - preset->add_patch(patch_list[i]); - } - if (config->has_section_key(section, "encrypt_pck")) { preset->set_enc_pck(config->get_value(section, "encrypt_pck")); } @@ -1665,15 +1645,17 @@ void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> & } void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) { + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE), "")); + r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE), "")); + + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/64_bits"), true)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false)); + r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/bptc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/no_bptc_fallbacks"), true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/64_bits"), true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/embed_pck"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE), "")); } String EditorExportPlatformPC::get_name() const { @@ -1714,7 +1696,7 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, valid = dvalid || rvalid; r_missing_templates = !valid; - if (!err.empty()) { + if (!err.is_empty()) { r_error = err; } return valid; @@ -1801,7 +1783,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr } } - if (err == OK && !so_files.empty()) { + if (err == OK && !so_files.is_empty()) { //if shared object files, copy them da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); for (int i = 0; i < so_files.size() && err == OK; i++) { @@ -1853,17 +1835,10 @@ void EditorExportPlatformPC::set_debug_32(const String &p_file) { debug_file_32 = p_file; } -void EditorExportPlatformPC::add_platform_feature(const String &p_feature) { - extra_features.insert(p_feature); -} - void EditorExportPlatformPC::get_platform_features(List<String> *r_features) { r_features->push_back("pc"); //all pcs support "pc" r_features->push_back("s3tc"); //all pcs support "s3tc" compression r_features->push_back(get_os_name()); //OS name is a feature - for (Set<String>::Element *E = extra_features.front(); E; E = E->next()) { - r_features->push_back(E->get()); - } } void EditorExportPlatformPC::resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) { |