diff options
Diffstat (limited to 'editor/editor_export.cpp')
-rw-r--r-- | editor/editor_export.cpp | 199 |
1 files changed, 54 insertions, 145 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index e8167070d4..87ca499413 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -48,7 +48,6 @@ #include "scene/resources/resource_format_text.h" static int _get_pad(int p_alignment, int p_n) { - int rest = p_n % p_alignment; int pad = 0; if (rest > 0) { @@ -61,7 +60,6 @@ static int _get_pad(int p_alignment, int p_n) { #define PCK_PADDING 16 bool EditorExportPreset::_set(const StringName &p_name, const Variant &p_value) { - if (values.has(p_name)) { values[p_name] = p_value; EditorExport::singleton->save_presets(); @@ -72,7 +70,6 @@ bool EditorExportPreset::_set(const StringName &p_name, const Variant &p_value) } bool EditorExportPreset::_get(const StringName &p_name, Variant &r_ret) const { - if (values.has(p_name)) { r_ret = values[p_name]; return true; @@ -82,9 +79,7 @@ bool EditorExportPreset::_get(const StringName &p_name, Variant &r_ret) const { } void EditorExportPreset::_get_property_list(List<PropertyInfo> *p_list) const { - for (const List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) { - if (platform->get_option_visibility(E->get().name, values)) { p_list->push_back(E->get()); } @@ -92,12 +87,10 @@ void EditorExportPreset::_get_property_list(List<PropertyInfo> *p_list) const { } Ref<EditorExportPlatform> EditorExportPreset::get_platform() const { - return platform; } Vector<String> EditorExportPreset::get_files_to_export() const { - Vector<String> files; for (Set<String>::Element *E = selected_files.front(); E; E = E->next()) { files.push_back(E->get()); @@ -115,18 +108,15 @@ String EditorExportPreset::get_name() const { } void EditorExportPreset::set_runnable(bool p_enable) { - runnable = p_enable; EditorExport::singleton->save_presets(); } bool EditorExportPreset::is_runnable() const { - return runnable; } void EditorExportPreset::set_export_filter(ExportFilter p_filter) { - export_filter = p_filter; EditorExport::singleton->save_presets(); } @@ -136,18 +126,15 @@ EditorExportPreset::ExportFilter EditorExportPreset::get_export_filter() const { } void EditorExportPreset::set_include_filter(const String &p_include) { - include_filter = p_include; EditorExport::singleton->save_presets(); } String EditorExportPreset::get_include_filter() const { - return include_filter; } void EditorExportPreset::set_export_path(const String &p_path) { - export_path = p_path; /* NOTE(SonerSound): if there is a need to implement a PropertyHint that specifically indicates a relative path, * this should be removed. */ @@ -159,23 +146,19 @@ void EditorExportPreset::set_export_path(const String &p_path) { } String EditorExportPreset::get_export_path() const { - return export_path; } void EditorExportPreset::set_exclude_filter(const String &p_exclude) { - exclude_filter = p_exclude; EditorExport::singleton->save_presets(); } String EditorExportPreset::get_exclude_filter() const { - return exclude_filter; } void EditorExportPreset::add_export_file(const String &p_path) { - selected_files.insert(p_path); EditorExport::singleton->save_presets(); } @@ -186,16 +169,15 @@ void EditorExportPreset::remove_export_file(const String &p_path) { } 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) + if (p_at_pos < 0) { patches.push_back(p_path); - else + } else { patches.insert(p_at_pos, p_path); + } EditorExport::singleton->save_presets(); } @@ -209,8 +191,8 @@ void EditorExportPreset::set_patch(int p_index, const String &p_path) { patches.write[p_index] = p_path; EditorExport::singleton->save_presets(); } -String EditorExportPreset::get_patch(int p_index) { +String EditorExportPreset::get_patch(int p_index) { ERR_FAIL_INDEX_V(p_index, patches.size(), String()); return patches[p_index]; } @@ -220,54 +202,41 @@ Vector<String> EditorExportPreset::get_patches() const { } void EditorExportPreset::set_custom_features(const String &p_custom_features) { - custom_features = p_custom_features; EditorExport::singleton->save_presets(); } String EditorExportPreset::get_custom_features() const { - return custom_features; } void EditorExportPreset::set_script_export_mode(int p_mode) { - script_mode = p_mode; EditorExport::singleton->save_presets(); } int EditorExportPreset::get_script_export_mode() const { - return script_mode; } void EditorExportPreset::set_script_encryption_key(const String &p_key) { - script_key = p_key; EditorExport::singleton->save_presets(); } String EditorExportPreset::get_script_encryption_key() const { - return script_key; } -EditorExportPreset::EditorExportPreset() : - export_filter(EXPORT_ALL_RESOURCES), - export_path(""), - runnable(false), - script_mode(MODE_SCRIPT_COMPILED) { -} - /////////////////////////////////// void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) { - String host = EditorSettings::get_singleton()->get("network/debug/remote_host"); int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); - if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) + if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) { host = "localhost"; + } if (p_flags & DEBUG_FLAG_DUMB_CLIENT) { int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); @@ -281,23 +250,21 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) } if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) { - r_flags.push_back("--remote-debug"); - r_flags.push_back(host + ":" + String::num(remote_port)); + r_flags.push_back(get_debug_protocol() + host + ":" + String::num(remote_port)); List<String> breakpoints; ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); if (breakpoints.size()) { - r_flags.push_back("--breakpoints"); String bpoints; for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) { - bpoints += E->get().replace(" ", "%20"); - if (E->next()) + if (E->next()) { bpoints += ","; + } } r_flags.push_back(bpoints); @@ -305,18 +272,15 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) } if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) { - r_flags.push_back("--debug-collisions"); } if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) { - r_flags.push_back("--debug-navigation"); } } Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) { - PackData *pd = (PackData *)p_userdata; SavedData sd; @@ -349,7 +313,6 @@ Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_pa } Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) { - String path = p_path.replace_first("res://", ""); ZipData *zd = (ZipData *)p_userdata; @@ -384,7 +347,6 @@ Ref<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const { } String EditorExportPlatform::find_export_template(String template_file_name, String *err) const { - String current_version = VERSION_FULL_CONFIG; String template_path = EditorSettings::get_singleton()->get_templates_dir().plus_file(current_version).plus_file(template_file_name); @@ -404,7 +366,6 @@ bool EditorExportPlatform::exists_export_template(String template_file_name, Str } Ref<EditorExportPreset> EditorExportPlatform::create_preset() { - Ref<EditorExportPreset> preset; preset.instance(); preset->platform = Ref<EditorExportPlatform>(this); @@ -413,7 +374,6 @@ Ref<EditorExportPreset> EditorExportPlatform::create_preset() { get_export_options(&options); for (List<ExportOption>::Element *E = options.front(); E; E = E->next()) { - preset->properties.push_back(E->get().option); preset->values[E->get().option.name] = E->get().default_value; } @@ -422,7 +382,6 @@ Ref<EditorExportPreset> EditorExportPlatform::create_preset() { } void EditorExportPlatform::_export_find_resources(EditorFileSystemDirectory *p_dir, Set<String> &p_paths) { - for (int i = 0; i < p_dir->get_subdir_count(); i++) { _export_find_resources(p_dir->get_subdir(i), p_paths); } @@ -433,40 +392,40 @@ void EditorExportPlatform::_export_find_resources(EditorFileSystemDirectory *p_d } void EditorExportPlatform::_export_find_dependencies(const String &p_path, Set<String> &p_paths) { - - if (p_paths.has(p_path)) + if (p_paths.has(p_path)) { return; + } p_paths.insert(p_path); EditorFileSystemDirectory *dir; int file_idx; dir = EditorFileSystem::get_singleton()->find_file(p_path, &file_idx); - if (!dir) + if (!dir) { return; + } Vector<String> deps = dir->get_file_deps(file_idx); for (int i = 0; i < deps.size(); i++) { - _export_find_dependencies(deps[i], p_paths); } } void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude) { - da->list_dir_begin(); String cur_dir = da->get_current_dir().replace("\\", "/"); - if (!cur_dir.ends_with("/")) + if (!cur_dir.ends_with("/")) { cur_dir += "/"; + } String cur_dir_no_prefix = cur_dir.replace("res://", ""); Vector<String> dirs; String f; while ((f = da->get_next()) != "") { - if (da->current_is_dir()) + if (da->current_is_dir()) { dirs.push_back(f); - else { + } else { String fullpath = cur_dir + f; // Test also against path without res:// so that filters like `file.txt` can work. String fullpath_no_prefix = cur_dir_no_prefix + f; @@ -486,8 +445,9 @@ void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<S for (int i = 0; i < dirs.size(); ++i) { String dir = dirs[i]; - if (dir.begins_with(".")) + if (dir.begins_with(".")) { continue; + } da->change_dir(dir); _edit_files_with_filter(da, p_filters, r_list, exclude); da->change_dir(".."); @@ -495,15 +455,16 @@ void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<S } void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude) { - - if (p_filter == "") + if (p_filter == "") { return; + } Vector<String> split = p_filter.split(","); Vector<String> filters; for (int i = 0; i < split.size(); i++) { String f = split[i].strip_edges(); - if (f.empty()) + if (f.empty()) { continue; + } filters.push_back(f); } @@ -514,19 +475,16 @@ void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String & } void EditorExportPlugin::set_export_preset(const Ref<EditorExportPreset> &p_preset) { - if (p_preset.is_valid()) { export_preset = p_preset; } } Ref<EditorExportPreset> EditorExportPlugin::get_export_preset() const { - return export_preset; } void EditorExportPlugin::add_file(const String &p_path, const Vector<uint8_t> &p_file, bool p_remap) { - ExtraFile ef; ef.data = p_file; ef.path = p_path; @@ -535,7 +493,6 @@ void EditorExportPlugin::add_file(const String &p_path, const Vector<uint8_t> &p } void EditorExportPlugin::add_shared_object(const String &p_path, const Vector<String> &tags) { - shared_objects.push_back(SharedObject(p_path, tags)); } @@ -591,21 +548,18 @@ Vector<String> EditorExportPlugin::get_ios_project_static_libs() const { } void EditorExportPlugin::_export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features) { - if (get_script_instance()) { get_script_instance()->call("_export_file", p_path, p_type, p_features); } } void EditorExportPlugin::_export_begin_script(const Vector<String> &p_features, bool p_debug, const String &p_path, int p_flags) { - if (get_script_instance()) { get_script_instance()->call("_export_begin", p_features, p_debug, p_path, p_flags); } } void EditorExportPlugin::_export_end_script() { - if (get_script_instance()) { get_script_instance()->call("_export_end"); } @@ -618,12 +572,10 @@ void EditorExportPlugin::_export_begin(const Set<String> &p_features, bool p_deb } void EditorExportPlugin::skip() { - skipped = true; } void EditorExportPlugin::_bind_methods() { - ClassDB::bind_method(D_METHOD("add_shared_object", "path", "tags"), &EditorExportPlugin::add_shared_object); ClassDB::bind_method(D_METHOD("add_ios_project_static_lib", "path"), &EditorExportPlugin::add_ios_project_static_lib); ClassDB::bind_method(D_METHOD("add_file", "path", "file", "remap"), &EditorExportPlugin::add_file); @@ -656,7 +608,6 @@ EditorExportPlatform::FeatureContainers EditorExportPlatform::get_feature_contai } if (p_preset->get_custom_features() != String()) { - Vector<String> tmp_custom_list = p_preset->get_custom_features().split(","); for (int i = 0; i < tmp_custom_list.size(); i++) { @@ -707,8 +658,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Vector<String> files = p_preset->get_files_to_export(); for (int i = 0; i < files.size(); i++) { - if (scenes_only && ResourceLoader::get_resource_type(files[i]) != "PackedScene") + if (scenes_only && ResourceLoader::get_resource_type(files[i]) != "PackedScene") { continue; + } _export_find_dependencies(files[i], paths); } @@ -723,7 +675,6 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Vector<Ref<EditorExportPlugin>> export_plugins = EditorExport::get_singleton()->get_export_plugins(); for (int i = 0; i < export_plugins.size(); i++) { - export_plugins.write[i]->set_export_preset(p_preset); if (p_so_func) { @@ -747,7 +698,6 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & int total = paths.size(); for (Set<String>::Element *E = paths.front(); E; E = E->next()) { - String path = E->get(); String type = ResourceLoader::get_resource_type(path); @@ -767,7 +717,6 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Set<String> remap_features; for (List<String>::Element *F = remaps.front(); F; F = F->next()) { - String remap = F->get(); String feature = remap.get_slice(".", 1); if (features.has(feature)) { @@ -782,7 +731,6 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & err = OK; for (List<String>::Element *F = remaps.front(); F; F = F->next()) { - String remap = F->get(); if (remap == "path") { String remapped_path = config->get_value("remap", remap); @@ -812,7 +760,6 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & } } else { - bool do_export = true; for (int i = 0; i < export_plugins.size(); i++) { if (export_plugins[i]->get_script_instance()) { //script based @@ -840,8 +787,9 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & } export_plugins.write[i]->_clear(); - if (!do_export) + if (!do_export) { break; //apologies, not exporting + } } //just store it as it comes if (do_export) { @@ -858,7 +806,6 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & Vector<String> custom_list; if (p_preset->get_custom_features() != String()) { - Vector<String> tmp_custom_list = p_preset->get_custom_features().split(","); for (int i = 0; i < tmp_custom_list.size(); i++) { @@ -871,7 +818,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> & ProjectSettings::CustomMap custom_map; if (path_remaps.size()) { - if (1) { //new remap mode, use always as it's friendlier with multiple .pck exports + if (true) { //new remap mode, use always as it's friendlier with multiple .pck exports for (int i = 0; i < path_remaps.size(); i += 2) { String from = path_remaps[i]; String to = path_remaps[i + 1]; @@ -924,7 +871,6 @@ Error EditorExportPlatform::_add_shared_object(void *p_userdata, const SharedObj } Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path, Vector<SharedObject> *p_so_files, bool p_embed, int64_t *r_embedded_start, int64_t *r_embedded_size) { - EditorProgress ep("savepack", TTR("Packing"), 102, true); String tmppath = EditorSettings::get_singleton()->get_cache_dir().plus_file("packtmp"); @@ -1009,7 +955,6 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c int header_padding = _get_pad(PCK_PADDING, header_size); for (int i = 0; i < pd.file_ofs.size(); i++) { - int string_len = pd.file_ofs[i].path_utf8.length(); int pad = _get_pad(4, string_len); @@ -1041,10 +986,10 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c uint8_t buf[bufsize]; while (true) { - int got = ftmp->get_buffer(buf, bufsize); - if (got <= 0) + if (got <= 0) { break; + } f->store_buffer(buf, got); } @@ -1074,7 +1019,6 @@ Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, c } Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path) { - EditorProgress ep("savezip", TTR("Packing"), 102, true); FileAccess *src_f; @@ -1086,8 +1030,9 @@ Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, co zd.zip = zip; Error err = export_project_files(p_preset, _save_zip_file, &zd); - if (err != OK && err != ERR_SKIP) + if (err != OK && err != ERR_SKIP) { ERR_PRINT("Failed to export project files"); + } zipClose(zip, nullptr); @@ -1105,12 +1050,12 @@ Error EditorExportPlatform::export_zip(const Ref<EditorExportPreset> &p_preset, } void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) { - String host = EditorSettings::get_singleton()->get("network/debug/remote_host"); int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); - if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) + if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) { host = "localhost"; + } if (p_flags & DEBUG_FLAG_DUMB_CLIENT) { int port = EditorSettings::get_singleton()->get("filesystem/file_server/port"); @@ -1124,23 +1069,21 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags } if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) { - r_flags.push_back("--remote-debug"); - r_flags.push_back(host + ":" + String::num(remote_port)); + r_flags.push_back(get_debug_protocol() + host + ":" + String::num(remote_port)); List<String> breakpoints; ScriptEditor::get_singleton()->get_breakpoints(&breakpoints); if (breakpoints.size()) { - r_flags.push_back("--breakpoints"); String bpoints; for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) { - bpoints += E->get().replace(" ", "%20"); - if (E->next()) + if (E->next()) { bpoints += ","; + } } r_flags.push_back(bpoints); @@ -1148,15 +1091,14 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags } if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) { - r_flags.push_back("--debug-collisions"); } if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) { - r_flags.push_back("--debug-navigation"); } } + EditorExportPlatform::EditorExportPlatform() { } @@ -1165,11 +1107,9 @@ EditorExportPlatform::EditorExportPlatform() { EditorExport *EditorExport::singleton = nullptr; void EditorExport::_save() { - Ref<ConfigFile> config; config.instance(); for (int i = 0; i < export_presets.size(); i++) { - Ref<EditorExportPreset> preset = export_presets[i]; String section = "preset." + itos(i); @@ -1215,9 +1155,9 @@ void EditorExport::_save() { } void EditorExport::save_presets() { - - if (block_save) + if (block_save) { return; + } save_timer->start(); } @@ -1225,32 +1165,28 @@ void EditorExport::_bind_methods() { } void EditorExport::add_export_platform(const Ref<EditorExportPlatform> &p_platform) { - export_platforms.push_back(p_platform); } int EditorExport::get_export_platform_count() { - return export_platforms.size(); } Ref<EditorExportPlatform> EditorExport::get_export_platform(int p_idx) { - ERR_FAIL_INDEX_V(p_idx, export_platforms.size(), Ref<EditorExportPlatform>()); return export_platforms[p_idx]; } void EditorExport::add_export_preset(const Ref<EditorExportPreset> &p_preset, int p_at_pos) { - - if (p_at_pos < 0) + if (p_at_pos < 0) { export_presets.push_back(p_preset); - else + } else { export_presets.insert(p_at_pos, p_preset); + } } String EditorExportPlatform::test_etc2() const { - String driver = ProjectSettings::get_singleton()->get("rendering/quality/driver/driver_name"); bool etc_supported = ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc"); bool etc2_supported = ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc2"); @@ -1265,62 +1201,55 @@ String EditorExportPlatform::test_etc2() const { } int EditorExport::get_export_preset_count() const { - return export_presets.size(); } Ref<EditorExportPreset> EditorExport::get_export_preset(int p_idx) { - ERR_FAIL_INDEX_V(p_idx, export_presets.size(), Ref<EditorExportPreset>()); return export_presets[p_idx]; } void EditorExport::remove_export_preset(int p_idx) { - export_presets.remove(p_idx); save_presets(); } void EditorExport::add_export_plugin(const Ref<EditorExportPlugin> &p_plugin) { - if (export_plugins.find(p_plugin) == -1) { export_plugins.push_back(p_plugin); } } void EditorExport::remove_export_plugin(const Ref<EditorExportPlugin> &p_plugin) { - export_plugins.erase(p_plugin); } Vector<Ref<EditorExportPlugin>> EditorExport::get_export_plugins() { - return export_plugins; } void EditorExport::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { load_config(); } } void EditorExport::load_config() { - Ref<ConfigFile> config; config.instance(); Error err = config->load("res://export_presets.cfg"); - if (err != OK) + if (err != OK) { return; + } block_save = true; int index = 0; while (true) { - String section = "preset." + itos(index); - if (!config->has_section(section)) + if (!config->has_section(section)) { break; + } String platform = config->get_value(section, "platform"); @@ -1360,7 +1289,6 @@ void EditorExport::load_config() { } if (get_files) { - Vector<String> files = config->get_value(section, "export_files"); for (int i = 0; i < files.size(); i++) { @@ -1392,7 +1320,6 @@ void EditorExport::load_config() { config->get_section_keys(option_section, &options); for (List<String>::Element *E = options.front(); E; E = E->next()) { - Variant value = config->get_value(option_section, E->get()); preset->set(E->get(), value); @@ -1406,7 +1333,6 @@ void EditorExport::load_config() { } bool EditorExport::poll_export_platforms() { - bool changed = false; for (int i = 0; i < export_platforms.size(); i++) { if (export_platforms.write[i]->poll_export()) { @@ -1418,7 +1344,6 @@ bool EditorExport::poll_export_platforms() { } EditorExport::EditorExport() { - save_timer = memnew(Timer); add_child(save_timer); save_timer->set_wait_time(0.8); @@ -1435,7 +1360,6 @@ EditorExport::~EditorExport() { ////////// void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { - if (p_preset->get("texture_format/s3tc")) { r_features->push_back("s3tc"); } @@ -1454,7 +1378,6 @@ void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> & } void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) { - 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)); @@ -1467,21 +1390,18 @@ void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) { } String EditorExportPlatformPC::get_name() const { - return name; } String EditorExportPlatformPC::get_os_name() const { - return os_name; } -Ref<Texture2D> EditorExportPlatformPC::get_logo() const { +Ref<Texture2D> EditorExportPlatformPC::get_logo() const { return logo; } bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const { - String err; bool valid = false; @@ -1507,8 +1427,9 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, valid = dvalid || rvalid; r_missing_templates = !valid; - if (!err.empty()) + if (!err.empty()) { r_error = err; + } return valid; } @@ -1544,7 +1465,6 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr template_path = template_path.strip_edges(); if (template_path == String()) { - if (p_preset->get("binary_format/64_bits")) { if (p_debug) { template_path = find_export_template(debug_file_64); @@ -1583,7 +1503,6 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr int64_t embedded_size; err = save_pack(p_preset, pck_path, &so_files, p_preset->get("binary_format/embed_pck"), &embedded_pos, &embedded_size); if (err == OK && p_preset->get("binary_format/embed_pck")) { - if (embedded_size >= 0x100000000 && !p_preset->get("binary_format/64_bits")) { EditorNode::get_singleton()->show_warning(TTR("On 32-bit exports the embedded PCK cannot be bigger than 4 GiB.")); return ERR_INVALID_PARAMETER; @@ -1632,25 +1551,22 @@ void EditorExportPlatformPC::set_logo(const Ref<Texture2D> &p_logo) { } void EditorExportPlatformPC::set_release_64(const String &p_file) { - release_file_64 = p_file; } void EditorExportPlatformPC::set_release_32(const String &p_file) { - release_file_32 = p_file; } -void EditorExportPlatformPC::set_debug_64(const String &p_file) { +void EditorExportPlatformPC::set_debug_64(const String &p_file) { debug_file_64 = p_file; } -void EditorExportPlatformPC::set_debug_32(const String &p_file) { +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); } @@ -1664,7 +1580,6 @@ void EditorExportPlatformPC::get_platform_features(List<String> *r_features) { } void EditorExportPlatformPC::resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) { - if (p_features.has("bptc")) { if (p_preset->has("texture_format/no_bptc_fallbacks")) { p_features.erase("s3tc"); @@ -1673,27 +1588,22 @@ void EditorExportPlatformPC::resolve_platform_feature_priorities(const Ref<Edito } int EditorExportPlatformPC::get_chmod_flags() const { - return chmod_flags; } void EditorExportPlatformPC::set_chmod_flags(int p_flags) { - chmod_flags = p_flags; } EditorExportPlatformPC::FixUpEmbeddedPckFunc EditorExportPlatformPC::get_fixup_embedded_pck_func() const { - return fixup_embedded_pck_func; } void EditorExportPlatformPC::set_fixup_embedded_pck_func(FixUpEmbeddedPckFunc p_fixup_embedded_pck_func) { - fixup_embedded_pck_func = p_fixup_embedded_pck_func; } EditorExportPlatformPC::EditorExportPlatformPC() { - chmod_flags = -1; fixup_embedded_pck_func = nullptr; } @@ -1701,15 +1611,15 @@ EditorExportPlatformPC::EditorExportPlatformPC() { /////////////////////// void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, const String &p_type, const Set<String> &p_features) { - String extension = p_path.get_extension().to_lower(); if (extension != "tres" && extension != "tscn") { return; } bool convert = GLOBAL_GET("editor/convert_text_resources_to_binary_on_export"); - if (!convert) + if (!convert) { return; + } String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpfile.res"); Error err = ResourceFormatLoaderText::convert_file_to_binary(p_path, tmp_path); if (err != OK) { @@ -1726,6 +1636,5 @@ void EditorExportTextSceneToBinaryPlugin::_export_file(const String &p_path, con } EditorExportTextSceneToBinaryPlugin::EditorExportTextSceneToBinaryPlugin() { - GLOBAL_DEF("editor/convert_text_resources_to_binary_on_export", false); } |